On Fri, Jan 10, 2014 at 10:32 AM, Pascal Bellard
<[email protected]> wrote:
> With busybox 1.22.0 'zcat file' works only when file ends with gz.
> Bug or feature ?
It's a bug.
I'm applying the second part of your patch, after fixing it
(it runs strchr needlessly if !ENABLE_FEATURE_SEAMLESS_LZMA).
My change is:
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.
- sfx = strrchr(fname, '.');
- if (sfx) {
- sfx++;
- if (ENABLE_FEATURE_SEAMLESS_LZMA && strcmp(sfx, "lzma") == 0)
- /* .lzma has no header/signature, just trust it */
+ if (ENABLE_FEATURE_SEAMLESS_LZMA) {
+ /* .lzma has no header/signature, can only detect it
by extension */
+ sfx = strrchr(fname, '.');
+ if (sfx && strcmp(sfx+1, "lzma") == 0) {
open_transformer_with_sig(fd,
unpack_lzma_stream, "unlzma");
+ return fd;
- else
- if ((ENABLE_FEATURE_SEAMLESS_GZ && strcmp(sfx, "gz") == 0)
- || (ENABLE_FEATURE_SEAMLESS_BZ2 && strcmp(sfx, "bz2") == 0)
- || (ENABLE_FEATURE_SEAMLESS_XZ && strcmp(sfx, "xz") == 0)
- ) {
- setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
}
}
+ if ((ENABLE_FEATURE_SEAMLESS_GZ)
+ || (ENABLE_FEATURE_SEAMLESS_BZ2)
+ || (ENABLE_FEATURE_SEAMLESS_XZ)
+ ) {
+ setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
+ }
return fd;
}
Please try current git.
> Anyway
> http://hg.slitaz.org/wok/raw-file/9b20a58d7246/busybox/stuff/busybox-1.22-zmodules.u
> remove the gz check.
I have somewhat of a problem with the format of your patches, Pascal.
I would like to ask you to try to make at least some of the following
changes to future submissions:
Patches should have .patch or .diff extension.
People use syntax highlighting editors.
Some of those editors use file extensions for detection.
Patches should contain an explanation what changes
are doing. Not line-by-line annotations,
but overall description:
"Old code was doing this and this wrongly.
The patch changes code to do that and that instead".
For a concrete example, I do not understand whether
your patch adds LZMA detection for kernel .gz modules
as a hack you intend to use only locally,
or you propose this to be added for mainstream busybox.
I am not good at reading minds.
Patches should fix one bug or add one feature at the time.
Not two or seventeen.
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox