Skip to content

ChunkerParams: reject buzhash params that do not fit the chunker buffer (1.4-maint) - #10596

Merged
ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:chunker-params-buffer-1.4
Nov 5, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:1.4-maintfrom
ThomasWaldmann:chunker-params-buffer-1.4

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Chunker params like 10,12,11,4095 passed the CLI validation, but then crashed borg create with a traceback:

Local Exception
AssertionError: too small max_size

The buzhash chunker needs window_size + 2^chunk_min + 1 <= 2^chunk_max (see the assertion in Chunker.__cinit__). This PR checks that at parse time and raises an ArgumentTypeError, which is what master does for buzhash64 (3a9ffd4):

borg create: error: argument --chunker-params: required: window_size + 2^chunk_min + 1 <= 2^chunk_max

(rc 2, no traceback). Before this change, such params could never be used, because the chunker gets constructed for every create. So no setup that works today will be rejected now.

Found during 1.4.6 release testing; 1.4.5 behaves the same.

Tests: added cases to test_chunkerparams, including the exact boundary 10,13,11,4095, which is still accepted. The full test suite passes locally on macOS.

🤖 Generated with Claude Code

Chunker params like 10,12,11,4095 passed the CLI validation, but then
crashed borg create with "AssertionError: too small max_size" when the
chunker was constructed: the buzhash chunker needs
window_size + 2^chunk_min + 1 <= 2^chunk_max.

Check this at parse time and raise a proper ArgumentTypeError instead,
like master does for buzhash64 (see 3a9ffd4).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ThomasWaldmann
ThomasWaldmann merged commit 30f65d1 into borgbackup:1.4-maint Nov 5, 2026
13 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the chunker-params-buffer-1.4 branch November 5, 2026 11:06
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