rust-lang/rust CI build failed when generating test file paths exceeding about 260 chars on Windows #77576
Labels
A-compiletest
Area: The compiletest test runner
A-contributor-roadblock
Area: Makes things more difficult for new contributors to rust itself
A-testsuite
Area: The testsuite used to check the correctness of rustc
C-bug
Category: This is a bug.
O-windows
Operating system: Windows
T-bootstrap
Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The problem and a proposed guard to avoid wasting time and resources
This bug (panic message shown below) resulted from a combination of components with long names, resulting in mir-dump output that tried to create a file path exceeding Windows' 260 byte (give or take?) max path length limit.
The
bors
CI builds for Windows, under both MSVC and mingw/gnu are susceptible to this kind of failure.I worked around the problem by abbreviating directory names, rust program file names, and symbols inside the rust program, all of which contributed to the long path name.
The error messages produced by Rust and/or Windows (
NotFound
) offer no obvious clue that the problem is the path length. (Thankfully I knew enough to suspect it, but others may not.)This was not caught until I ran the tests under CI, and it happened more than once (at least once under MSVC, which I fixed, and then again under mingw, because I didn't shrink the paths enough the first time.
This is something that could be caught early, during development (even before sending to bors).
My recommendation is, when
compiletest
runs a test on any platform (e.g., Linux or MacOS, where this problem does not crop up naturally because they don't have path limits),compiletest
should check the lengths of all generated files in thebuild/<target>/src/test
directory. Strip the directory prefix up throughbuild
, and if the remaining subpath of any file path is greater than, say, 215 characters, generate an error or warning (something the developer won't miss) that their test is generating paths that may exceed path limits on Windows, and may not pass CI.This should be enough to get the developer to update their tests and avoid the entire problem.
Meta
Error output
(Newlines inserted for readability.)
The text was updated successfully, but these errors were encountered: