1.22: zcat does not decompress data anymore [bisected]

Michael Tokarev mjt at tls.msk.ru
Tue Jan 28 09:01:11 UTC 2014


28.01.2014 12:48, Michael Tokarev пишет:
> Since this commit:
> 
> commit 41655438c6b61d05ddf3619f31abc1fa3583e2be
> Author: Denys Vlasenko <vda.linux at googlemail.com>
> Date:   Thu Feb 28 18:37:04 2013 +0100
> 
>     zcat: fix "zcat FILE" trying to do detection twice
> 
> busybox's zcat does not decompress files without .gz
> extension anymore:
> 
>  $ gzip < README > x
>  $ ./busybox zcat x | wc -c
> 
> -- before the above commit, it will uncompress the data fine,
> yelding the size of original README file (8763 bytes).  But
> after this commit, it emits compressed data (effectively just
> copies content of the input file), of size 3985 bytes.
> 
> 
> I was about to submit this as a bugreport, but took a look at
> the current git tree, and noticed that apparently, this issue
> has already been fixed by the following two commits:
> 
> commit	7c47b560a8fc97956dd8132bd7f1863d83c19866 (patch)
> libarchive: open_zipped() does not need to check extensions for e.g. gzip
> We only need to check for signature-less extensions, currently only .lzma. The rest can be happily autodetected. This fixes "zcat FILE_WITHOUT_GZ_EXT" case, among others.
> 
> commit	b664f740d90880560ce46b11f766625341342e80 (patch)
> busybox-b664f740d90880560ce46b11f766625341342e80.tar.bz2
> libbb: open_zipped() should not fail on non-compressed files
> 
> 
> So it looks like the two commits are good candidates for 1.21.

Note that with the above two patches, busybox zcat will happily
accept uncompressed input and will behave like plain cat, while
original zcat refuses to work on uncompressed data:

$ zcat README
gzip: README: not in gzip format
$ ./busybox zcat README | wc -l
204

For some, it might look like a bug.  I've seen scripts verifying
if the data is compressed by running zcat >/dev/null - arguable
those are also broken, but heck...

Note that for (uncompressed) data read from stdin, busybox actually
fails correctly, but does not produce any error message:

$ ./busybox zcat < README
$ echo $?
1

Thanks,

/mjt



More information about the busybox mailing list