From f13f68288f45708ff12e0f6853def5910acd32c7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 20 Apr 2025 23:59:38 +0200 Subject: [PATCH] rpm2cpio: extract cpio even if compression is not known 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 --- 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)