patch/backport-Fix-test-for-presence-of-BASH_LINENO-0.patch
Xibo.Wang 3e3761cbac Bakport commits from upstream
1. Skip "ed" test when the ed utility is not installed
	https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commit;h=a5b442c
2. Abort when cleaning up fails
	https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commit;h=b7b028a
3. Don't crash when RLIMIT_NOFILE is set to RLIM_INFINITY
	https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commit;h=61d7788
4. Avoid invalid memory access in context format diffs
	https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commit;h=15b158d
5. Fix failed assertion 'outstate->after_newline'
	https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commit;h=76e7758
6. Add missing-section tests to context-format test case
	https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commit;h=78ed9de
7. Fix test for presence of BASH_LINENO[0]
	https://git.savannah.gnu.org/gitweb/?p=patch.git;a=commit;h=7623b2d
2022-12-30 16:04:49 +08:00

35 lines
1.1 KiB
Diff

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