hlfuse: pass the libfuse options to mfusepy as keyword arguments, fix getattr with a file handle - #10340
Merged
ThomasWaldmann merged 1 commit intoSep 8, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10340 +/- ##
==========================================
+ Coverage 87.80% 87.86% +0.06%
==========================================
Files 103 103
Lines 18828 18876 +48
Branches 2906 2915 +9
==========================================
+ Hits 16531 16586 +55
+ Misses 1598 1589 -9
- Partials 699 701 +2 ☔ View full report in Codecov by Harness. |
… getattr with a file handle hlfuse.FUSE(self, mountpoint, options, ...) passed the option list as mfusepy's third positional parameter, which is raw_fi. Consequences: - the libfuse options were never applied: the mount was rw instead of ro, without default_permissions, and user-given -o options like allow_other were silently ignored (fsname only looked right because it defaulted to the operations class name, which is "borgfs"). - raw_fi was (accidentally) true, so open/read/release received the fuse_file_info struct - which they expect - but getattr with a file handle (kernel fgetattr, e.g. for a read reaching EOF after the attribute timeout) received the struct too and used it as a dict key: TypeError -> EINVAL. Visible as "cat: ...: Invalid argument" for any file that takes more than a second (the default attr_timeout) to read. Now convert the option list to keyword arguments, request raw_fi explicitly and take the file handle from the fuse_file_info struct in getattr. Add a regression test that checks the mount is read-only and reads a file to EOF after the attribute timeout. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ThomasWaldmann
force-pushed
the
hlfuse-mfusepy-options
branch
from
September 8, 2026 20:44
0cc497f to
9056ef4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hlfuse.pycalledhlfuse.FUSE(self, mountpoint, options, foreground=True, use_ino=True), but mfusepy's third positional parameter israw_fi, not the libfuse option list. Two consequences on master with the mfusepy backend:rwinstead ofro,default_permissionsis missing, and user-given-ooptions likeallow_otherare silently ignored (checked in/proc/mounts; another user gets "Permission denied" despite-o allow_other).fsname=borgfsonly looked right because mfusepy defaults the fsname to the operations class name, which happens to beborgfs.raw_fiwas accidentally true, whichopen/read/releaserely on (they use thefuse_file_infostruct), butgetattrwith a file handle received the struct too and used it as a dict key:TypeError: unhashable type→ EINVAL. The kernel sends that fgetattr when a read reaches EOF after the attribute timeout (1 s by default), so e.g.catof any file that takes more than a second to read ends withcat: ...: Invalid argument.The fix converts the option list to mfusepy keyword arguments, requests
raw_fi=Trueexplicitly and unwraps the file handle ingetattr.The regression test mounts an archive, checks via
statvfsthat the mount is read-only (this fails on master: the options are dropped), reads 4 KiB of a file, sleeps 1.5 s and then does a rawos.readpast EOF (this fails on master withOSError: [Errno 22] Invalid argument). It usesos.readdeliberately: a bufferedf.read()does an fstat first, which refreshes the attributes without a file handle and hides the bug.Verified on Linux (Debian 13, libfuse 3.17.2, mfusepy 3.1.1): the new test fails on master for both symptoms and passes with the fix,
mount_cmds_test.pypasses withBORG_FUSE_IMPL=mfusepy, and after the fix/proc/mountsshowsro,...,default_permissions,allow_otherforborg mount -o allow_other.Found while benchmarking #5110 (the long sequential FUSE reads would not complete without this).
🤖 Generated with Claude Code