[git commit] rpm2cpio: extract cpio even if compression is not known
Denys Vlasenko
vda.linux at googlemail.com
Sun Apr 20 21:59:38 UTC 2025
commit: https://git.busybox.net/busybox/commit/?id=f13f68288f45708ff12e0f6853def5910acd32c7
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master
This is more useful than failing outright.
function old new delta
rpm2cpio_main 110 144 +34
.rodata 105681 105715 +34
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 68/0) Total: 68 bytes
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
archival/rpm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/archival/rpm.c b/archival/rpm.c
index 7fd2a2b46..95a8c79b6 100644
--- a/archival/rpm.c
+++ b/archival/rpm.c
@@ -533,6 +533,7 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
// /* We need to know whether child (gzip/bzip/etc) exits abnormally */
// signal(SIGCHLD, check_errors_in_children);
+ str = NULL;
if (ENABLE_FEATURE_SEAMLESS_LZMA
&& (str = rpm_getstr0(TAG_PAYLOADCOMPRESSOR)) != NULL
&& strcmp(str, "lzma") == 0
@@ -541,7 +542,11 @@ int rpm2cpio_main(int argc UNUSED_PARAM, char **argv)
// set up decompressor without detection
setup_lzma_on_fd(rpm_fd);
} else {
- setup_unzip_on_fd(rpm_fd, /*die_if_not_compressed:*/ 1);
+ int signature_bytes = setup_unzip_on_fd(rpm_fd, /*die_if_not_compressed:*/ 0);
+ if (signature_bytes != 0) {
+ xlseek(rpm_fd, - signature_bytes, SEEK_CUR);
+ bb_error_msg("warning, unknown compression '%s'", str);
+ }
}
if (bb_copyfd_eof(rpm_fd, STDOUT_FILENO) < 0)
More information about the busybox-cvs
mailing list