aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/lang.sh
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 05:39:12 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 05:39:12 +0100
commit1b135e6e7b45acd135653bfe8b9dd7bf7178ca6c (patch)
tree12af459dbd7249533d2021317ef145095f655e1a /tests/functional/lang.sh
parent6cb215f63b9d6fd624fe4a514489990dca46f917 (diff)
Fix `boost::bad_format_string` exception in `builtins.addErrorContext` (#9291)
* Fix boost::bad_format_string exception in builtins.addErrorContext The message passed to addTrace was incorrectly being used as a format string and this this would cause an exception when the string contained a '%', which can be hit in places where arbitrary file paths are interpolated. * add test (cherry picked from commit 61d6fe059e959455e156c1d57bb91155d363e983) Change-Id: Idd671127a9c1ccc8b94e58e727632fcc064f3cbe
Diffstat (limited to 'tests/functional/lang.sh')
-rwxr-xr-xtests/functional/lang.sh1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/functional/lang.sh b/tests/functional/lang.sh
index c3acef5ee..12df32c87 100755
--- a/tests/functional/lang.sh
+++ b/tests/functional/lang.sh
@@ -23,6 +23,7 @@ nix-instantiate --trace-verbose --eval -E 'builtins.traceVerbose "Hello" 123' 2>
nix-instantiate --eval -E 'builtins.traceVerbose "Hello" 123' 2>&1 | grepQuietInverse Hello
nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello" 123' 2>&1 | grepQuietInverse Hello
expectStderr 1 nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello" (throw "Foo")' | grepQuiet Hello
+expectStderr 1 nix-instantiate --show-trace --eval -E 'builtins.addErrorContext "Hello %" (throw "Foo")' | grepQuiet 'Hello %'
nix-instantiate --eval -E 'let x = builtins.trace { x = x; } true; in x' \
2>&1 | grepQuiet -E 'trace: { x = «potential infinite recursion»; }'