From 7623b2dc0d1837ecfd58f32efc78e35834deeb38 Mon Sep 17 00:00:00 2001 From: Kerin Millar Date: Sun, 3 Jan 2021 07:25:00 +0000 Subject: Fix test for presence of BASH_LINENO[0] eval is not some sort of magical sandbox for executing code that might cause the shell's parser to take exception. Render the test resilient by carrying it out within a subshell. While at it, position the redirection so that STDERR is, in fact, muted. Signed-off-by: Kerin Millar Reported-by: Paolo Pedroni Closes: https://bugs.gentoo.org/738810 --- tests/test-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-lib.sh b/tests/test-lib.sh index 661da52..b2e787d 100644 --- a/tests/test-lib.sh +++ b/tests/test-lib.sh @@ -113,7 +113,7 @@ cleanup() { exit $status } -if eval 'test -n "${BASH_LINENO[0]}" 2>/dev/null'; then +if ( eval 'test -n "${BASH_LINENO[0]}"' 2>/dev/null ); then eval ' _start_test() { printf "[${BASH_LINENO[2]}] %s -- " "$*" -- cgit v1.2.1