Rebase to Fedora Rawhide

resolves: rhbz#2135767
This commit is contained in:
Richard W.M. Jones 2022-10-18 14:52:21 +01:00
parent 0f74cdb01e
commit ed1524d043
6 changed files with 29 additions and 369 deletions

View File

@ -1,180 +0,0 @@
From 90251e796a14cd7ce77ad7f07fd1fbe5d3a43664 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 1 Feb 2021 10:07:02 +0000
Subject: [PATCH 1/4] Open Unix.LargeFile to avoid "lstat: Value too large for
defined data type".
On 32 bit platforms, because OCaml native ints are limited to 31 bits,
there is a trap in the normal Unix.stat, Unix.lstat functions where
any field in the stat struct may overflow. The result is random
errors like:
supermin: error: lstat: Value too large for defined data type: /tmp/tmp.Ss9aYEBASm/d2/root
You would probably only see this on armv7.
The OCaml Unix module has a "LargeFile" submodule which fixes this by
using int64 for some (unfortunately not all) fields.
For more information see the OCaml sources, file
otherlibs/unix/stat.c, all instances of "EOVERFLOW".
---
src/format_chroot.ml | 1 +
src/format_ext2.ml | 1 +
src/format_ext2_initrd.ml | 1 +
src/format_ext2_kernel.ml | 5 +++--
src/mode_build.ml | 1 +
src/package_handler.ml | 1 +
src/ph_dpkg.ml | 1 +
src/ph_pacman.ml | 1 +
src/ph_rpm.ml | 1 +
src/supermin.ml | 1 +
src/utils.ml | 1 +
11 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/format_chroot.ml b/src/format_chroot.ml
index 346c24b..34606f7 100644
--- a/src/format_chroot.ml
+++ b/src/format_chroot.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
diff --git a/src/format_ext2.ml b/src/format_ext2.ml
index 6348c29..e311ea6 100644
--- a/src/format_ext2.ml
+++ b/src/format_ext2.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
diff --git a/src/format_ext2_initrd.ml b/src/format_ext2_initrd.ml
index 38977e6..6268442 100644
--- a/src/format_ext2_initrd.ml
+++ b/src/format_ext2_initrd.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index 98bff3a..3be4413 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
@@ -95,8 +96,8 @@ and find_kernel_from_lib_modules debug =
let kernels =
filter_map (
fun kernel_file ->
- let size = try (stat kernel_file).st_size with Unix_error _ -> 0 in
- if size < 10000 then None
+ let size = try (stat kernel_file).st_size with Unix_error _ -> 0L in
+ if size < 10000_L then None
else (
let kernel_name = Filename.basename kernel_file in
let modpath = Filename.dirname kernel_file in
diff --git a/src/mode_build.ml b/src/mode_build.ml
index ed47366..ff7733e 100644
--- a/src/mode_build.ml
+++ b/src/mode_build.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
diff --git a/src/package_handler.ml b/src/package_handler.ml
index 0409438..f0d6db3 100644
--- a/src/package_handler.ml
+++ b/src/package_handler.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
diff --git a/src/ph_dpkg.ml b/src/ph_dpkg.ml
index 1e785de..6d4fce1 100644
--- a/src/ph_dpkg.ml
+++ b/src/ph_dpkg.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
diff --git a/src/ph_pacman.ml b/src/ph_pacman.ml
index 67f7512..50500a5 100644
--- a/src/ph_pacman.ml
+++ b/src/ph_pacman.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml
index 9745efd..183b5f3 100644
--- a/src/ph_rpm.ml
+++ b/src/ph_rpm.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Utils
diff --git a/src/supermin.ml b/src/supermin.ml
index e923111..9f838d9 100644
--- a/src/supermin.ml
+++ b/src/supermin.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
open Types
diff --git a/src/utils.ml b/src/utils.ml
index b25df88..f5990ef 100644
--- a/src/utils.ml
+++ b/src/utils.ml
@@ -17,6 +17,7 @@
*)
open Unix
+open Unix.LargeFile
open Printf
let (+^) = Int64.add
--
2.31.1

View File

@ -1,28 +0,0 @@
From 629069fb8c4101d21ec7883e2a137cb280fbe448 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 29 Nov 2021 14:40:15 +0000
Subject: [PATCH 2/4] Ignore zfcpdump kernel on s390x
Reported-by: Sebastian Mitterle
Thanks: Cornelia Huck
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2027375
---
src/format_ext2_kernel.ml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index 3be4413..ea69ade 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -157,6 +157,8 @@ and kernel_filter patterns is_arm all_files =
) all_files in
let files =
List.filter (fun filename -> find filename "xen" = -1) files in
+ let files =
+ List.filter (fun filename -> find filename "zfcpdump" = -1) files in
let files =
if not is_arm then files
else (
--
2.31.1

View File

@ -1,108 +0,0 @@
From 664ef10ae4fe0f6070f43f2cf1efd1a05d5514d9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 1 Dec 2021 10:28:36 +0000
Subject: [PATCH 3/4] Ignore unbootable kernels in /lib/modules
The previous commit didn't ignore zfcpdump kernels if found in
/lib/modules because we didn't apply the kernel filter to those paths.
Also this commit cleans up the code in general, splitting up the
multi-purpose "kernel_filter" function into two parts with clearer
roles.
Fixes: commit 9fbe476d4df0b01568d3668e6121cae7c779c8c7
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2027375
Reported-by: Yongkui Guo
---
src/format_ext2_kernel.ml | 44 +++++++++++++++++++++++----------------
1 file changed, 26 insertions(+), 18 deletions(-)
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index ea69ade..79d636b 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -38,7 +38,7 @@ let rec build_kernel debug host_cpu copy_kernel kernel =
| None ->
if debug >= 1 then
printf "supermin: kernel: looking for kernels in /lib/modules/*/vmlinuz ...\n%!";
- match find_kernel_from_lib_modules debug with
+ match find_kernel_from_lib_modules debug host_cpu with
| Some k -> k
| None ->
if debug >= 1 then
@@ -89,10 +89,13 @@ and find_kernel_from_env_vars debug =
Some (kernel_env, kernel_name, kernel_version, modpath)
with Not_found -> None
-and find_kernel_from_lib_modules debug =
+and find_kernel_from_lib_modules debug host_cpu =
+ let files = glob "/lib/modules/*/vmlinuz" [GLOB_NOSORT; GLOB_NOESCAPE] in
+ let files = Array.to_list files in
+
+ let files = ignore_unbootable_kernels host_cpu files in
+
let kernels =
- let files = glob "/lib/modules/*/vmlinuz" [GLOB_NOSORT; GLOB_NOESCAPE] in
- let files = Array.to_list files in
let kernels =
filter_map (
fun kernel_file ->
@@ -114,22 +117,22 @@ and find_kernel_from_lib_modules debug =
| [] -> None
and find_kernel_from_boot debug host_cpu =
- let is_arm =
- String.length host_cpu >= 3 &&
- host_cpu.[0] = 'a' && host_cpu.[1] = 'r' && host_cpu.[2] = 'm' in
-
let all_files = Sys.readdir "/boot" in
let all_files = Array.to_list all_files in
(* In original: ls -1dvr /boot/vmlinuz-*.$arch* 2>/dev/null | grep -v xen *)
let patterns = patt_of_cpu host_cpu in
- let files = kernel_filter patterns is_arm all_files in
+ let files = files_matching_globs patterns all_files in
+ let files = ignore_unbootable_kernels host_cpu files in
let files =
if files <> [] then files
- else
+ else (
(* In original: ls -1dvr /boot/vmlinuz-* 2>/dev/null | grep -v xen *)
- kernel_filter ["vmlinu?-*"] is_arm all_files in
+ let files = files_matching_globs ["vmlinu?-*"] all_files in
+ let files = ignore_unbootable_kernels host_cpu files in
+ files
+ ) in
let files = List.sort (fun a b -> compare_version b a) files in
let kernels =
@@ -148,13 +151,18 @@ and find_kernel_from_boot debug host_cpu =
| kernel :: _ -> Some kernel
| [] -> None
-and kernel_filter patterns is_arm all_files =
- let files =
- List.filter
- (fun filename ->
- List.exists
- (fun patt -> fnmatch patt filename [FNM_NOESCAPE]) patterns
- ) all_files in
+and files_matching_globs patterns files =
+ List.filter
+ (fun filename ->
+ List.exists
+ (fun patt -> fnmatch patt filename [FNM_NOESCAPE]) patterns
+ ) files
+
+and ignore_unbootable_kernels host_cpu files =
+ let is_arm =
+ String.length host_cpu >= 3 &&
+ host_cpu.[0] = 'a' && host_cpu.[1] = 'r' && host_cpu.[2] = 'm' in
+
let files =
List.filter (fun filename -> find filename "xen" = -1) files in
let files =
--
2.31.1

View File

@ -1,34 +0,0 @@
From 0b3ae5be86025f4902cb558f377e446baf49bc6d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 28 Feb 2022 16:54:33 -0500
Subject: [PATCH 4/4] Ignore debug kernels
On RHEL 8.2 with RT, these kernels are not bootable. The kernel in
that instance was called
/lib/modules/4.18.0-193.70.1.rt13.120.el8_2.x86_64+debug/vmlinuz
installed from the package
kernel-rt-debug-core-4.18.0-193.70.1.rt13.120.el8_2.x86_64
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2051332
(cherry picked from commit c44d685e662e001f5fe70f0a98d0964cb561e1ec)
(cherry picked from commit 7f91755424299fde5dec1af83c7c99b107a94a9d)
---
src/format_ext2_kernel.ml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/format_ext2_kernel.ml b/src/format_ext2_kernel.ml
index 79d636b..c592703 100644
--- a/src/format_ext2_kernel.ml
+++ b/src/format_ext2_kernel.ml
@@ -167,6 +167,8 @@ and ignore_unbootable_kernels host_cpu files =
List.filter (fun filename -> find filename "xen" = -1) files in
let files =
List.filter (fun filename -> find filename "zfcpdump" = -1) files in
+ let files =
+ List.filter (fun filename -> find filename "+debug" = -1) files in
let files =
if not is_arm then files
else (
--
2.31.1

View File

@ -1,2 +1,2 @@
SHA512 (supermin-5.2.1.tar.gz) = f10ea404e0b27238ea3c25cb68f44e716aa180a45a420e63c1958768032f0710e8e3e7f1346cda780ea1f916f499499da2c02df4019d91ea3b3a69b75cfda545 SHA512 (supermin-5.3.3.tar.gz) = 39eb687a4e6fbd13d356612f950352848626fe68a14054a62ac7fa1bb3b42be716189b1505bf137331974ea02d75e2e8079f412a133af165cba7767699925f38
SHA512 (supermin-5.2.1.tar.gz.sig) = bde7907ea61e8bb3e59fac235c7bd8e22ef2e16831b80344c4574fdff873a5fc8b8972716143ee9d9bd745ac99b72f11aa4530a8d184a3f287b3212ef85c7a13 SHA512 (supermin-5.3.3.tar.gz.sig) = e5109e718b06992bde73be913be49cd00358ec835566beb1f207109f54f73dbc6600275e929eb88fea42bda13643ec3ee9bb80032f8a05c37537f28bafb49fad

View File

@ -1,3 +1,5 @@
%undefine _package_note_flags
# On platforms and architectures that support it, the default is # On platforms and architectures that support it, the default is
# --with dietlibc. # --with dietlibc.
# #
@ -24,12 +26,12 @@
%global verify_tarball_signature 1 %global verify_tarball_signature 1
# The source directory. # The source directory.
%global source_directory 5.2-stable %global source_directory 5.3-development
Summary: Tool for creating supermin appliances Summary: Tool for creating supermin appliances
Name: supermin Name: supermin
Version: 5.2.1 Version: 5.3.3
Release: 8%{?dist} Release: 1%{?dist}
License: GPLv2+ License: GPLv2+
ExclusiveArch: %{kernel_arches} ExclusiveArch: %{kernel_arches}
@ -44,15 +46,9 @@ Source1: http://download.libguestfs.org/supermin/%{source_directory}/%{nam
# Keyring used to verify tarball signature. # Keyring used to verify tarball signature.
Source2: libguestfs.keyring Source2: libguestfs.keyring
# Patches are stored here: BuildRequires: gcc
# https://github.com/libguestfs/supermin/tree/rhel-9.1
Patch0001: 0001-Open-Unix.LargeFile-to-avoid-lstat-Value-too-large-f.patch
Patch0002: 0002-Ignore-zfcpdump-kernel-on-s390x.patch
Patch0003: 0003-Ignore-unbootable-kernels-in-lib-modules.patch
Patch0004: 0004-Ignore-debug-kernels.patch
BuildRequires: make BuildRequires: make
BuildRequires: autoconf, automake
BuildRequires: /usr/bin/pod2man BuildRequires: /usr/bin/pod2man
BuildRequires: /usr/bin/pod2html BuildRequires: /usr/bin/pod2html
BuildRequires: rpm BuildRequires: rpm
@ -92,19 +88,19 @@ BuildRequires: grubby
# https://bugzilla.redhat.com/show_bug.cgi?id=1331012 # https://bugzilla.redhat.com/show_bug.cgi?id=1331012
BuildRequires: systemd-udev BuildRequires: systemd-udev
# This only includes the dependencies needed at runtime, ie. supermin
# --build. For supermin --prepare, dependencies like dnf are placed
# in the -devel subpackage.
Requires: rpm Requires: rpm
Requires: dnf
Requires: dnf-plugins-core
Requires: util-linux-ng Requires: util-linux-ng
Requires: cpio Requires: cpio
Requires: tar Requires: tar
Requires: /usr/sbin/mke2fs Requires: /usr/sbin/mke2fs
# RHBZ#771310 # RHBZ#771310
Requires: e2fsprogs-libs >= 1.42 Requires: e2fsprogs-libs >= 1.42
Requires: findutils
# For automatic RPM dependency generation. # For automatic RPM dependency generation.
# See: http://www.rpm.org/wiki/PackagerDocs/DependencyGenerator # See: https://rpm-software-management.github.io/rpm/manual/dependency_generators.html
Source3: supermin.attr Source3: supermin.attr
Source4: supermin-find-requires Source4: supermin-find-requires
@ -115,18 +111,27 @@ appliances (similar to virtual machines), usually around 100KB in
size, which get fully instantiated on-the-fly in a fraction of a size, which get fully instantiated on-the-fly in a fraction of a
second when you need to boot one of them. second when you need to boot one of them.
Note that if you want to run 'supermin --prepare' you will need the
extra dependencies provided by %{name}-devel.
%package devel %package devel
Summary: Development tools for %{name} Summary: Development tools for %{name}
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires: rpm-build Requires: rpm-build
# Dependencies needed for supermin --prepare
Requires: dnf
Requires: dnf-plugins-core
Requires: findutils
%description devel %description devel
%{name}-devel contains development tools for %{name}. %{name}-devel contains development tools for %{name}.
It just contains tools for automatic RPM dependency generation It contains extra dependencies needed for 'supermin --prepare' to
from supermin appliances. work, as well as tools for automatic RPM dependency generation from
supermin appliances.
%prep %prep
@ -138,6 +143,7 @@ from supermin appliances.
%build %build
autoreconf -fi
%configure --disable-network-tests %configure --disable-network-tests
%if %{with dietlibc} %if %{with dietlibc}
@ -181,6 +187,10 @@ make check || {
%changelog %changelog
* Tue Oct 18 2022 Richard W.M. Jones <rjones@redhat.com> - 5.3.3-1
- Rebase to Fedora Rawhide
resolves: rhbz#2135767
* Tue Mar 15 2022 Richard W.M. Jones <rjones@redhat.com> - 5.2.1-8 * Tue Mar 15 2022 Richard W.M. Jones <rjones@redhat.com> - 5.2.1-8
- Fix ignore +debug kernels when choosing a kernel to boot - Fix ignore +debug kernels when choosing a kernel to boot
resolves: rhbz#2059397 resolves: rhbz#2059397