patch/backport-Fix-test-for-presence-of-BASH_LINENO-0.patch

35 lines
1.1 KiB
Diff
Raw Normal View History

From 1b33a17c9a79de1b6d5acb4da76d3fcedd8dc262 Mon Sep 17 00:00:00 2001
From: Kerin Millar <kfm@plushkava.net>
Date: Sun, 3 Jan 2021 07:25:00 +0000
Subject: [PATCH 7/8] 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
Signed-off-by: Xibo.Wang <wangxb12@chinatelecom.cn>
---
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 -- " "$*"
--
1.8.3.1