Repository navigation
Finish Rust and OCaml installer downloads before running them - #17893
chessing234 wants to merge 1 commit into
Conversation
[Medium impact] The changes affect the Rust and OCaml development-environment setup paths. The PR appears safe to merge, with a non-blocking cleanup issue when installation is interrupted. Findings
SummaryRust and OCaml installers now download completely before Bash runs them.
|
| installer=$(mktemp) || return 1 | ||
| if curl --proto '=https' --proto-redir '=https' --tlsv1.2 -fsSL "$url" -o "$installer"; then | ||
| bash "$installer" "$@" || status=$? | ||
| else | ||
| status=$? | ||
| fi | ||
| rm -f -- "$installer" |
There was a problem hiding this comment.
Interrupted installs leave files
run_downloaded_installer removes its temporary file only when execution reaches rm. If the terminal closes or the command receives SIGTERM during a download or installation, the shell can exit before that line and leave the downloaded script behind. Add cleanup on exit and handle termination signals so interrupted runs remove the file too.
|
GPT-6 in Codex (reasoning effort not exposed by this session) read the diff, installer flow, menu callers, regression test, and existing review comments at 65a55f3. I classified the partial-download execution problem as a bug, but the configured second classifier, deepseek-v4p1-flash, returned no usable classification, so classification remains unsettled. A separate reviewer health check succeeded; no second code review ran. Verification stopped at that classification gate: no worker tests, independent reproduction, or actual vendor installation ran, and no changes or labels were applied. This is waiting on the maintainer to resolve classification before verification continues. |
What changes
Rust and OCaml setup currently pass curl's stdout directly into
bash -c. If a transfer writes part of a valid script and then fails, Bash can still execute that partial script; the transfer's failure is lost in command substitution.Download each installer to a temporary file, run it only after curl succeeds, preserve installer failures, and remove the file afterwards. Both transfers and redirects are restricted to HTTPS. OCaml setup stops before
opam initwhen its installer could not be downloaded.This is a download failure and transport hardening change, not a claim of a separately exploitable vulnerability. It does not pin vendor releases. Related #9470 addresses a different boundary: cached sudo authorization around vendor code.
Verification
The focused regression passes both truncated-download cases, confirms no partial script or OCaml follow-up runs, and checks complete Rust installation arguments and cleanup. On the unchanged base the regression fails because a partial Rust installer runs and setup reports success. Bash syntax and whitespace checks pass.
Vendor installation is stubbed. The full Linux test workflow passes: Tests run 42238665510. Actual Rust/OCaml vendor installation remains untested.
Screenshots
No visible change: installer selection and successful setup behave as before.