nixos-rebuild-ng: rework env handling in process.run_wrapper#493085
Open
thiagokokada wants to merge 2 commits intoNixOS:staging-nixosfrom
Open
nixos-rebuild-ng: rework env handling in process.run_wrapper#493085thiagokokada wants to merge 2 commits intoNixOS:staging-nixosfrom
thiagokokada wants to merge 2 commits intoNixOS:staging-nixosfrom
Conversation
156d40b to
ad30ddd
Compare
Contributor
Author
|
If possible I would like testing with things like |
Replace `extra_env` with a typed `env` mapping and introduce
`PRESERVE_ENV` for variables that must be inherited from the caller.
For remote execution, pass environment through `env -i` on the remote
side and expand preserved values there (e.g. `${PATH-}`), so SSH's own
environment is not polluted.
For local sudo execution, stop using `--preserve-env` and only inject
`env -i ...` when explicit `env` values are requested; otherwise keep
`subprocess.run(env=None)` to preserve default behavior.
For local execution without sudo we only replace the environment
variables when `env != None`.
Fix NixOS#491850.
ad30ddd to
97a3995
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace
extra_envwith a typedenvmapping and introducePRESERVE_ENVfor variables that must be inherited from the caller.For remote execution, pass environment through
env -ion the remote side and expand preserved values there (e.g.${PATH-}), so SSH's own environment is not polluted.For local sudo execution, stop using
--preserve-envand only injectenv -i ...when explicitenvvalues are requested; otherwise keepsubprocess.run(env=None)to preserve default behavior.For local execution without sudo we only replace the environment variables when
env != None.Fix #491850.
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.