mirror of
https://github.com/borgbackup/borg.git
synced 2025-01-30 19:21:17 +00:00
in --read-special mode, follow symlinks, fixes #1215
This commit is contained in:
parent
49feacfab1
commit
c3073bacbb
1 changed files with 9 additions and 1 deletions
|
@ -256,7 +256,15 @@ def _process(self, archive, cache, matcher, exclude_caches, exclude_if_present,
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
st = os.lstat(path)
|
# usually, do not follow symlinks (if we have a symlink, we want to
|
||||||
|
# backup it as such).
|
||||||
|
# but if we are in --read-special mode, we later process <path> as
|
||||||
|
# a regular file (we open and read the symlink target file's content).
|
||||||
|
# thus, in read_special mode, we also want to stat the symlink target
|
||||||
|
# file, for consistency. if we did not, we also have issues extracting
|
||||||
|
# this file, as it would be in the archive as a symlink, not as the
|
||||||
|
# target's file type (which could be e.g. a block device).
|
||||||
|
st = os.stat(path, follow_symlinks=read_special)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
self.print_warning('%s: %s', path, e)
|
self.print_warning('%s: %s', path, e)
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue