mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-01 12:09:10 +00:00
mount: create unique directory names, fixes #8461
This commit is contained in:
parent
91c0def38a
commit
84245ef2bf
2 changed files with 17 additions and 2 deletions
|
@ -39,7 +39,7 @@ def async_wrapper(fn):
|
|||
from .archiver._common import build_matcher, build_filter
|
||||
from .archive import Archive, get_item_uid_gid
|
||||
from .hashindex import FuseVersionsIndex
|
||||
from .helpers import daemonize, daemonizing, signal_handler, format_file_size
|
||||
from .helpers import daemonize, daemonizing, signal_handler, format_file_size, bin_to_hex
|
||||
from .helpers import HardLinkManager
|
||||
from .helpers import msgpack
|
||||
from .helpers.lrucache import LRUCache
|
||||
|
@ -284,7 +284,8 @@ def _create_filesystem(self):
|
|||
else:
|
||||
# lazily load archives, create archive placeholder inode
|
||||
archive_inode = self._create_dir(parent=1, mtime=int(archive.ts.timestamp() * 1e9))
|
||||
self.contents[1][os.fsencode(archive.name)] = archive_inode
|
||||
name = f"{archive.name}-{bin_to_hex(archive.id):.8}" # archive names may be duplicate!
|
||||
self.contents[1][os.fsencode(name)] = archive_inode
|
||||
self.pending_archives[archive_inode] = archive
|
||||
|
||||
def get_item(self, inode):
|
||||
|
|
|
@ -200,6 +200,20 @@ def test_fuse_versions_view(archivers, request):
|
|||
assert open(hl3, "rb").read() == b"123456"
|
||||
|
||||
|
||||
@pytest.mark.skipif(not llfuse, reason="llfuse not installed")
|
||||
def test_fuse_duplicate_name(archivers, request):
|
||||
archiver = request.getfixturevalue(archivers)
|
||||
cmd(archiver, "repo-create", RK_ENCRYPTION)
|
||||
cmd(archiver, "create", "archive", "input")
|
||||
cmd(archiver, "create", "archive", "input")
|
||||
mountpoint = os.path.join(archiver.tmpdir, "mountpoint")
|
||||
# mount the whole repository, archives show up as toplevel directories:
|
||||
with fuse_mount(archiver, mountpoint):
|
||||
path = os.path.join(mountpoint)
|
||||
dirs = os.listdir(path)
|
||||
assert len(set(dirs)) == 2 # there must be 2 unique dir names for 2 archives
|
||||
|
||||
|
||||
@pytest.mark.skipif(not llfuse, reason="llfuse not installed")
|
||||
def test_fuse_allow_damaged_files(archivers, request):
|
||||
archiver = request.getfixturevalue(archivers)
|
||||
|
|
Loading…
Reference in a new issue