mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 10:18:12 +00:00
Merge pull request #2838 from milkey-mouse/fix2834
Use archive creation time as mtime for FUSE mount (fixes #2834)
This commit is contained in:
commit
ffe7bdb88c
1 changed files with 12 additions and 9 deletions
|
@ -242,16 +242,15 @@ def _create_filesystem(self):
|
||||||
self.process_archive(self.args.location.archive)
|
self.process_archive(self.args.location.archive)
|
||||||
else:
|
else:
|
||||||
self.versions_index = FuseVersionsIndex()
|
self.versions_index = FuseVersionsIndex()
|
||||||
archive_names = (x.name for x in self.manifest.archives.list_considering(self.args))
|
for archive in self.manifest.archives.list_considering(self.args):
|
||||||
for archive_name in archive_names:
|
|
||||||
if self.versions:
|
if self.versions:
|
||||||
# process archives immediately
|
# process archives immediately
|
||||||
self.process_archive(archive_name)
|
self.process_archive(archive.name)
|
||||||
else:
|
else:
|
||||||
# lazily load archives, create archive placeholder inode
|
# lazily load archives, create archive placeholder inode
|
||||||
archive_inode = self._create_dir(parent=1)
|
archive_inode = self._create_dir(parent=1, mtime=int(archive.ts.timestamp() * 1e9))
|
||||||
self.contents[1][os.fsencode(archive_name)] = archive_inode
|
self.contents[1][os.fsencode(archive.name)] = archive_inode
|
||||||
self.pending_archives[archive_inode] = archive_name
|
self.pending_archives[archive_inode] = archive.name
|
||||||
|
|
||||||
def sig_info_handler(self, sig_no, stack):
|
def sig_info_handler(self, sig_no, stack):
|
||||||
logger.debug('fuse: %d synth inodes, %d edges (%s)',
|
logger.debug('fuse: %d synth inodes, %d edges (%s)',
|
||||||
|
@ -303,10 +302,14 @@ def mount(self, mountpoint, mount_options, foreground=False):
|
||||||
finally:
|
finally:
|
||||||
llfuse.close(umount)
|
llfuse.close(umount)
|
||||||
|
|
||||||
def _create_dir(self, parent):
|
def _create_dir(self, parent, mtime=None):
|
||||||
"""Create directory
|
"""Create directory
|
||||||
"""
|
"""
|
||||||
ino = self.allocate_inode()
|
ino = self.allocate_inode()
|
||||||
|
if mtime is not None:
|
||||||
|
self.items[ino] = Item(**self.default_dir.as_dict())
|
||||||
|
self.items[ino].mtime = mtime
|
||||||
|
else:
|
||||||
self.items[ino] = self.default_dir
|
self.items[ino] = self.default_dir
|
||||||
self.parent[ino] = parent
|
self.parent[ino] = parent
|
||||||
return ino
|
return ino
|
||||||
|
@ -375,7 +378,7 @@ def make_versioned_name(name, version, add_dir=False):
|
||||||
self.file_versions[path] = version
|
self.file_versions[path] = version
|
||||||
|
|
||||||
path = item.path
|
path = item.path
|
||||||
del item.path # safe some space
|
del item.path # save some space
|
||||||
if 'source' in item and hardlinkable(item.mode):
|
if 'source' in item and hardlinkable(item.mode):
|
||||||
# a hardlink, no contents, <source> is the hardlink master
|
# a hardlink, no contents, <source> is the hardlink master
|
||||||
source = os.fsencode(item.source)
|
source = os.fsencode(item.source)
|
||||||
|
|
Loading…
Reference in a new issue