New upstream development version 5.3.3

This commit is contained in:
Richard W.M. Jones 2022-10-18 14:48:32 +01:00
parent c0e4947ad7
commit 444d564619
14 changed files with 7 additions and 478 deletions

View File

@ -1,44 +0,0 @@
From 8effa5a686037ba3c2f8c97753f398b73cc54881 Mon Sep 17 00:00:00 2001
From: George Prekas <prekgeo@yahoo.com>
Date: Wed, 6 Apr 2022 16:15:15 -0500
Subject: [PATCH 01/12] Fix for missing /lib/modules.
Even when supplied with $SUPERMIN_MODULES, supermin tries to access
/lib/modules. This directory does not exist by default in all the
environments.
---
src/format_ext2.ml | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/format_ext2.ml b/src/format_ext2.ml
index e311ea6..484b469 100644
--- a/src/format_ext2.ml
+++ b/src/format_ext2.ml
@@ -95,8 +95,22 @@ let build_ext2 debug basedir files modpath kernel_version appliance size
printf "supermin: ext2: copying kernel modules\n%!";
(* Import the kernel modules. *)
- ext2fs_copy_file_from_host fs "/lib" "/lib";
- ext2fs_copy_file_from_host fs "/lib/modules" "/lib/modules";
+ (try
+ ext2fs_copy_file_from_host fs "/lib" "/lib"
+ with Unix_error _ ->
+ (* If /lib doesn't exist on the host, create /lib directory
+ * in the image, populating it with mode etc from host /
+ *)
+ ext2fs_copy_file_from_host fs "/" "/lib"
+ );
+
+ (try
+ ext2fs_copy_file_from_host fs "/lib/modules" "/lib/modules"
+ with Unix_error _ ->
+ (* As above, if /lib/modules does not exist on the host. *)
+ ext2fs_copy_file_from_host fs "/" "/lib/modules"
+ );
+
ext2fs_copy_dir_recursively_from_host fs
modpath ("/lib/modules/" ^ kernel_version);
--
2.37.3

View File

@ -1,24 +0,0 @@
From e5cd10fc0952da1c51eb7b762fe19d54b2ec1e8d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 29 Apr 2022 15:24:17 +0100
Subject: [PATCH 02/12] pacman: Recognise Artix, an Arch derivative
---
src/ph_pacman.ml | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/ph_pacman.ml b/src/ph_pacman.ml
index 376b14b..4a1c669 100644
--- a/src/ph_pacman.ml
+++ b/src/ph_pacman.ml
@@ -26,6 +26,7 @@ open Package_handler
let pacman_detect () =
Config.pacman <> "no" && Config.fakeroot <> "no" &&
(Os_release.get_id () = "arch" ||
+ Os_release.get_id () = "artix" ||
((stat "/etc/arch-release").st_kind = S_REG &&
Config.pacman_g2 = "no")) (* not Frugalware with pacman-g2 *)
--
2.37.3

View File

@ -1,31 +0,0 @@
From c9ddb9648b3b810aa50fc238edb5fe55df9643b6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 29 Apr 2022 15:24:41 +0100
Subject: [PATCH 03/12] pacman: Fix database mtime detection
There is no "core.db" file on Artix, it may exist on Arch. However
a better way to detect this is to check the mtime of the containing
directory.
---
src/ph_pacman.ml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/ph_pacman.ml b/src/ph_pacman.ml
index 4a1c669..d9ecb29 100644
--- a/src/ph_pacman.ml
+++ b/src/ph_pacman.ml
@@ -129,7 +129,10 @@ let pacman_package_name pkg =
pac.name
let pacman_get_package_database_mtime () =
- (lstat "/var/lib/pacman/sync/core.db" (* XXX? *) ).st_mtime
+ (* This directory changes mtime when packages get installed/reinstalled.
+ * The directory itself contains several *.db files with different names.
+ *)
+ (lstat "/var/lib/pacman/sync/").st_mtime
let pacman_get_all_requires pkgs =
let cmd = sprintf "\
--
2.37.3

View File

