nix-shell: stop using dynamic format strings!!
This was always a terrible idea independently of whether it crashes. Stop doing it! This commit was verified by running nix-shell on a trivial derivation with --debug --verbose to get the vomit-level output of the shell rc file and then diffing it before/after this change. I have reasonable confidence it did not regress anything, though this code is genuinely really hard to follow (which is a second reason that I split it into two fmt calls). Fixes: https://git.lix.systems/lix-project/lix/issues/533 Change-Id: I8e11ddbece2b12749fda13efe0b587a71b00bfe5
This commit is contained in:
@@ -115,6 +115,7 @@ functional_tests_scripts = [
|
||||
'check.sh',
|
||||
'nix-shell/basic.sh',
|
||||
'nix-shell/structured-attrs.sh',
|
||||
'nix-shell/regression-533.sh',
|
||||
'check-refs.sh',
|
||||
'build-remote-input-addressed.sh',
|
||||
'secure-drv-outputs.sh',
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
source ../common.sh
|
||||
|
||||
clearStore
|
||||
|
||||
evil=$(cat <<-'EOF'
|
||||
builtins.derivation {
|
||||
name = "evil-kbity";
|
||||
system = "x86_64-darwin";
|
||||
builder = "/bin/sh";
|
||||
args = [ "-c" "> $out" ];
|
||||
__structuredAttrs = true;
|
||||
env.oops = "lol %s";
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
# This should not crash
|
||||
nix-shell --expr "$evil" --run 'echo yay' | grepQuiet yay
|
||||
Reference in New Issue
Block a user