Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Oct 2005 12:27:06 +0200
From:      Robert Millan <rmh@aybabtu.com>
To:        ports@freebsd.org
Subject:   Re: gzip-like CLI wrapper for p7zip
Message-ID:  <20051019102706.GA28521@aragorn>
In-Reply-To: <20051018200544.GA26528@saturn.kn-bremen.de>
References:  <20051018140137.GA16159@aragorn> <20051018200544.GA26528@saturn.kn-bremen.de>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Oct 18, 2005 at 10:05:44PM +0200, Juergen Lock wrote:
> 
> Well I could add it to the port (see below), but I think the need for
> tempfiles is unfortunate because it can cause problems like /tmp
> filling up.

I'm aware of this.  Unfortunately, p7zip doesn't seem to support streaming.
Try the following command:

  $ echo foo | 7z a dummy -si -so > /dev/null

  (see http://bugs.debian.org/323932 for more details on this)

I don't think the changes are trivial.  Most likely the algorithm requires
random access, and with my very reduced knowledge in compression techniques or
p7zip internals, this isn't something I can fix.

> Maybe the 7z lib that cloop uses [1] [2] could be used
> for a `real' tempfile-less p7zip?
> [...]
> [1]	http://advancemame.sourceforge.net/comp-readme.html

It reads:

"Recompress ZIP, GZ, PNG and MNG files using the Deflate 7-Zip implementation."

I don't think this means it supports 7z format.  Most likely it just means it
took the deflate algorithm code (for gzip, etc) from the 7-zip program (the
Windows version, which is also LGPL).

> (I dont know the 7z file format,
> maybe a new format has to be created in order to require no seeking,
> meaning the extension would have to be changed as well. (like gzip
> had to do with the zip format.)  so maybe we shouldn't standardize
> on a p7zip command just yet...)

Sorry, I don't know the 7z format either.  However, much like other compression
formats, it is versioned:

  rmh@aragorn:/tmp$ echo foo | p7zip | file -
  /dev/stdin: 7z archive data, version 0.2

I don't think there's a problem with standarising on a p7zip command.  Streaming
is IMHO an essential capability in Un*x-style compressors.  I think it's better
to emulate it poorly via /tmp hacks, than not having it at all.  For example,
tar expects compressor programs to support streaming, so if we want to patch it
to do something like this:

  $ tar -cIf foo.tar.7z bar

we'll need that.  (In fact, this is what I had in mind when writing this
script).

In case p7zip supports streaming properly later on (either by bumping the format
version to 0.3 or not), we can get rid of the script, or modify it to something
that just provides a gzip-like CLI interface that tar would work with.

(please note, in the above example I'm referring to gnu tar.  I don't know which
tar implementation is used in FreeBSD, but the same would apply, I think)

> Index: files/p7zip
> @@ -0,0 +1,74 @@
> +#!/bin/sh
> +# gzip-like CLI wrapper for p7zip
> +set -e

Btw, I would verify that the script works on FreeBSD.  In particular, I'd check
the `mktemp' and `which' commands are present and work the same way.  As for
shell, it needs bourne.  I don't recall using any bashisms but I'm not 1:1 sure.

-- 
Robert Millan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051019102706.GA28521>