Skip to content

create: add --exclude-dataless to skip cloud files not materialized locally (1.4-maint)#9755

Merged
ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:exclude-dataless-1.4
Jun 10, 2026
Merged

create: add --exclude-dataless to skip cloud files not materialized locally (1.4-maint)#9755
ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:exclude-dataless-1.4

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Fixes #9746.

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 since SF_DATALESS cannot be set from userspace.
  • Shell completions updated; usage docs (create.rst.inc) left for the usual regeneration.

🤖 Generated with Claude Code

…ocally, fixes borgbackup#9746

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

With --exclude-dataless, borg create checks the flags (cheap, after
stat, before open) and skips such files/dirs, so backups do not force
a download of all cloud-stored data.

stat.SF_DATALESS is only available from Python 3.13 on, so we fall
back to the value from macOS' sys/stat.h on older Pythons.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@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 81.98%. Comparing base (ae1440e) to head (64ee2aa).
⚠️ Report is 19 commits behind head on 1.4-maint.

Additional details and impacted files
@@              Coverage Diff              @@
##           1.4-maint    #9755      +/-   ##
=============================================
+ Coverage      81.96%   81.98%   +0.01%     
=============================================
  Files             38       38              
  Lines          11365    11372       +7     
  Branches        1793     1794       +1     
=============================================
+ Hits            9315     9323       +8     
+ Misses          1461     1460       -1     
  Partials         589      589              

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

@ThomasWaldmann ThomasWaldmann marked this pull request as ready for review June 10, 2026 20:32
@ThomasWaldmann ThomasWaldmann merged commit 34ef23f into borgbackup:1.4-maint Jun 10, 2026
20 of 22 checks passed
@ThomasWaldmann ThomasWaldmann deleted the exclude-dataless-1.4 branch June 10, 2026 21:21
ThomasWaldmann added a commit to ThomasWaldmann/borg that referenced this pull request Jun 11, 2026
…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>
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