diff --git a/rpm-4.14.3-rpm2archive-Don-t-print-usage.patch b/rpm-4.14.3-rpm2archive-Don-t-print-usage.patch new file mode 100644 index 0000000..ff9d1a3 --- /dev/null +++ b/rpm-4.14.3-rpm2archive-Don-t-print-usage.patch @@ -0,0 +1,29 @@ +From fe274b8f965582fdf97e6c46f90b9e7c124b0b8b Mon Sep 17 00:00:00 2001 +From: Florian Festi +Date: Fri, 16 Dec 2022 15:50:12 +0100 +Subject: [PATCH] rpm2archive: Don't print usage on no arguments + +given as we want to default to reading from stdin and writing to stdout in +that case. +--- + rpm2archive.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/rpm2archive.c b/rpm2archive.c +index 09da8d16b..53f047f58 100644 +--- a/rpm2archive.c ++++ b/rpm2archive.c +@@ -241,10 +241,6 @@ int main(int argc, const char *argv[]) + exit(EXIT_FAILURE); + } + } +- if (argc < 2 || poptGetNextOpt(optCon) == 0) { +- poptPrintUsage(optCon, stderr, 0); +- exit(EXIT_FAILURE); +- } + + rpmts ts = rpmtsCreate(); + rpmVSFlags vsflags = 0; +-- +2.38.1 + diff --git a/rpm-4.14.3-rpm2archive-parse-popt-options.patch b/rpm-4.14.3-rpm2archive-parse-popt-options.patch new file mode 100644 index 0000000..0170c35 --- /dev/null +++ b/rpm-4.14.3-rpm2archive-parse-popt-options.patch @@ -0,0 +1,36 @@ +From 8f416b275a365426b07c75adfc017e0b18a85450 Mon Sep 17 00:00:00 2001 +From: Florian Festi +Date: Fri, 16 Dec 2022 15:45:20 +0100 +Subject: [PATCH] rpm2archive: Properly parse popt options + +and issue an error message for unknown options. Before unknown options +could mess up the argument parsing leading to reading and writing from +stdin/stdout. + +Thanks to Eva Mrakova and the Red Hat QE team for spotting this! +--- + rpm2archive.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/rpm2archive.c b/rpm2archive.c +index de1a17d2b..09da8d16b 100644 +--- a/rpm2archive.c ++++ b/rpm2archive.c +@@ -233,6 +233,14 @@ int main(int argc, const char *argv[]) + + optCon = poptGetContext(NULL, argc, argv, optionsTable, 0); + poptSetOtherOptionHelp(optCon, "[OPTIONS]* "); ++ while ((rc = poptGetNextOpt(optCon)) != -1) { ++ if (rc < 0) { ++ fprintf(stderr, "%s: %s\n", ++ poptBadOption(optCon, POPT_BADOPTION_NOALIAS), ++ poptStrerror(rc)); ++ exit(EXIT_FAILURE); ++ } ++ } + if (argc < 2 || poptGetNextOpt(optCon) == 0) { + poptPrintUsage(optCon, stderr, 0); + exit(EXIT_FAILURE); +-- +2.38.1 + diff --git a/rpm.spec b/rpm.spec index b289cba..a003c9f 100644 --- a/rpm.spec +++ b/rpm.spec @@ -42,7 +42,7 @@ %global rpmver 4.16.1.3 #global snapver rc1 -%global rel 21.1 +%global rel 22.1 %global sover 9 %global srcver %{rpmver}%{?snapver:-%{snapver}} @@ -111,6 +111,8 @@ Patch119: rpm-4.18-libselinux-log.patch Patch120: rpm-4.16.1.3-rpm2archive-error-handling.patch Patch121: rpm-4.16.1.3-rpm2archive-nocompression.patch Patch122: rpm-4.16.1.3-Support-long-languages-names-for-QT.patch +Patch123: rpm-4.14.3-rpm2archive-parse-popt-options.patch +Patch124: rpm-4.14.3-rpm2archive-Don-t-print-usage.patch # These are not yet upstream Patch906: rpm-4.7.1-geode-i686.patch @@ -823,15 +825,18 @@ fi %{_datadir}/selinux/packages/rpm_hs.pp.bz2 %changelog +* Tue Dec 20 2022 Davide Cavalca - 4.16.1.3-22.1 +- Merge upstream changes for Hyperscale + +* Mon Dec 19 2022 Florian Festi - 4.16.1.3-22 +- Fix option handling in rpm2archive for #2150804 + * Wed Dec 07 2022 Davide Cavalca - 4.16.1.3-21.1 - Merge upstream changes for Hyperscale * Wed Nov 30 2022 Richard Phibel - 4.16.1.3-19.2 - Add deny list support and workaround for RPM CoW -* Sat Oct 29 2022 Richard Phibel - 4.16.1.3-19.1 -- Merge upstream changes for Hyperscale - * Fri Nov 18 2022 Yaakov Selkowitz - 4.16.1.3-21 - Support long language names for QT (#2144005)