Skip to content

mount: add strip_components, numeric_ids and archive_dir_format mount options, fixes #4880 - #10505

Open
ThomasWaldmann wants to merge 3 commits into
borgbackup:masterfrom
ThomasWaldmann:mount-opt-strip-numeric
Open

ThomasWaldmann wants to merge 3 commits into
borgbackup:masterfrom
ThomasWaldmann:mount-opt-strip-numeric

Conversation

@ThomasWaldmann

@ThomasWaldmann ThomasWaldmann commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

fstab and autofs entries (fuse.borgfs) can only give mount options (-o ...), not borg CLI options or environment variables. Until now, strip_components=N in such an entry was passed on to libfuse, which rejects unknown options, so the mount failed. In borg 2, the only workarounds were the mount: section of the config file (applies to all borgfs mounts) or BORG_STRIP_COMPONENTS (no way to set it from autofs / mount(8)).

Three commits:

  • strip_components=NUMBER mount option: same as --strip-components NUMBER, also feeds the item filter (skipping too-short paths). The mount option wins if both are given. Fixes mount: support strip-components #4880.
  • numeric_ids mount option: same as --numeric-ids; numeric_ids=no overrides the CLI flag. Also clarifies the docs, which said "using numeric-ids" although that was only the CLI flag.
  • archive_dir_format=FORMAT mount option: same as BORG_MOUNT_ARCHIVE_DIR_FORMAT; the mount option wins if both are given. Errors name the source (archive_dir_format mount option: ... vs. BORG_MOUNT_ARCHIVE_DIR_FORMAT: ...). As mount options are separated by commas, FORMAT can not contain a comma (documented). borg webdav keeps using the env var.

All three options are removed from the option list before it is passed to libfuse.

Tests: parse_mount_options() unit tests in vfs_test.py (no FUSE needed), plus a mount option case in test_fuse_archive_dir_format (mount option set while the env var is also set). Also checked that borgfs /repo mnt -o ro,allow_other,strip_components=4,numeric_ids hands only ro,allow_other (plus borg's defaults) to libfuse, and ran ArchiveVFS.create_filesystem() on a test repo with env only / mount option + env / invalid formats from either source.

🤖 Generated with Claude Code

ThomasWaldmann and others added 2 commits October 6, 2026 23:12
fstab and autofs entries can only give mount options, not borg CLI
options, so -o strip_components=N now does what --strip-components N
does (the mount option wins if both are given).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Like strip_components, this makes --numeric-ids usable from fstab and
autofs entries. Also clarify in the docs that numeric-ids was the
--numeric-ids CLI option, not a mount option.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.13%. Comparing base (7e3d305) to head (c7f2f2d).
⚠️ Report is 7 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10505      +/-   ##
==========================================
+ Coverage   89.12%   89.13%   +0.01%     
==========================================
  Files         103      103              
  Lines       19783    19793      +10     
  Branches     3099     3102       +3     
==========================================
+ Hits        17631    17642      +11     
+ Misses       1490     1488       -2     
- Partials      662      663       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@PhrozenByte

Copy link
Copy Markdown
Contributor

It might be a good addition to also support BORG_MOUNT_ARCHIVE_DIR_FORMAT as a mount option, since fstab and autofs entries don't support env variables either.

Same as BORG_MOUNT_ARCHIVE_DIR_FORMAT, but usable from fstab and autofs
entries; if both are given, the mount option is used. As mount options
are separated by commas, the format can not contain a comma.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ThomasWaldmann ThomasWaldmann changed the title mount: add strip_components and numeric_ids mount options, fixes #4880 mount: add strip_components, numeric_ids and archive_dir_format mount options, fixes #4880 Oct 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mount: support strip-components

2 participants