X-Git-Url: https://git.archive.openwrt.org/?p=openwrt.git;a=blobdiff_plain;f=package%2Futils%2Fbusybox%2Fpatches%2F007-upstream_zcat_no_ext_fix.patch;fp=package%2Futils%2Fbusybox%2Fpatches%2F007-upstream_zcat_no_ext_fix.patch;h=24838001ad9afefe88b1c0807be2fe4fc1d34aee;hp=0000000000000000000000000000000000000000;hb=f188f7f3607a3832dbfcbc89cb71186297f2550d;hpb=8430c3c485623b22af1676962edf2397c6c8297b diff --git a/package/utils/busybox/patches/007-upstream_zcat_no_ext_fix.patch b/package/utils/busybox/patches/007-upstream_zcat_no_ext_fix.patch new file mode 100644 index 0000000000..24838001ad --- /dev/null +++ b/package/utils/busybox/patches/007-upstream_zcat_no_ext_fix.patch @@ -0,0 +1,59 @@ +From 28dd64a0e1a9cffcde7799f2849b66c0e16bb9cc Mon Sep 17 00:00:00 2001 +From: Denys Vlasenko +Date: Fri, 10 Jan 2014 14:06:57 +0100 +Subject: [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. + +Signed-off-by: Denys Vlasenko +(cherry picked from commit 7c47b560a8fc97956dd8132bd7f1863d83c19866) +Signed-off-by: Mike Frysinger +--- + archival/libarchive/open_transformer.c | 23 +++++++++++------------ + 1 file changed, 11 insertions(+), 12 deletions(-) + +--- a/archival/libarchive/open_transformer.c ++++ b/archival/libarchive/open_transformer.c +@@ -182,27 +182,26 @@ int FAST_FUNC setup_unzip_on_fd(int fd, + + int FAST_FUNC open_zipped(const char *fname) + { +- char *sfx; + int fd; + + fd = open(fname, O_RDONLY); + if (fd < 0) + return fd; + +- 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 */ ++ char *sfx = strrchr(fname, '.'); ++ if (sfx && strcmp(sfx+1, "lzma") == 0) { + open_transformer_with_sig(fd, unpack_lzma_stream, "unlzma"); +- 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); ++ return fd; + } + } ++ 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; + }