Repository navigation
Description
summary
while testing a fix for #166344, i noticed that bootstrap panics when specifying a nonexistent build directory through --set build.build-dir, whereas the equivalent --build-dir option works.
command used
OUT=$(mktemp -d)
python3 x.py build library/std --dry-run --stage 1 --set profile=compiler --set "build.build-dir=$OUT/custom/build" --set llvm.download-ci-llvm=true --set rust.download-rustc=falseexpected behaviour
bootstrap should initialize the specified build directory and complete successfully, as it does when using --build-dir.
actual behaviour
bootstrap panics at src/bootstrap/src/cli_main.rs:79:22 while attempting to open the lock file because the specified build directory does not exist.
bootstrap configuration (bootstrap.toml)
no bootstrap.toml is present. configuration overrides are supplied through the command line.
operating system
Linux (x86_64-unknown-linux-gnu)
HEAD
additional context
python bootstrap does not process --set build.build-dir when determining the build directory, whereas rust bootstrap honors the override. this causes the two implementations to use different directories.
using the dedicated --build-dir option successfully works around the issue.
i reproduced this on an unmodified checkout and have tested a preliminary local fix. i'd be interested in working on this if the proposed approach is appropriate.
Build Log
Building bootstrap
Compiling bootstrap v0.0.0
Finished `dev` profile [unoptimized] target(s) in 1.77s
thread 'main' (1626585) panicked at src/bootstrap/src/cli_main.rs:79:22:
fs::OpenOptions::new().read(true).write(true).create(true).truncate(false).open(&lock_path) failed with No such file or directory (os error 2)
Bootstrap has panicked, currently active steps:
Panic was initiated from src/bootstrap/src/cli_main.rs:79:22
Build completed unsuccessfully in 0:00:01
Activity
Kobzol commentedon Nov 26, 2026
Hi, thanks for the report. Adding something like
t!(std::fs::create_dir_all(&out));afterlet out = if !out.is_absolute()inconfig.rsshould do the trick.paradoxicalguy commentedon Nov 26, 2026
i tested the suggested change on a fresh build. it resolves the lock-file panic, but bootstrap then panics at
src/bootstrap/src/core/download.rs:676:9:python bootstrap still prepares stage0 in the default build directory, while rust bootstrap uses the overridden path.
i also tested a preliminary python-side fix that processes
--set build.build-dirwhen determining the build directory. the original reproduction completes successfully with that change, and all 11 added unit tests pass.would you prefer addressing the directory mismatch on the python side?
bardiharborow commentedon Nov 26, 2026
@rustbot label +A-bootstrap-config +A-Python +S-has-mcve -needs-triage
paradoxicalguy commentedon Nov 27, 2026
@rustbot claim
Rollup merge of rust-lang#166641 - paradoxicalguy:fix-bootstrap-build…
Rollup merge of rust-lang#166641 - paradoxicalguy:fix-bootstrap-build…
Unrolled build for #166641 in rollup 166674
Rollup merge of #166641 - paradoxicalguy:fix-bootstrap-build-dir-over…