diff --git a/Build-symbolic-links-correctly.patch b/Build-symbolic-links-correctly.patch new file mode 100644 index 0000000..5562198 --- /dev/null +++ b/Build-symbolic-links-correctly.patch @@ -0,0 +1,55 @@ +From 487e8c964078f823646d3b0584745ab7d0ef99ca Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 26 Nov 2019 09:01:21 +0000 +Subject: [PATCH] ext2: Build symbolic links correctly (RHBZ#1770304). + +We created symlinks in two steps, by creating the empty inode and then +calling ext2fs_symlink to populate it. This created broken symlinks +where the directory name contained a / character, eg: + +lrwxrwxrwx 1 root root 7 Nov 26 08:43 /bin -> usr/bin +lrwxrwxrwx 1 root root 7 Nov 26 08:43 /lib -> usr/lib +lrwxrwxrwx 1 root root 9 Nov 26 08:43 /lib64 -> usr/lib64 +lrwxrwxrwx 1 root root 8 Nov 26 08:43 /sbin -> usr/sbin +lrwxrwxrwx 1 root root 7 Nov 26 08:38 bin -> usr/bin + +This breaks with Linux >= 5.3.8, most likely because of extra +validation now being done at the VFS layer: + +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/fs/readdir.c?id=8a23eb804ca4f2be909e372cf5a9e7b30ae476cd + +It's unnecessary to create the empty inode since ext2fs_symlink can +create the inode for us perfectly fine if we simply pass ino == 0, and +it creates them correctly too. + +Thanks: Toolybird for identifying the problem and kernel patch. +--- + src/ext2fs-c.c | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c +index e8ab972..8903f74 100644 +--- a/src/ext2fs-c.c ++++ b/src/ext2fs-c.c +@@ -782,12 +782,6 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest) + } + /* Create a symlink. */ + else if (S_ISLNK (statbuf.st_mode)) { +- ext2_ino_t ino; +- ext2_empty_inode (data->fs, dir_ino, dirname, basename, +- statbuf.st_mode, statbuf.st_uid, statbuf.st_gid, +- statbuf.st_ctime, statbuf.st_atime, statbuf.st_mtime, +- 0, 0, EXT2_FT_SYMLINK, &ino); +- + char *buf = malloc (statbuf.st_size+1); + if (buf == NULL) + caml_raise_out_of_memory (); +@@ -797,7 +791,7 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest) + if (r > statbuf.st_size) + r = statbuf.st_size; + buf[r] = '\0'; +- ext2fs_symlink (data->fs, dir_ino, ino, dest, buf); ++ ext2fs_symlink (data->fs, dir_ino, 0, basename, buf); + free (buf); + } + /* Create directory. */ diff --git a/Expand-directory-when-adding-symlinks.patch b/Expand-directory-when-adding-symlinks.patch new file mode 100644 index 0000000..1eb6edc --- /dev/null +++ b/Expand-directory-when-adding-symlinks.patch @@ -0,0 +1,38 @@ +From 62d5c774d6c8fcac11e28fcba99754b5478e5088 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 10 Dec 2019 18:43:00 +0000 +Subject: [PATCH] ext2: Expand directory when adding symlinks (RHBZ#1770304). + +This produced very weird bugs with missing symlinks under +certain conditions, see: +https://bugzilla.redhat.com/show_bug.cgi?id=1781803 + +Fixes commit 487e8c964078f823646d3b0584745ab7d0ef99ca. +--- + src/ext2fs-c.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/ext2fs-c.c b/src/ext2fs-c.c +index 8903f74..0000865 100644 +--- a/src/ext2fs-c.c ++++ b/src/ext2fs-c.c +@@ -791,7 +791,18 @@ ext2_copy_file (struct ext2_data *data, const char *src, const char *dest) + if (r > statbuf.st_size) + r = statbuf.st_size; + buf[r] = '\0'; +- ext2fs_symlink (data->fs, dir_ino, 0, basename, buf); ++ symlink_again: ++ err = ext2fs_symlink (data->fs, dir_ino, 0, basename, buf); ++ if (err) { ++ if (err == EXT2_ET_DIR_NO_SPACE) { ++ err = ext2fs_expand_dir (data->fs, dir_ino); ++ if (err) ++ ext2_error_to_exception ("ext2fs_expand_dir", err, dirname); ++ goto symlink_again; ++ } ++ else ++ ext2_error_to_exception ("ext2fs_symlink", err, basename); ++ } + free (buf); + } + /* Create directory. */ diff --git a/fix-cannot-detect-package-manager-on-hce.patch b/fix-cannot-detect-package-manager-on-hce.patch new file mode 100644 index 0000000..5a5e582 --- /dev/null +++ b/fix-cannot-detect-package-manager-on-hce.patch @@ -0,0 +1,20 @@ +diff --git a/src/ph_rpm.ml b/src/ph_rpm.ml +index 61537ce..8260396 100644 +--- a/src/ph_rpm.ml ++++ b/src/ph_rpm.ml +@@ -31,11 +31,13 @@ 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"; "hce"; "euleros" ] || + 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/euleros-release").st_kind = S_REG || ++ (stat "/etc/hce-release").st_kind = S_REG + with Unix_error _ -> false) + + let opensuse_detect () = diff --git a/supermin.spec b/supermin.spec index 184f911..bb3ffc5 100644 --- a/supermin.spec +++ b/supermin.spec @@ -2,7 +2,7 @@ Name: supermin Version: 5.1.19 -Release: 13 +Release: 16 Summary: A tool for building supermin appliances, required by libguestfs License: GPLv2+ URL: http://libguestfs.org/ @@ -11,10 +11,13 @@ Source1: supermin.attr Source2: supermin-find-requires Patch0001: 0001-Fix-Bytes-String-for-OCaml-4.06.patch Patch0002: 0002-use-installed-packages-instead-of-dnf-downloading.patch +Patch0003: Build-symbolic-links-correctly.patch +Patch0004: Expand-directory-when-adding-symlinks.patch Patch9000: 9000-fix-cannot-detect-package-manager.patch Patch9001: add-pie-and-bind_now-flags.patch +Patch9002: fix-cannot-detect-package-manager-on-hce.patch BuildRequires: augeas dietlibc-devel dnf dnf-plugins-core e2fsprogs-devel -BuildRequires: findutils gnupg2 grubby hivex kernel ocaml ocaml-findlib-devel +BuildRequires: findutils gnupg2 grubby hivex ocaml ocaml-findlib-devel BuildRequires: rpm rpm-devel systemd-udev tar BuildRequires: /usr/bin/pod2man /usr/bin/pod2html /usr/sbin/mke2fs Requires: cpio dnf dnf-plugins-core e2fsprogs-libs >= 1.42 findutils @@ -76,6 +79,15 @@ install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_rpmconfigdir}/ %{_mandir}/man1/* %changelog +* Tue Nov 15 2022 xu_ping - 5.1.19-16 +- fix cannot detect package manager on hce + +* Mon Nov 14 2022 xu_ping - 5.1.19-15 +- fix ext2: copying kernel modules error + +* Thu May 26 2022 Jun Yang - 5.1.19-14 +- Remove dependency of kernel package + * Fri Nov 18 2022 liyanan - 5.1.19-13 - Replace openEuler with vendor