#3414 Issue open
: Fix when 'find' results only dangling symlinks to needed libraries¶
Labels: enhancement
jsmeix opened issue at 2025-02-28 14:49:¶
In usr/share/rear/build/default/990_verify_rootfs.sh
avoid when 'find' results only a dangling symlink to a needed library
that then "rear mkrescue" proceeds "bona fide" cf.
https://github.com/rear/rear/wiki/Coding-Style#try-hard-to-care-about-possible-errors
Excerpts from
https://github.com/rear/rear/pull/3308#issuecomment-2328139914
when I have
rm $ROOTFS_DIR/usr/lib64/libparted.so.2.0.1
at the beginning of
usr/share/rear/build/default/990_verify_rootfs.sh
...
localhost:~/rear.github.master # usr/sbin/rear -D mkrescue
...
Testing each binary with 'ldd' for 'not found' libraries within the ReaR recovery system
bin/parted requires libraries where 'ldd' shows 'not found' (fatal by default)
bin/parted requires libparted.so.2 which exists as usr/lib64/libparted.so.2
bin/partprobe requires libraries where 'ldd' shows 'not found' (fatal by default)
bin/partprobe requires libparted.so.2 which exists as usr/lib64/libparted.so.2
...
Therein in particular this (and same for bin/partprobe)
bin/parted requires libraries where 'ldd' shows 'not found' (fatal by default)
bin/parted requires libparted.so.2 which exists as usr/lib64/libparted.so.2
shows that it is not sufficient when something
that is reported as 'not found' by 'ldd'
actually exists within the recovery system
to assume that then the associated program(s)
will actually work within the recovery system.
In this case only the symlink
/usr/lib64/libparted.so.2 exists
but its link target (i.e. the actual library)
does not exist so parted (and partprobe)
cannot run within the recovery system.
Offhanded proposal how to fix it:
In usr/share/rear/build/default/990_verify_rootfs.sh at
if actually_found_library="$( find "$ROOTFS_DIR" -xdev -printf '/%P\n' | grep "$not_found_library\$" )" ; then
# Show files from inside the recovery system to the user as relative path without leading slashes
# (extglob is set in usr/sbin/rear):
actually_found_library_relpath="${actually_found_library##+(/)}"
LogPrint "$binary_relpath requires $not_found_library_relpath which exists as $actually_found_library_relpath"
check that when actually_found_library is a symlink
also its symlink target exists in the recovery system.
This helps to be more on the safe side that things work
with what is found in the ReaR recovery system.
But this is no proof that things will actually work
with what was found in the ReaR recovery system
becaus in the ReaR recovery system there might be
a wrong library (with the right name) or a symlink
to a wrong library or whatever...
[Export of Github issue for rear/rear.]