Skip to content

create: add --exclude-dataless to skip cloud files not materialized locally#9756

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:exclude-dataless-master
Jun 11, 2026
Merged

create: add --exclude-dataless to skip cloud files not materialized locally#9756
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:exclude-dataless-master

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Ports #9755 to master.

macOS flags files whose content lives in cloud storage (e.g. iCloud Drive) and is not present locally with SF_DATALESS. Reading such a file triggers downloading its content.

This adds --exclude-dataless to borg create: the flags are checked right after stat() and before any open(), so excluded files/dirs never get materialized. Skipped paths are reported with the usual x status, analogous to --exclude-nodump.

Adaptation for master

In master, archiver.py was split into archiver/ and the nodump exclusion moved into maybe_exclude_by_attr() in archive.py — which runs after the file is opened. Opening a dataless file triggers the cloud download, so SF_DATALESS cannot be handled there. The check is placed in _rec_walk() right after stat() and before the file/dir branch, matching the spirit of the 1.4-maint PR.

Notes

  • stat.SF_DATALESS only exists from Python 3.13 on; falls back to 0x40000000 from macOS' sys/stat.h.
  • The check covers directories too (they can also be dataless), skipping before OsOpen / recursion.
  • Test fakes get_flags via monkeypatch since SF_DATALESS cannot be set from userspace.
  • Fish shell completion updated; bash/zsh completions don't exist in master.

🤖 Generated with Claude Code

@ThomasWaldmann ThomasWaldmann marked this pull request as ready for review June 10, 2026 22:40
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.88%. Comparing base (0b10329) to head (f484741).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9756      +/-   ##
==========================================
+ Coverage   84.86%   84.88%   +0.01%     
==========================================
  Files          92       92              
  Lines       14970    14979       +9     
  Branches     2234     2236       +2     
==========================================
+ Hits        12705    12715      +10     
  Misses       1571     1571              
+ Partials      694      693       -1     

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

…ocally

Ports borgbackup#9755 (1.4-maint) to master.

macOS flags files whose content lives in cloud storage (e.g. iCloud Drive)
and is not present locally with SF_DATALESS. Reading such a file triggers
downloading its content.

This adds --exclude-dataless to borg create: the flags are checked right
after stat() and before any open(), so excluded files/dirs never get
materialized. Skipped paths are reported with the usual 'x' status,
analogous to --exclude-nodump.

Notes:
- stat.SF_DATALESS only exists from Python 3.13 on, so there is a fallback
  to the value from macOS' sys/stat.h (0x40000000).
- The check covers directories too (they can also be dataless), and we skip
  before opening/recursing into them.
- Test fakes get_flags via monkeypatch since SF_DATALESS cannot be set from
  userspace.
- Fish shell completion updated; bash/zsh completions don't exist in master.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ThomasWaldmann ThomasWaldmann force-pushed the exclude-dataless-master branch from 0e155ce to f484741 Compare June 11, 2026 05:37
@ThomasWaldmann ThomasWaldmann merged commit 23d5152 into borgbackup:master Jun 11, 2026
19 checks passed
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.

1 participant