summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2021-01-03 07:25:00 +0000
committerAndreas Gruenbacher <agruenba@redhat.com>2021-01-08 10:15:31 +0100
commit7623b2dc0d1837ecfd58f32efc78e35834deeb38 (patch)
treea15da4e28c38c96c224add3ce1561e0d6967c2aa
parent099394003477b83c2eb4be07fd0173d6e696cf4e (diff)
downloadpatch-7623b2dc0d1837ecfd58f32efc78e35834deeb38.tar.gz
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 <kfm@plushkava.net> Reported-by: Paolo Pedroni <paolo.pedroni@iol.it> Closes: https://bugs.gentoo.org/738810
-rw-r--r--tests/test-lib.sh2
1 files changed, 1 insertions, 1 deletions
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 -- " "$*"