@ -1,31 +0,0 @@
From b47d2f1fe29557874409295c55971c91379fa756 Mon Sep 17 00:00:00 2001
From: mahailiang <mahailiang@uniontech.com>
Date: Fri, 19 Aug 2022 15:41:24 +0800
Subject: [PATCH 04/12] fix cannot detect package manager on anolis
---
src/ph_rpm.ml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
index 549bd9a..f1ea299 100644
--- a/src/ph_rpm.ml
+++ b/src/ph_rpm.ml
@@ -32,11 +32,12 @@ let stringset_of_list pkgs =
let fedora_detect () =
Config.rpm <> "no" && Config.rpm2cpio <> "no" && rpm_is_available () &&
(Config.yumdownloader <> "no" || Config.dnf <> "no") &&
- (List.mem (Os_release.get_id ()) [ "fedora"; "rhel"; "centos"; "openEuler" ] ||
+ (List.mem (Os_release.get_id ()) [ "fedora"; "rhel"; "centos"; "openEuler"; "anolis" ] ||
try
(stat "/etc/redhat-release").st_kind = S_REG ||
(stat "/etc/fedora-release").st_kind = S_REG ||
- (stat "/etc/openEuler-release").st_kind = S_REG
+ (stat "/etc/openEuler-release").st_kind = S_REG ||
+ (stat "/etc/anolis-release").st_kind = S_REG
with Unix_error _ -> false)
let opensuse_detect () =
--
2.37.3

View File

@ -1,29 +0,0 @@
From c89146030ffd0ffdf921917111b88d3b32c5b2b8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 2 Sep 2022 12:01:36 +0100
Subject: [PATCH 05/12] init: Ignore warnings about unchecked return values
---
init/init.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/init/init.c b/init/init.c
index 60e099e..bc28c69 100644
--- a/init/init.c
+++ b/init/init.c
@@ -49,6 +49,12 @@
/* else it's in sys/types.h, included above */
#endif
+/* We make several calls to asprintf, chdir, fgets and ignore the
+ * result. Since this is a minimal init system there's nothing we can
+ * do if these calls fail.
+ */
+#pragma GCC diagnostic ignored "-Wunused-result"
+
/* Maximum time to wait for the root device to appear (seconds).
*
* On slow machines with lots of disks (Koji running the 255 disk test
--
2.37.3

View File

@ -1,28 +0,0 @@
From 4363354763fe858973af287058d0fa2efe90cdd0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 2 Sep 2022 12:01:50 +0100
Subject: [PATCH 06/12] ocaml: Use non-deprecated warning format
Alert ocaml_deprecated_cli: Setting a warning with a sequence of lowercase or uppercase letters,
like 'CDEFLMPSUVXYZ', is deprecated.
Use the equivalent signed form: +C+D+E+F+L+M+P+S+U+V+X+Y+Z-3.
---
src/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index c54b63e..0fcc3ad 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -127,7 +127,7 @@ BOBJECTS = $(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(SOURCES_ML:.ml=.cmx)
OCAMLPACKAGES = -package unix,str
-OCAMLFLAGS = -warn-error CDEFLMPSUVXYZ-3
+OCAMLFLAGS = -warn-error +C+D+E+F+L+M+P+S+U+V+X+Y+Z-3
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
--
2.37.3

View File

@ -1,61 +0,0 @@
From 63b515b375ebf2dbcc7b0b53f2031c3aa63ac8dc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 2 Sep 2022 12:03:29 +0100
Subject: [PATCH 07/12] src: Fix warnings about parsing ints from strings
Warnings of the form:
90 | Failure "int_of_string" ->
^^^^^^^^^^^^^^^
Warning 52 [fragile-literal-pattern]: Code should not depend on the
actual values of this constructor's arguments. They are only for
information and may change in future versions. (See manual section
11.5)
---
src/ph_pacman.ml | 2 +-
src/ph_rpm.ml | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/ph_pacman.ml b/src/ph_pacman.ml
index d9ecb29..44445a6 100644
--- a/src/ph_pacman.ml
+++ b/src/ph_pacman.ml
@@ -87,7 +87,7 @@ let pacman_package_of_string str =
| _ -> assert false in
epoch, version, release
with
- Failure "int_of_string" ->
+ Failure _ ->
failwith ("failed to parse epoch:version-release field " ^ evr) in
{ name = name;
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
index f1ea299..85557fe 100644
--- a/src/ph_rpm.ml
+++ b/src/ph_rpm.ml
@@ -89,7 +89,7 @@ let rec rpm_init s =
| [x] -> error "unable to parse rpm version string: %s" x
| major :: minor :: _ ->
try int_of_string major, int_of_string minor
- with Failure "int_of_string" ->
+ with Failure _ ->
error "unable to parse rpm version string: non-numeric, %s" version in
rpm_major := major;
rpm_minor := minor;
@@ -120,11 +120,11 @@ and opensuse_init s =
| [x] -> error "unable to parse output of zypper --version: %s" x
| major :: minor :: [] ->
(try int_of_string major, int_of_string minor, 0
- with Failure "int_of_string" ->
+ with Failure _ ->
error "unable to parse output of zypper --version: non-numeric")
| major :: minor :: patch :: _ ->
(try int_of_string major, int_of_string minor, int_of_string patch
- with Failure "int_of_string" ->
+ with Failure _ ->
error "unable to parse output of zypper --version: non-numeric") in
zypper_major := major;
zypper_minor := minor;
--
2.37.3

View File

@ -1,28 +0,0 @@
From b202062325e92bce865ad48b1e6d9f29b01ade6b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 2 Sep 2022 12:04:46 +0100
Subject: [PATCH 08/12] src/ph_pacman.ml: Use error function instead of
failwith
Slightly nicer output and a bit easier to use because it supports
printf-style formatting.
---
src/ph_pacman.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/ph_pacman.ml b/src/ph_pacman.ml
index 44445a6..25ef4fc 100644
--- a/src/ph_pacman.ml
+++ b/src/ph_pacman.ml
@@ -88,7 +88,7 @@ let pacman_package_of_string str =
epoch, version, release
with
Failure _ ->
- failwith ("failed to parse epoch:version-release field " ^ evr) in
+ error "failed to parse epoch:version-release field: %s " evr in
{ name = name;
epoch = epoch;
--
2.37.3

View File

@ -1,27 +0,0 @@
From 9b157474961b35e422704d32234d4ca5369acbe8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 2 Sep 2022 13:57:11 +0100
Subject: [PATCH 09/12] src/utils.ml: Fix more warnings about parsing ints from
strings
Updates: commit 63b515b375ebf2dbcc7b0b53f2031c3aa63ac8dc
---
src/utils.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/utils.ml b/src/utils.ml
index f5990ef..521d49e 100644
--- a/src/utils.ml
+++ b/src/utils.ml
@@ -162,7 +162,7 @@ and split_version = function
let rest = Str.matched_group 2 str in
let n =
try `Number (int_of_string n)
- with Failure "int_of_string" -> `String n in
+ with Failure _ -> `String n in
n, rest
)
else if Str.string_match rex_letters str 0 then
--
2.37.3

View File

@ -1,56 +0,0 @@
From e3cb3fb2c3e6c29d57db953099878813538281e6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 2 Sep 2022 15:47:00 +0100
Subject: [PATCH 10/12] src: Replace "noalloc" with [@@noalloc]
Avoids deprecation warnings like:
File "librpm.ml", line 19, characters 0-80:
Warning 3: deprecated: [@@noalloc] should be used instead of "noalloc"
I have checked that this still works with RHEL 7.
---
src/librpm-c.c | 2 ++
src/librpm.ml | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/librpm-c.c b/src/librpm-c.c
index ea32926..7b2b505 100644
--- a/src/librpm-c.c
+++ b/src/librpm-c.c
@@ -118,6 +118,7 @@ Val_librpm (struct librpm_data *data)
CAMLreturn (rpmv);
}
+/* NB: This is a [@@noalloc] call. */
value
supermin_rpm_is_available (value unit)
{
@@ -130,6 +131,7 @@ supermin_rpm_version (value unit)
return caml_copy_string (RPMVERSION);
}
+/* NB: This is a [@@noalloc] call. */
value
supermin_rpm_vercmp (value av, value bv)
{
diff --git a/src/librpm.ml b/src/librpm.ml
index c987e21..0a6c3f7 100644
--- a/src/librpm.ml
+++ b/src/librpm.ml
@@ -16,10 +16,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*)
-external rpm_is_available : unit -> bool = "supermin_rpm_is_available" "noalloc"
+external rpm_is_available : unit -> bool = "supermin_rpm_is_available" [@@noalloc]
external rpm_version : unit -> string = "supermin_rpm_version"
-external rpm_vercmp : string -> string -> int = "supermin_rpm_vercmp" "noalloc"
+external rpm_vercmp : string -> string -> int = "supermin_rpm_vercmp" [@@noalloc]
external rpm_get_arch : unit -> string = "supermin_rpm_get_arch"
type t
--
2.37.3

View File

@ -1,28 +0,0 @@
From 5d3d21b985b328317537e3d9a540840c5dade940 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 7 Sep 2022 16:12:12 +0100
Subject: [PATCH 11/12] src: Unconditionally enable -g flag
It's been possible to use -g with ocamlc for years now, and it's
always useful to compile with debugging enabled. In particular this
is necessary to display accurate backtraces.
---
src/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 0fcc3ad..5b07e5d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -127,7 +127,7 @@ BOBJECTS = $(SOURCES_ML:.ml=.cmo)
XOBJECTS = $(SOURCES_ML:.ml=.cmx)
OCAMLPACKAGES = -package unix,str
-OCAMLFLAGS = -warn-error +C+D+E+F+L+M+P+S+U+V+X+Y+Z-3
+OCAMLFLAGS = -g -warn-error +C+D+E+F+L+M+P+S+U+V+X+Y+Z-3
if !HAVE_OCAMLOPT
OBJECTS = $(BOBJECTS)
--
2.37.3

View File

@ -1,73 +0,0 @@
From ae7151cd943907a6044d9e1b82df87a2f805507b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 7 Sep 2022 16:02:47 +0100
Subject: [PATCH 12/12] src: Record and print global exception backtraces
We have a central place to catch global exceptions. Unfortunately the
act of doing that hides the exception if OCAMLRUNPARAM=b was set.
We almost always want to see where these exceptions are thrown so turn
on exception recording unconditionally and print them.
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2124571
---
src/supermin.ml | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/supermin.ml b/src/supermin.ml
index 9f838d9..659e857 100644
--- a/src/supermin.ml
+++ b/src/supermin.ml
@@ -1,5 +1,5 @@
(* supermin 5
- * Copyright (C) 2009-2014 Red Hat Inc.
+ * Copyright (C) 2009-2022 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -291,22 +291,32 @@ appliance automatically.
package_handler_shutdown ()
let () =
- try main ()
+ try
+ Printexc.record_backtrace true;
+ main ()
with
| Unix.Unix_error (code, fname, "") -> (* from a syscall *)
- error "error: %s: %s" fname (Unix.error_message code)
+ Printexc.print_backtrace Pervasives.stderr;
+ error "error: %s: %s" fname (Unix.error_message code)
| Unix.Unix_error (code, fname, param) -> (* from a syscall *)
- error "error: %s: %s: %s" fname (Unix.error_message code) param
+ Printexc.print_backtrace Pervasives.stderr;
+ error "error: %s: %s: %s" fname (Unix.error_message code) param
| Failure msg -> (* from failwith/failwithf *)
- error "failure: %s" msg
+ Printexc.print_backtrace Pervasives.stderr;
+ error "failure: %s" msg
| Librpm.Multiple_matches (package, count) -> (* from librpm *)
- error "RPM error: %d occurrences for %s" count package
+ Printexc.print_backtrace Pervasives.stderr;
+ error "RPM error: %d occurrences for %s" count package
| Invalid_argument msg -> (* probably should never happen *)
- error "internal error: invalid argument: %s" msg
+ Printexc.print_backtrace Pervasives.stderr;
+ error "internal error: invalid argument: %s" msg
| Assert_failure (file, line, char) -> (* should never happen *)
- error "internal error: assertion failed at %s, line %d, char %d"
- file line char
+ Printexc.print_backtrace Pervasives.stderr;
+ error "internal error: assertion failed at %s, line %d, char %d"
+ file line char
| Not_found -> (* should never happen *)
- error "internal error: Not_found exception was thrown"
+ Printexc.print_backtrace Pervasives.stderr;
+ error "internal error: Not_found exception was thrown"
| exn -> (* something not matched above *)
- error "exception: %s" (Printexc.to_string exn)
+ Printexc.print_backtrace Pervasives.stderr;
+ error "exception: %s" (Printexc.to_string exn)
--
2.37.3

View File

@ -1,2 +1,2 @@
SHA512 (supermin-5.3.2.tar.gz) = 501731e9cce8bf1f4743eeff4af620813d466da10b664df037575a546b3b8e8697ed9e881dde7d3ba737e6a78536717c1823e22cdc1c92409db78d976a6678b5
SHA512 (supermin-5.3.2.tar.gz.sig) = 5006481ab4c9a5ef5120654ac36fef3da634e03e0cacf4c27f44a5b37d7a906f3fdf911fde666a8f8dd08fce7e129399dbbb139d8e29c05a54dac9399ce31c9a
SHA512 (supermin-5.3.3.tar.gz) = 39eb687a4e6fbd13d356612f950352848626fe68a14054a62ac7fa1bb3b42be716189b1505bf137331974ea02d75e2e8079f412a133af165cba7767699925f38
SHA512 (supermin-5.3.3.tar.gz.sig) = e5109e718b06992bde73be913be49cd00358ec835566beb1f207109f54f73dbc6600275e929eb88fea42bda13643ec3ee9bb80032f8a05c37537f28bafb49fad

View File

@ -30,8 +30,8 @@
Summary: Tool for creating supermin appliances
Name: supermin
Version: 5.3.2
Release: 5%{?dist}
Version: 5.3.3
Release: 1%{?dist}
License: GPLv2+
ExclusiveArch: %{kernel_arches}
@ -46,20 +46,6 @@ Source1: http://download.libguestfs.org/supermin/%{source_directory}/%{nam
# Keyring used to verify tarball signature.
Source2: libguestfs.keyring
# All upstream patches since 5.3.2:
Patch: 0001-Fix-for-missing-lib-modules.patch
Patch: 0002-pacman-Recognise-Artix-an-Arch-derivative.patch
Patch: 0003-pacman-Fix-database-mtime-detection.patch
Patch: 0004-fix-cannot-detect-package-manager-on-anolis.patch
Patch: 0005-init-Ignore-warnings-about-unchecked-return-values.patch
Patch: 0006-ocaml-Use-non-deprecated-warning-format.patch
Patch: 0007-src-Fix-warnings-about-parsing-ints-from-strings.patch
Patch: 0008-src-ph_pacman.ml-Use-error-function-instead-of-failw.patch
Patch: 0009-src-utils.ml-Fix-more-warnings-about-parsing-ints-fr.patch
Patch: 0010-src-Replace-noalloc-with-noalloc.patch
Patch: 0011-src-Unconditionally-enable-g-flag.patch
Patch: 0012-src-Record-and-print-global-exception-backtraces.patch
BuildRequires: gcc
BuildRequires: make
BuildRequires: autoconf, automake
@ -201,6 +187,9 @@ make check || {
%changelog
* Tue Oct 18 2022 Richard W.M. Jones <rjones@redhat.com> - 5.3.3-1
- New upstream development version 5.3.3
* Wed Sep 07 2022 Richard W.M. Jones <rjones@redhat.com> - 5.3.2-5
- Include all upstream patches since 5.3.2
- Add debugging and accurate exception backtraces (RHBZ#2124571).