mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 01:41:57 -04:00
create: add exception handler for NODUMP excluded dirs, fixes #9032
This commit is contained in:
parent
b27dba670c
commit
b2798ecd3a
2 changed files with 10 additions and 9 deletions
|
|
@ -510,7 +510,13 @@ class CreateMixIn:
|
|||
return
|
||||
if not recurse_excluded_dir:
|
||||
if not dry_run:
|
||||
status = fso.process_dir_with_fd(path=path, fd=child_fd, st=st, strip_prefix=strip_prefix)
|
||||
try:
|
||||
status = fso.process_dir_with_fd(
|
||||
path=path, fd=child_fd, st=st, strip_prefix=strip_prefix
|
||||
)
|
||||
except BackupItemExcluded:
|
||||
status = "-" # excluded (dir)
|
||||
recurse = False
|
||||
else:
|
||||
status = "+" # included (dir)
|
||||
if recurse:
|
||||
|
|
|
|||
|
|
@ -1073,14 +1073,9 @@ def test_exclude_nodump_dir_with_file(archivers, request):
|
|||
if not has_lchflags:
|
||||
pytest.skip("platform does not support setting UF_NODUMP")
|
||||
|
||||
# Prepare input tree: input/nd (NODUMP) containing a file.
|
||||
ndir = os.path.join(archiver.input_path, "nd")
|
||||
os.mkdir(ndir)
|
||||
with open(os.path.join(ndir, "file_in_ndir"), "wb") as f:
|
||||
f.write(b"hello")
|
||||
|
||||
# Set NODUMP flag on the directory (Linux: chattr +d, BSD: chflags nodump)
|
||||
platform.set_flags(ndir, stat.UF_NODUMP)
|
||||
# Prepare input tree: input/nd directory (NODUMP) containing a file.
|
||||
create_regular_file(archiver.input_path, "nd/file_in_ndir", contents=b"hello")
|
||||
platform.set_flags(os.path.join(archiver.input_path, "nd"), stat.UF_NODUMP)
|
||||
|
||||
# Create repo and archive
|
||||
cmd(archiver, "repo-create", RK_ENCRYPTION)
|
||||
|
|
|
|||
Loading…
Reference in a new issue