Merge pull request #6027 from cuevavirus/1.1-maint

Workaround for volume shadow copy in WSL1
This commit is contained in:
TW 2021-11-12 13:39:25 +01:00 committed by GitHub
commit d622b16821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions

View file

@ -94,6 +94,11 @@ General:
Using this does not affect data safety, but might result in a more bursty
write to disk behaviour (not continuously streaming to disk).
retry_erofs
Retry opening a file without O_NOATIME if opening a file with O_NOATIME
caused EROFS. You will need this to make archives from volume shadow copies
in WSL1 (Windows Subsystem for Linux 1).
Some automatic "answerers" (if set, they automatically answer confirmation questions):
BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=no (or =yes)
For "Warning: Attempting to access a previously unknown unencrypted repository"

View file

@ -37,6 +37,7 @@ from .helpers import bin_to_hex
from .helpers import safe_ns
from .helpers import ellipsis_truncate, ProgressIndicatorPercent, log_multi
from .helpers import msgpack
from .helpers import workarounds
from .patterns import PathPrefixPattern, FnmatchPattern, IECommand
from .item import Item, ArchiveItem
from .platform import acl_get, acl_set, set_flags, get_flags, swidth, hostname
@ -1115,6 +1116,12 @@ Utilization of max. archive size: {csize_max:.0%}
raise
# Was this EPERM due to the O_NOATIME flag? Try again without it:
return os.open(path, flags_normal)
except OSError as exc:
# O_NOATIME causes EROFS when accessing a volume shadow copy in WSL1
if 'retry_erofs' in workarounds and exc.errno == errno.EROFS and flags_noatime != flags_normal:
return os.open(path, flags_normal)
else:
raise
def valid_msgpacked_dict(d, keys_serialized):