scripts: rustc-wrapper runs under bash, so the compiler keeps Cargo's hyphenated variables
The remote CI's Linux leg has failed "Clippy (warnings denied)" on master since at least
11-15 (run 43704398652 and every push after it, 46893773054 at d8735b75f0 included): each bin_exe!
use in the validation crate's integration tests stopped with "environment variable
`CARGO_BIN_EXE_corpus-triage` not defined at compile time" (and corpus-pipeline, corpus-vulkan,
corpus-index, command-replay). The macOS leg's clippy, and every clippy in the lab, passed the
same tree on the same nightly.
The cause is the wrapper's shell. Cargo sets `CARGO_BIN_EXE_<name>` for the test's compile and
runs `scripts/rustc-wrapper` as `#!/bin/sh`. On ubuntu-26.04 /bin/sh is dash, which drops every
variable whose name is not a shell identifier from the environment it passes to exec, so rustc
never saw the hyphenated names. On Arch (the lab) and macOS /bin/sh is bash, which passes them
through. Checked by hand on macOS: `env 'CARGO_BIN_EXE_x-y=1' /bin/dash -c 'exec env'` prints
no such line; /bin/bash and /bin/sh print it.
The wrapper now names bash, present at /bin/bash on Ubuntu, Arch and macOS.
Verified: the next msi job runs clippy over the validation crate as CI runs it (CI=1, a fresh
target, env! in bin_exe!), once through the parent's wrapper under Debian's dash (red, "not
defined at compile time") and once through this one (green).
This commit is contained in:
1 parent
5d62e2079a
commit
c231c41ddd
1 file changed
+7
-1
@@ -1,8 +1,14 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# Cargo's rustc wrapper for this workspace (`.cargo/config.toml`): Cargo runs it as
|
||||
# `rustc-wrapper RUSTC ARGS...`. It hands the compile to kache, a local compiler cache, where
|
||||
# kache is on PATH and the build is not CI's; anywhere else it runs the compiler itself. kache is a
|
||||
# tool on PATH, never a dependency, and its store stays on the machine.
|
||||
#
|
||||
# bash, not sh: the wrapper must hand the compiler the environment Cargo gave it, and Cargo names
|
||||
# some variables after a target with a hyphen in it (`CARGO_BIN_EXE_corpus-triage`, which `env!`
|
||||
# reads in the validation crate's integration tests). dash, `/bin/sh` on Debian and Ubuntu, drops
|
||||
# every variable whose name is not a shell identifier from the environment it passes on; bash
|
||||
# passes them through.
|
||||
if [ -z "${CI:-}" ] && command -v kache >/dev/null 2>&1; then
|
||||
exec kache "$@"
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user