Skip to content

fix DownloadPipeline.fetch_many() crashing on a missing chunk - #10024

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:fetch-many-missing-chunk
Aug 3, 2026
Merged

fix DownloadPipeline.fetch_many() crashing on a missing chunk#10024
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:fetch-many-missing-chunk

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Split out of #10023 (where this was found), because it is an independent bug fix.

With replacement_chunk=False, fetch_many() is documented (and used) to yield None for a
chunk that is missing in the repository - but the size check right before the yield then did
len(None) and raised TypeError instead.

borg webdav is currently the only caller that passes replacement_chunk=False for file
content, so its "chunk missing" path (abort the connection instead of serving corrupted data)
never actually ran: the TypeError ended up in the request error handler, which then tried to
send a 500 for a response whose headers were already on the wire.

It shows up as a test failure in #10023 because borg mount reads via fetch_many() there,
so test_fuse_allow_damaged_files reported EINVAL instead of EIO on all three FUSE legs.

Tests: unit tests for both flavours of a missing chunk (the replacement_chunk=False one fails
without this fix) and an end-to-end webdav test that deletes a chunk and expects the download
to be aborted rather than completed.

🤖 Generated with Claude Code

With replacement_chunk=False, fetch_many() is documented (and used) to yield None
for a chunk that is missing in the repository - but the size check right before
the yield then did len(None) and raised TypeError instead.

borg webdav is currently the only caller that passes replacement_chunk=False for
file content, so its "chunk missing" path (abort the connection instead of
serving corrupted data) never actually ran: the TypeError ended up in the request
error handler, which then tried to send a 500 for a response whose headers were
already on the wire.

Adds unit tests for both flavours of a missing chunk (the one without a
replacement chunk fails without this fix) and an end-to-end webdav test for
downloading a file with a chunk missing.

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

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.14%. Comparing base (4d2e068) to head (d5eb3f7).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10024      +/-   ##
==========================================
+ Coverage   86.10%   86.14%   +0.04%     
==========================================
  Files          96       96              
  Lines       17326    17326              
  Branches     2649     2649              
==========================================
+ Hits        14918    14925       +7     
+ Misses       1667     1663       -4     
+ Partials      741      738       -3     

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

@ThomasWaldmann
ThomasWaldmann merged commit 8dd7241 into borgbackup:master Aug 3, 2026
19 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the fetch-many-missing-chunk branch August 3, 2026 10:21
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