rustBuildCrate: properly handle cargo env pragmas with spaces#199300
rustBuildCrate: properly handle cargo env pragmas with spaces#199300aanderse merged 1 commit intoNixOS:masterfrom
Conversation
|
Ah, this breaks on multiple variables being present: I guess splitting on spaces is what made it work before. I'll fix the patch. |
Aha, this patch actually prints empty line if nothing matches... Trying to figure out how to get it to work nicely while still producing escaped stuff... |
There are two problems: first that we end up splitting on spaces in the loop. Even when that is fixed, we still would split on spaces in the `export` inside the loop. We need to guard against both. Fixes NixOS#199298 Confirmed that it fixes the case mentioned in the ticket: ```console [nix-develop]$ $(nix-build -I nixpkgs=/home/shana/programming/nixpkgs Cargo.nix -A rootCrate.build --no-out-link)/bin/nix-rustc-env-escape-repro Expecting three words, got: first second third ``` I think this is going to cause a rebuild of every Rust package even if they were unaffected, not much we can do here.
db620b7 to
233205c
Compare
|
OK, now I think it's ready. I made a derp with escaping myself so it didn't work if multiple lines were present. I addressed the issue. |
|
I've tested this patch for a week with crate2nix, no problems so far 👍 @aanderse can you merge this one ? |
|
As another data point, we've been running it for 2 weeks on a medium(?) size workspace: No issues. |
aanderse
left a comment
There was a problem hiding this comment.
Looks good to me. Thanks everyone!
There are two problems: first that we end up splitting on spaces in the loop. Even when that is fixed, we still would split on spaces in the
exportinside the loop. We need to guard against both.Fixes #199298
Confirmed that it fixes the case mentioned in the ticket:
I think this is going to cause a rebuild of every Rust package even if they were unaffected, not much we can do here.
Description of changes
Things done
sandbox = trueset innix.conf? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)nixos/doc/manual/md-to-db.shto update generated release notes