Make local install failures and prerequisites actionable - #507
Open
sdairs wants to merge 1 commit into
Open
Conversation
| .map_err(extraction_error)?; | ||
| std::io::copy(&mut entry, &mut output).map_err(extraction_error)?; | ||
| let _ = std::fs::remove_file(tarball_path); | ||
| return Ok(()); |
There was a problem hiding this comment.
🟠 High version_manager/install.rs:379
A corrupted gzip download can be accepted as an installed clickhouse binary: this return Ok(()) runs immediately after copying the matching entry, so GzDecoder is dropped before validating the gzip trailer CRC and size. For exact versions, install_resolved then commits the corrupted executable without running version detection. Consume and validate the archive to EOF before publishing the output, preferably by writing to a temporary file and renaming it only after validation.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @crates/clickhousectl/src/version_manager/install.rs around line 379:
A corrupted gzip download can be accepted as an installed `clickhouse` binary: this `return Ok(())` runs immediately after copying the matching entry, so `GzDecoder` is dropped before validating the gzip trailer CRC and size. For exact versions, `install_resolved` then commits the corrupted executable without running version detection. Consume and validate the archive to EOF before publishing the output, preferably by writing to a temporary file and renaming it only after validation.
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.
Summary
tarsubprocess with selective in-process extraction using the existingflate2andtardependencies, while retaining archive, destination, malformed-input, and missing-binary context.local install --helpwith version examples, the binary destination, source hosts, the approximate download size, and the barelocal server startbootstrap route.Tests
cargo test -p clickhousectlcargo test -p clickhousectl --no-default-featurescargo test -p clickhousectl version_manager::install::testscargo fmt --all --checkcargo clippy -p clickhousectl --all-targets -- -D warningsStack
issue-456-atomic-installs(Make local ClickHouse installs atomic and concurrency-safe #502)Closes #462
Stack created with GitHub Stacks CLI • Give Feedback