Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix crash on old llfuse without birthtime attrs, fixes #5064 #5072

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/borg/fuse.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
# Does this version of llfuse support ns precision?
have_fuse_xtime_ns = hasattr(llfuse.EntryAttributes, 'st_mtime_ns')

# Does this version of llfuse support birthtime?
have_fuse_birthtime = hasattr(llfuse.EntryAttributes, 'st_birthtime') # never?
have_fuse_birthtime_ns = hasattr(llfuse.EntryAttributes, 'st_birthtime_ns') # since llfuse 1.3

fuse_version = LooseVersion(getattr(llfuse, '__version__', '0.1'))
if fuse_version >= '0.42':
def fuse_main():
Expand Down Expand Up @@ -541,12 +545,14 @@ def getattr(self, inode, ctx=None):
entry.st_mtime_ns = mtime_ns
entry.st_atime_ns = item.get('atime', mtime_ns)
entry.st_ctime_ns = item.get('ctime', mtime_ns)
entry.st_birthtime_ns = item.get('birthtime', mtime_ns)
if have_fuse_birthtime_ns:
entry.st_birthtime_ns = item.get('birthtime', mtime_ns)
else:
entry.st_mtime = mtime_ns / 1e9
entry.st_atime = item.get('atime', mtime_ns) / 1e9
entry.st_ctime = item.get('ctime', mtime_ns) / 1e9
entry.st_birthtime = item.get('birthtime', mtime_ns) / 1e9
if have_fuse_birthtime:
entry.st_birthtime = item.get('birthtime', mtime_ns) / 1e9
return entry

def listxattr(self, inode, ctx=None):
Expand Down