mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-22 14:11:27 +00:00
Merge pull request #6377 from ThomasWaldmann/fix-6374-master
create: skip with warning if opening the parent dir of recursion root fails, fixes #6374
This commit is contained in:
commit
47a9e4686b
1 changed files with 25 additions and 20 deletions
|
@ -590,26 +590,31 @@ def create_inner(archive, cache, fso):
|
||||||
path = os.path.normpath(path)
|
path = os.path.normpath(path)
|
||||||
parent_dir = os.path.dirname(path) or '.'
|
parent_dir = os.path.dirname(path) or '.'
|
||||||
name = os.path.basename(path)
|
name = os.path.basename(path)
|
||||||
# note: for path == '/': name == '' and parent_dir == '/'.
|
try:
|
||||||
# the empty name will trigger a fall-back to path-based processing in os_stat and os_open.
|
# note: for path == '/': name == '' and parent_dir == '/'.
|
||||||
with OsOpen(path=parent_dir, flags=flags_root, noatime=True, op='open_root') as parent_fd:
|
# the empty name will trigger a fall-back to path-based processing in os_stat and os_open.
|
||||||
try:
|
with OsOpen(path=parent_dir, flags=flags_root, noatime=True, op='open_root') as parent_fd:
|
||||||
st = os_stat(path=path, parent_fd=parent_fd, name=name, follow_symlinks=False)
|
try:
|
||||||
except OSError as e:
|
st = os_stat(path=path, parent_fd=parent_fd, name=name, follow_symlinks=False)
|
||||||
self.print_warning('%s: %s', path, e)
|
except OSError as e:
|
||||||
continue
|
self.print_warning('%s: %s', path, e)
|
||||||
if args.one_file_system:
|
continue
|
||||||
restrict_dev = st.st_dev
|
if args.one_file_system:
|
||||||
else:
|
restrict_dev = st.st_dev
|
||||||
restrict_dev = None
|
else:
|
||||||
self._rec_walk(path=path, parent_fd=parent_fd, name=name,
|
restrict_dev = None
|
||||||
fso=fso, cache=cache, matcher=matcher,
|
self._rec_walk(path=path, parent_fd=parent_fd, name=name,
|
||||||
exclude_caches=args.exclude_caches, exclude_if_present=args.exclude_if_present,
|
fso=fso, cache=cache, matcher=matcher,
|
||||||
keep_exclude_tags=args.keep_exclude_tags, skip_inodes=skip_inodes,
|
exclude_caches=args.exclude_caches, exclude_if_present=args.exclude_if_present,
|
||||||
restrict_dev=restrict_dev, read_special=args.read_special, dry_run=dry_run)
|
keep_exclude_tags=args.keep_exclude_tags, skip_inodes=skip_inodes,
|
||||||
# if we get back here, we've finished recursing into <path>,
|
restrict_dev=restrict_dev, read_special=args.read_special, dry_run=dry_run)
|
||||||
# we do not ever want to get back in there (even if path is given twice as recursion root)
|
# if we get back here, we've finished recursing into <path>,
|
||||||
skip_inodes.add((st.st_ino, st.st_dev))
|
# we do not ever want to get back in there (even if path is given twice as recursion root)
|
||||||
|
skip_inodes.add((st.st_ino, st.st_dev))
|
||||||
|
except (BackupOSError, BackupError) as e:
|
||||||
|
# this comes from OsOpen, self._rec_walk has own exception handler
|
||||||
|
self.print_warning('%s: %s', path, e)
|
||||||
|
continue
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
if args.progress:
|
if args.progress:
|
||||||
archive.stats.show_progress(final=True)
|
archive.stats.show_progress(final=True)
|
||||||
|
|
Loading…
Reference in a new issue