From d24f9edcaa1adce0672d44d17a3f46fe404e873e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 24 Jan 2019 14:43:22 +0000 Subject: [PATCH] Add upstream patches to diagnose possible F29 issue. --- ...xtend-the-Multiple_matches-exception.patch | 89 +++++++++++++++++++ ...t-Librpm.Multiple_matches-exceptions.patch | 27 ++++++ supermin.spec | 10 ++- 3 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 0001-rpm-extend-the-Multiple_matches-exception.patch create mode 100644 0002-Print-Librpm.Multiple_matches-exceptions.patch diff --git a/0001-rpm-extend-the-Multiple_matches-exception.patch b/0001-rpm-extend-the-Multiple_matches-exception.patch new file mode 100644 index 0000000..30a69bb --- /dev/null +++ b/0001-rpm-extend-the-Multiple_matches-exception.patch @@ -0,0 +1,89 @@ +From 42955541dc3aa8ae3361f3bd6eb0ae338f307545 Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Wed, 23 Jan 2019 12:22:19 +0100 +Subject: [PATCH 1/2] rpm: extend the Multiple_matches exception + +Add the package that raised the issue, so it can be used to provide +better diagnostic. +--- + src/librpm-c.c | 15 ++++++++++----- + src/librpm.ml | 4 ++-- + src/librpm.mli | 2 +- + 3 files changed, 13 insertions(+), 8 deletions(-) + +diff --git a/src/librpm-c.c b/src/librpm-c.c +index 3bd25a2..75ca4d7 100644 +--- a/src/librpm-c.c ++++ b/src/librpm-c.c +@@ -66,10 +66,15 @@ librpm_handle_closed (void) + } + + static void +-librpm_raise_multiple_matches (int occurrences) ++librpm_raise_multiple_matches (value pkgv, int occurrences) + { +- caml_raise_with_arg (*caml_named_value ("librpm_multiple_matches"), +- Val_int (occurrences)); ++ CAMLparam1 (pkgv); ++ ++ value args[] = { pkgv, Val_int (occurrences) }; ++ caml_raise_with_args (*caml_named_value ("librpm_multiple_matches"), ++ 2, args); ++ ++ CAMLnoreturn; + } + + #define Librpm_val(v) (*((struct librpm_data *)Data_custom_val(v))) +@@ -296,7 +301,7 @@ supermin_rpm_pkg_requires (value rpmv, value pkgv) + fflush (stdout); + } + if (count != 1) +- librpm_raise_multiple_matches (count); ++ librpm_raise_multiple_matches (pkgv, count); + + h = rpmdbNextIterator (iter); + assert (h != NULL); +@@ -413,7 +418,7 @@ supermin_rpm_pkg_filelist (value rpmv, value pkgv) + fflush (stdout); + } + if (count != 1) +- librpm_raise_multiple_matches (count); ++ librpm_raise_multiple_matches (pkgv, count); + + h = rpmdbNextIterator (iter); + assert (h != NULL); +diff --git a/src/librpm.ml b/src/librpm.ml +index 4eeba77..b6f9ff8 100644 +--- a/src/librpm.ml ++++ b/src/librpm.ml +@@ -23,7 +23,7 @@ external rpm_vercmp : string -> string -> int = "supermin_rpm_vercmp" "noalloc" + + type t + +-exception Multiple_matches of int ++exception Multiple_matches of string * int + + external rpm_open : ?debug:int -> t = "supermin_rpm_open" + external rpm_close : t -> unit = "supermin_rpm_close" +@@ -49,4 +49,4 @@ external rpm_pkg_whatprovides : t -> string -> string array = "supermin_rpm_pkg_ + external rpm_pkg_filelist : t -> string -> rpmfile_t array = "supermin_rpm_pkg_filelist" + + let () = +- Callback.register_exception "librpm_multiple_matches" (Multiple_matches 0) ++ Callback.register_exception "librpm_multiple_matches" (Multiple_matches ("", 0)) +diff --git a/src/librpm.mli b/src/librpm.mli +index 5229be6..53b4b2c 100644 +--- a/src/librpm.mli ++++ b/src/librpm.mli +@@ -31,7 +31,7 @@ val rpm_vercmp : string -> string -> int + type t + (** The librpm handle. *) + +-exception Multiple_matches of int ++exception Multiple_matches of string * int + + val rpm_open : ?debug:int -> t + (** Open the librpm (transaction set) handle. *) +-- +2.20.1 + diff --git a/0002-Print-Librpm.Multiple_matches-exceptions.patch b/0002-Print-Librpm.Multiple_matches-exceptions.patch new file mode 100644 index 0000000..f13620b --- /dev/null +++ b/0002-Print-Librpm.Multiple_matches-exceptions.patch @@ -0,0 +1,27 @@ +From 36878992ebdd08f0f9b37017f347f5eab18ce9ed Mon Sep 17 00:00:00 2001 +From: Pino Toscano +Date: Wed, 23 Jan 2019 12:23:02 +0100 +Subject: [PATCH 2/2] Print Librpm.Multiple_matches exceptions + +Print a better diagnostic for them, so it is more clear which package +is detected as present multiple times. +--- + src/supermin.ml | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/supermin.ml b/src/supermin.ml +index f9798f9..71d8b64 100644 +--- a/src/supermin.ml ++++ b/src/supermin.ml +@@ -298,6 +298,8 @@ let () = + error "error: %s: %s: %s" fname (Unix.error_message code) param + | Failure msg -> (* from failwith/failwithf *) + error "failure: %s" msg ++ | Librpm.Multiple_matches (package, count) -> (* from librpm *) ++ error "RPM error: %d occurrences for %s" count package + | Invalid_argument msg -> (* probably should never happen *) + error "internal error: invalid argument: %s" msg + | Assert_failure (file, line, char) -> (* should never happen *) +-- +2.20.1 + diff --git a/supermin.spec b/supermin.spec index fd80f75..5d6a39c 100644 --- a/supermin.spec +++ b/supermin.spec @@ -26,7 +26,7 @@ Summary: Tool for creating supermin appliances Name: supermin Version: 5.1.20 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ %if 0%{?rhel} >= 7 @@ -44,6 +44,11 @@ Source1: http://libguestfs.org/download/supermin/%{name}-%{version}.tar.gz Source2: libguestfs.keyring %endif +# Upstream patches to diagnose possible F29 issue: +# https://www.redhat.com/archives/libguestfs/2019-January/thread.html#00168 +Patch1: 0001-rpm-extend-the-Multiple_matches-exception.patch +Patch2: 0002-Print-Librpm.Multiple_matches-exceptions.patch + BuildRequires: /usr/bin/pod2man BuildRequires: /usr/bin/pod2html BuildRequires: rpm @@ -165,6 +170,9 @@ make check || { %changelog +* Thu Jan 24 2019 Richard W.M. Jones - 5.1.20-2 +- Add upstream patches to diagnose possible F29 issue. + * Thu Jan 17 2019 Richard W.M. Jones - 5.1.20-1 - New upstream version 5.1.20.