Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions qubes/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,9 +455,10 @@ def get_files_to_backup(self):
home_dir = pwd.getpwnam(local_user).pw_dir

# Checking if target is not user home directory in dom0
if self.target_dir in ["", "~"] or Path(
self.target_dir
).is_relative_to(home_dir):
if self.target_vm == self.app.domains[0] and (
self.target_dir in ["", "~"]
or Path(self.target_dir).is_relative_to(home_dir)
):
raise qubes.exc.QubesException(
"Can not backup dom0 home directory to itself!"
)
Expand Down
6 changes: 5 additions & 1 deletion qubes/tests/integ/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,11 +584,15 @@ def test_101_backup_dom0_to_dom0_home(self):
home_dir = pwd.getpwnam(local_user).pw_dir
with self.assertRaises(qubes.exc.QubesException):
self.make_backup(
[self.app.domains[0]], target=home_dir, expect_failure=True
[self.app.domains[0]],
target_vm=self.app.domains[0],
target=home_dir,
expect_failure=True,
)
with self.assertRaises(qubes.exc.QubesException):
self.make_backup(
[self.app.domains[0]],
target_vm=self.app.domains[0],
target=os.path.join(home_dir, "somedir"),
expect_failure=True,
)
Expand Down