Package: busybox / 1:1.22.0-9+deb8u1

libbb-open_zipped-should-not-fail-on-non-compressed-files.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
commit b664f740d90880560ce46b11f766625341342e80
Author: Denys Vlasenko <vda.linux@googlemail.com>
Date:   Mon Jan 27 13:02:18 2014 +0100

    libbb: open_zipped() should not fail on non-compressed files
    
    Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>

diff --git a/archival/libarchive/open_transformer.c b/archival/libarchive/open_transformer.c
index 1aeba13..27854af 100644
--- a/archival/libarchive/open_transformer.c
+++ b/archival/libarchive/open_transformer.c
@@ -200,7 +200,16 @@ int FAST_FUNC open_zipped(const char *fname)
 	 || (ENABLE_FEATURE_SEAMLESS_BZ2)
 	 || (ENABLE_FEATURE_SEAMLESS_XZ)
 	) {
-		setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 1);
+		/*
+		 * Do we want to fail_if_not_detected?
+		 * In most cases, no: think "insmod non_compressed_module".
+		 * A case which would like to fail is "zcat uncompressed_file":
+		 * otherwise, it happily outputs uncompressed_file as-is,
+		 * which is, strictly speaking, not what is expected.
+		 * If this ever becomes a problem, we can add
+		 * fail_if_not_detected bool argument to open_zipped().
+		 */
+		setup_unzip_on_fd(fd, /*fail_if_not_detected:*/ 0);
 	}
 
 	return fd;