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
This commit is contained in:
Pavel Cahyna 2022-08-24 14:49:23 +02:00
parent 819338348a
commit 3a2954bfcd
2 changed files with 40 additions and 0 deletions

39
rear-bz2119501.patch Normal file
View File

@ -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

View File

@ -37,6 +37,7 @@ Patch46: rear-bz2096916.patch
Patch47: rear-bz2096900.patch Patch47: rear-bz2096900.patch
Patch48: rear-bz2111059.patch Patch48: rear-bz2111059.patch
Patch49: rsync-output.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" # 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. # but actually it is not "noarch" because it only works on those architectures that are explicitly supported.