zutils-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Zutils-bug] Decompressing any file


From: Axel Beckert
Subject: Re: [Zutils-bug] Decompressing any file
Date: Wed, 13 Mar 2013 14:13:37 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

Hi Antonio,

On Wed, Mar 13, 2013 at 01:02:31PM +0100, Antonio Diaz Diaz wrote:
> Axel Beckert wrote:
> >Count me in for compress'ed files, i.e. those with .Z suffix,
> >especially because gzip's zcat is able to do that. -- see my Debian
> >bug report above.
> 
> Compress'ed files are not suitable for zutils. The compress format
> is not even standardized[1]:
> 
> [1]http://pubs.opengroup.org/onlinepubs/9699919799/utilities/compress.html
> 
> "The format of compressed files is unspecified and interchange of
> such files between implementations (including access via unspecified
> file sharing mechanisms) is not required by POSIX.1-2008."

Oops. Didn't know that.

> Support for lzma-alone files is being removed from GNU programs. So
> I do not plan to include it in zutils.

Ok.

> >7zr supports stdin and stdout. From the 7zr man page:
> >[...]
> >Maybe the following is even more useful for zutils:
> >  /usr/bin/p7zip: a gzip like wrapper around 7zr.
> 
> I plan to implement a configuration file to let the user choose what
> decompressor use for each format (a parallel version of the
> decompressor, for example).

Wouldn't that give the user a chance to also let zutils support .Z
files if he has a working decompressor (like gzip's zcat).

> As soon as I find the time to implement it, I'll try to include
> support for 7z files with 7zr/p7zip.

Thanks!

> >And from the unzip man page:
> >
> >       -c     extract  files  to  stdout/screen (``CRT'').
> 
> Yes, but unzip does not support stdin.

Ah, I just checked for stdout, sorry.

Anyway, "zip" seems to support both, stdin and stdout:

       Streaming input and output.  zip will also accept a single dash
       ("-") as the zip file name, in which case it will write the zip
       file  to  standard
       output, allowing the output to be piped to another program. For example:

              zip -r - . | dd of=/dev/nrst0 obs=16k

       would write the zip output directly to a tape with the
       specified block size for the purpose of backing up the current
       directory.

       zip also accepts a single dash ("-") as the name of a file to
       be compressed, in which case it will read the file from
       standard input, allowing zip
       to take input from another program. For example:

              tar cf - . | zip backup -

       would compress the output of the tar command for the purpose of
       backing up the current directory. This generally produces
       better compression  than
       the previous example using the -r option because zip can take
       advantage of redundancy between files. The backup can be
       restored using the command

              unzip -p backup | tar xf -

       When no zip file name is given and stdout is not a terminal,
       zip acts as a filter, compressing standard input to standard
       output.  For example,

              tar cf - . | zip | dd of=/dev/nrst0 obs=16k

       is equivalent to

              tar cf - . | zip - - | dd of=/dev/nrst0 obs=16k

       zip  archives  created  in this manner can be extracted with
       the program funzip which is provided in the unzip package, or
       by gunzip which is pro‐
       vided in the gzip package (but some gunzip may not support this
       if zip used the Zip64 extensions). For example:

              dd if=/dev/nrst0  ibs=16k | funzip | tar xvf -

       The stream can also be saved to a file and unzip used.

(Taken from zip's man-page on Debian Squeeze.)

I'm though surprised that gunzip is said to be able to handle
zip archives. :-)

> Supporting zip files is incompatible with zutils' goal of
> decompressing on the fly without temporary files.

According to the above it should be possible with either zip, funzip
or gunzip instead of unzip.

                Kind regards, Axel
-- 
/~\  Plain Text Ribbon Campaign                   | Axel Beckert
\ /  Say No to HTML in E-Mail and News            | address@hidden  (Mail)
 X   See http://www.asciiribbon.org/              | address@hidden (Mail+Jabber)
/ \  I love long mails: http://email.is-not-s.ms/ | http://noone.org/abe/ (Web)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]