Repository navigation
compress: fix default level hanging zstd and disabling gzip compression - #10230
Merged
Merged
Conversation
The zstd support removed the default from the --compress-level option and made it required. When no level was configured the option was left at its zero value, which meant no compression for gzip and an invalid encoder level for zstd. Restore the -1 default which selects the default level for the chosen mode, and translate it to zstd's default level of 2. Also implement the documented zstd level 0 by storing files uncompressed, and validate levels when creating the Fs so bad values fail immediately instead of hanging. The compression goroutines now close the pipe with the encoder error and the results channels are buffered, so an encoder or upload error can no longer leave the transfer blocked forever waiting for EOF. Fixes rclone#10227 Co-authored-by: CommandCodeBot <[email protected]>
Restore the generated option section to its base content so the autogenerated edits check passes Keep the configuration example and compression level explanation outside the generated section, with option help maintained in the Go source
akasakariko
added a commit
to akasakariko/akasakariko
that referenced
this pull request
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of this change?
Since zstd support was added in #8756 the
leveloption lost its default andwas marked required. When no level is configured it stayed at its zero value,
which broke both modes:
uploaded as valid but uncompressed
.gzfiles.klauspost/compressrejects it,and the error path in
putCompressnever closed the pipe used to stream thecompressed data, so
rclone copytohung forever waiting for EOF.This restores the
-1default. Since the option is shared by both modes,-1is translated to zstd's default level (2), while gzip passes it straight
through to sgzip as before. The documented zstd level 0 ("turns off
compression") is now implemented by storing the file uncompressed, and
out-of-range levels are rejected when the Fs is created with a clear error
instead of hanging mid-transfer.
The compression goroutines now close the pipe with the encoder error and the
result channels are buffered, so a failing encoder or upload can no longer
leave the transfer blocked.
Testing
go test ./backend/compressandgo vet ./backend/compress/pass, includingnew tests for the gzip/zstd defaults, zstd level 0, and invalid levels.
Manual check with the 36,492-byte file from the issue:
.gz.gz.zst.binChecklist
Fixes #10227