Skip to content

More principled tempdir usage by and between rustc, rustdoc and compiletest #138475

Open
@scottmcm

Description

@scottmcm

"Specifically, it's somewhere here:

if outputs.outputs.should_link() {
let tmpdir = TempFileBuilder::new()
.prefix("rustc")
.tempdir()
.unwrap_or_else(|error| sess.dcx().emit_fatal(errors::CreateTempDir { error }));
let path = MaybeTempDir::new(tmpdir, sess.opts.cg.save_temps);

"but yeah, in any case, we probably should override that, to point it under build/test/$test_suite_name/$test_suite_revisioned_compare_moded/__temp/
"(E.g. by setting TMP_DIR/TEMP/TMP or whatever the env vars were called)
"Can you open an E-needs-investigation issue?" ~ @jieyouxu https://discord.com/channels/273534239310479360/957720175619215380/1349912066772963469

Spotted in #138157 (comment), the bors job failed with

--- stderr -------------------------------
error: couldn't create a temp dir: Access is denied. (os error 5) at path "C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\rustcfzdxGW"

error: aborting due to 1 previous error

It would be nice if those stayed in the build/target directory, which is more likely to have a defender exclusion (and thus more likely to not have that access error). It would also be helpful to stay on the Dev Drive on Windows 11 if people have that set up, rather than use C: which typically has the most extra filesystem access costs (from filters and such).

And it'd just be nice not to have a bazillion of these left over after running tests a bunch :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-compiletestArea: The compiletest test runnerA-test-infraArea: test infrastructure (may span bootstrap/compiletest/more)A-testsuiteArea: The testsuite used to check the correctness of rustcC-bugCategory: This is a bug.E-needs-investigationCall for partcipation: This issues needs some investigation to determine current statusT-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    • Status

      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions