$ env - $(which nix) run nixpkgs#clang
/nix/store/c1ib07kj7baid3s3wf5m98hcpbvgs8mk-clang-wrapper-16.0.6/bin/clang: line 249: mktemp: command not found
There is no step 2. You might encounter a situation like this when running Clang with a heavily stripped environment in a Remote Build Execution context.
Describe the bug
cc-wrapper.sh is not using Nix mktemp, it's expecting one to be in the environment. So it fails when you run it with an empty PATH.
This is happening because it's:
coreutils/bin:gnugrep:bin
https://github.com/NixOS/nixpkgs/blob/0e9703512aaa0dfa34f15e4931a2f7d58a47bcb1/pkgs/build-support/cc-wrapper/cc-wrapper.sh#L239-L249
Steps To Reproduce
On pretty much any system:
There is no step 2. You might encounter a situation like this when running Clang with a heavily stripped environment in a Remote Build Execution context.
Expected behavior
cc-wrapper should not error if the PATH is empty
Additional context
It looks to me like this is the root cause of #258608. Probably same with https://github.com/tweag/rules_nixpkgs/issues/439.
Notify maintainers
No maintainers seem to be listed in cc-wrapper's metadata. But maybe @Artturin?
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a :+1: reaction to issues you find important.