1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-25 17:27:31 +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:
TW 2017-07-19 02:22:44 +02:00 committed by GitHub
commit ffe7bdb88c

View file

@ -242,16 +242,15 @@ def _create_filesystem(self):
self.process_archive(self.args.location.archive)
else:
self.versions_index = FuseVersionsIndex()
archive_names = (x.name for x in self.manifest.archives.list_considering(self.args))
for archive_name in archive_names:
for archive in self.manifest.archives.list_considering(self.args):
if self.versions:
# process archives immediately
self.process_archive(archive_name)
self.process_archive(archive.name)
else:
# lazily load archives, create archive placeholder inode
archive_inode = self._create_dir(parent=1)
self.contents[1][os.fsencode(archive_name)] = archive_inode
self.pending_archives[archive_inode] = archive_name
archive_inode = self._create_dir(parent=1, mtime=int(archive.ts.timestamp() * 1e9))
self.contents[1][os.fsencode(archive.name)] = archive_inode
self.pending_archives[archive_inode] = archive.name
def sig_info_handler(self, sig_no, stack):
logger.debug('fuse: %d synth inodes, %d edges (%s)',
@ -303,11 +302,15 @@ def mount(self, mountpoint, mount_options, foreground=False):
finally:
llfuse.close(umount)
def _create_dir(self, parent):
def _create_dir(self, parent, mtime=None):
"""Create directory
"""
ino = self.allocate_inode()
self.items[ino] = self.default_dir
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.parent[ino] = parent
return ino
@ -375,7 +378,7 @@ def make_versioned_name(name, version, add_dir=False):
self.file_versions[path] = version
path = item.path
del item.path # safe some space
del item.path # save some space
if 'source' in item and hardlinkable(item.mode):
# a hardlink, no contents, <source> is the hardlink master
source = os.fsencode(item.source)