Skip to content

bootstrap panics when setting a nonexistent build directory via --set build.build-dir #166607

Description

@paradoxicalguy

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=false

expected 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

e068f42

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

  1. added
    T-bootstrap
    C-bug
    on Nov 26, 2026
  2. added
    needs-triage
    on Nov 26, 2026
  3. Kobzol commented on Nov 26, 2026

    @Kobzol
    Member

    Hi, thanks for the report. Adding something like t!(std::fs::create_dir_all(&out)); after let out = if !out.is_absolute() in config.rs should do the trick.

  4. paradoxicalguy commented on Nov 26, 2026

    @paradoxicalguy
    MemberAuthor

    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:

    rustc_stamp.write() failed with No such file or directory (os error 2)
    

    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-dir when 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?

  5. bardiharborow commented on Nov 26, 2026

    @bardiharborow
    Contributor

    @rustbot label +A-bootstrap-config +A-Python +S-has-mcve -needs-triage

  6. added
    A-bootstrap-config
    A-Python
    S-has-mcve
    and removed
    needs-triage
    on Nov 26, 2026
  7. paradoxicalguy commented on Nov 27, 2026

    @paradoxicalguy
    MemberAuthor

    @rustbot claim

  8. added 2 commits that reference this issue on Nov 27, 2026
    0746168
    ccf8034
  9. added a commit that references this issue on Nov 27, 2026
    b663227
  10. added a commit that references this issue on Nov 28, 2026
    ee13d6b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-PythonA-bootstrap-configC-bugS-has-mcveT-bootstrap

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions