From ba3b908b73190e5603bdb92c6618466b5ef66dc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 7 Jan 2016 02:07:08 +0100 Subject: [PATCH] backup: do not dereference symlinks in dom0 user home backup Symlinks there should be preserved. Additionally broken symlink would cause the backup to fail. Fixes QubesOS/qubes-issues#1515 --- core/backup.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/backup.py b/core/backup.py index 597be233..7ba8808f 100644 --- a/core/backup.py +++ b/core/backup.py @@ -567,15 +567,16 @@ def backup_do(base_backup_dir, files_to_backup, passphrase, # be verified before untaring this. # Prefix the path in archive with filename["subdir"] to have it # verified during untar - tar_cmdline = ["tar", "-Pc", '--sparse', + tar_cmdline = (["tar", "-Pc", '--sparse', "-f", backup_pipe, - '-C', os.path.dirname(filename["path"]), - '--dereference', - '--xform', 's:^%s:%s\\0:' % ( + '-C', os.path.dirname(filename["path"])] + + (['--dereference'] if filename["subdir"] != "dom0-home/" + else []) + + ['--xform', 's:^%s:%s\\0:' % ( os.path.basename(filename["path"]), filename["subdir"]), os.path.basename(filename["path"]) - ] + ]) if compressed: tar_cmdline.insert(-1, "--use-compress-program=%s" % compression_filter)