From 3a2954bfcd983dca5839dc454301af655c6517d3 Mon Sep 17 00:00:00 2001 From: Pavel Cahyna Date: Wed, 24 Aug 2022 14:49:23 +0200 Subject: [PATCH] Avoid stderr message about irrelevant broken links Irrelevant symlinks are currently those that match */lib/modules/*/build and */lib/modules/*/source. These two are broken in the kernel-core package when installed without the devel packages and it does not cause any harm. Downstream-only patch, the upstream code has changed. Resolves: rhbz2119501 --- rear-bz2119501.patch | 39 +++++++++++++++++++++++++++++++++++++++ rear.spec | 1 + 2 files changed, 40 insertions(+) create mode 100644 rear-bz2119501.patch diff --git a/rear-bz2119501.patch b/rear-bz2119501.patch new file mode 100644 index 0000000..71b4d47 --- /dev/null +++ b/rear-bz2119501.patch @@ -0,0 +1,39 @@ +diff --git a/usr/share/rear/build/default/490_fix_broken_links.sh b/usr/share/rear/build/default/490_fix_broken_links.sh +index 5bace664..cf960be8 100644 +--- a/usr/share/rear/build/default/490_fix_broken_links.sh ++++ b/usr/share/rear/build/default/490_fix_broken_links.sh +@@ -7,6 +7,23 @@ + # see https://github.com/rear/rear/issues/1638 + # and https://github.com/rear/rear/pull/1734 + ++# Some broken symlinks are expected. The 'build' and 'source' symlinks in kernel modules point to kernel sources ++# and are broken untol one installs the kernel-debug-devel or kernel-devel packages (on Fedora) and even then ++# the targets are jot included in the rescue system by default. ++# Do not warn about those, it is just noise. ++local irrelevant_symlinks=( '*/lib/modules/*/build' '*/lib/modules/*/source' ) ++function symlink_is_irrelevant () { ++ for i in "${irrelevant_symlinks[@]}"; do ++ # do not quote $i, it is a glob pattern, matching will be performed by [[ ... == ... ]] ++ # quoting inside [[ ]] prevents pattern matching ++ if [[ "$1" == $i ]]; then ++ return 0 ++ fi ++ done ++ return 1 ++} ++ ++ + # FIXME: The following code fails if symlinks or their targets contain characters from IFS (e.g. blanks), + # cf. the same kind of comments in build/default/990_verify_rootfs.sh + # and layout/prepare/GNU/Linux/130_include_mount_subvolumes_code.sh +@@ -38,6 +55,10 @@ pushd $ROOTFS_DIR + local broken_symlink='' + local link_target='' + for broken_symlink in $broken_symlinks ; do ++ if symlink_is_irrelevant "$broken_symlink" ; then ++ DebugPrint "Ignoring irrelevant broken symlink $broken_symlink" ++ continue ++ fi + # For each broken symlink absolute path inside ROOTFS_DIR + # we call "readlink -e" in the original system to get its link target there. + # If in the original system there was a chain of symbolic links like diff --git a/rear.spec b/rear.spec index df51181..e1f797b 100644 --- a/rear.spec +++ b/rear.spec @@ -37,6 +37,7 @@ Patch46: rear-bz2096916.patch Patch47: rear-bz2096900.patch Patch48: rear-bz2111059.patch Patch49: rsync-output.patch +Patch50: rear-bz2119501.patch # rear contains only bash scripts plus documentation so that on first glance it could be "BuildArch: noarch" # but actually it is not "noarch" because it only works on those architectures that are explicitly supported.