Skip to content

cc-wrapper: Resolve mktemp and rm path before resetting $PATH#271159

Closed
malt3 wants to merge 1 commit intoNixOS:stagingfrom
malt3:fix/cc-wrapper-coreutils-path-reset
Closed

cc-wrapper: Resolve mktemp and rm path before resetting $PATH#271159
malt3 wants to merge 1 commit intoNixOS:stagingfrom
malt3:fix/cc-wrapper-coreutils-path-reset

Conversation

@malt3
Copy link
Copy Markdown
Contributor

@malt3 malt3 commented Nov 30, 2023

Description of changes

Without this, mktemp (and rm) from the host environment is picked up. This may result in mktemp behaving differently (on darwin) or mktemp / rm not being found at all.
I ran into this trying to use a clang toolchain on Linux (inside of rules_nixpkgs).

Please also refer to the discussion in #258607:

[...] Perhaps it's easier to just resolve mktemp before the PATH is reset and then still invoke it later, since there is some more code in-between.

I noticed that any change in the wrapper requires massive rebuilds.
This change is correct to the best of my understanding.
Please feel free to point out any possible improvements!

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Priorities

Add a 👍 reaction to pull requests you find important.

@malt3 malt3 requested review from aherrmann and tobim November 30, 2023 10:14
Without this, mktemp (and rm) from the host environment is picked up.
This may result in mktemp behaving differently (on darwin) or mktemp / rm not being found at all.
@malt3 malt3 force-pushed the fix/cc-wrapper-coreutils-path-reset branch from 37ab85b to 77c5993 Compare November 30, 2023 10:17
@malt3 malt3 marked this pull request as ready for review November 30, 2023 14:27
@malt3 malt3 requested a review from Ericson2314 as a code owner November 30, 2023 14:27
@malt3 malt3 requested a review from a user November 30, 2023 14:27
@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Nov 30, 2023
@ghost
Copy link
Copy Markdown

ghost commented Dec 1, 2023

I noticed that any change in the wrapper requires massive rebuilds.

Yes.

I have a PR which will help with that, a lot, and also provide a cleaner way to implement your solution, by using ${buildPackages.coreutils}/bin/mktemp to lock the path. Please stand by.

@ghost
Copy link
Copy Markdown

ghost commented Dec 1, 2023

@malt3
Copy link
Copy Markdown
Contributor Author

malt3 commented Dec 1, 2023

Nice! Thanks for sharing your solution. Should I just close this PR?

@malt3
Copy link
Copy Markdown
Contributor Author

malt3 commented Dec 1, 2023

Closed in favor of #271339

@malt3 malt3 closed this Dec 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild on Darwin and must target a staging branch. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. 10.rebuild-linux-stdenv This PR causes stdenv to rebuild on Linux and must target a staging branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant