New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potentially patching wrong files during recovery #1338
Comments
@schlomo # sed -i bails on symlinks, so we follow the symlink and patch the result # on dead links we warn and skip them # TODO: maybe we must put this into a chroot so that absolute symlinks will work correctly if test -L "$file" ; then if linkdest="$(readlink -f "$file")" ; then # if link destination is residing on /proc we skip it silently echo $linkdest | grep -q "^/proc" && continue LogPrint "Patching '$linkdest' instead of '$file'" file="$linkdest" else LogPrint "Not patching dead link '$file'" continue fi fi in each of the |
Interestingly there is another 'finalize' script for network_file in $TARGET_FS_ROOT/etc/sysconfig/*/ifcfg-*${new_mac}* $TARGET_FS_ROOT/etc/sysconfig/*/ifcfg-*${dev}*; do ... sed -i -e "$SED_SCRIPT" "$network_file" |
On my SLES11 and SLES12 systems (I will not look at SLES10 ;-) --follow-symlinks follow symlinks when processing in place -i[SUFFIX], --in-place[=SUFFIX] edit files in place (makes backup if SUFFIX supplied) so that "sed --follow-symlinks -i file_or_symlink" should "just work" # echo old >foo # ln -s foo slfoo # ls -l *foo -rw-r--r-- 1 root root 4 May 16 11:12 foo lrwxrwxrwx 1 root root 3 May 16 11:12 slfoo -> foo # sed --follow-symlinks -i -e 's/old/new/' slfoo # echo $? 0 e205:~ # cat foo new BUT hooray!:-( the same "just fails" on my SLES11 system with # ls -l *foo -rw-r--r-- 1 root root 4 May 16 11:15 foo lrwxrwxrwx 1 root root 3 May 16 11:09 slfoo -> foo # sed --follow-symlinks -i -e 's/old/new/' slfoo sed: ck_follow_symlink: couldn't lstat s/foo: No such file or directory # echo $? 4 WTH blabbers it about 's/foo'? |
When we implement request from issue #1638 this may fix this? |
I will have a look - as time permits. Offhandedly I think #1638 |
@jsmeix any update on this topic. It wouldn't hurt to move the milestone in my opinion as well if you do not have the time for it. It is not urgent at all. Thanks |
@gdha |
In #2055 |
…during_finalize_stage_issue1338 Skip patching absolute symlinks during finalize stage (except in 320_migrate_network_configuration_files.sh because that code it too obsure for me). That does not actually fix #1338 but for now it should at least avoid patching wrong files. Furthermore do no longer create udev rules in the recreated system that have not been there. This way one can avoid that ReaR creates udev rules that are created and maintained by systemd/udev like /etc/udev/rules.d/70-persistent-net.rules when one excludes such udev rules from being restored from the backup or by moving them away via BACKUP_RESTORE_MOVE_AWAY_FILES, cf. #2055 (comment) Finally moved 020_confirm_finalize.sh to 520_confirm_finalize.sh so that it is run after the finalize scripts that modify certain files because the whole idea behind 520_confirm_finalize.sh is that the user can finally adapt his restored files as he wants, cf. #2055 (comment)
Via #2055 Fixing this issue is not doable in the currently planned time until the |
Via If things work o.k. there I think the |
Stale issue message |
because somebody follows symlinks into the rescue system. I suppose that we should look into doing all sorts of file-based operations in the restored file space under
chroot
so that absolute symlinks will actually refer to the matching files in the restores file systems.The text was updated successfully, but these errors were encountered: