From ea381a0c24c02573f6097c883bca7324d81f6d3a Mon Sep 17 00:00:00 2001 From: panxiaohe Date: Tue, 24 Nov 2020 17:24:36 +0800 Subject: [PATCH] setarch: fix stderr handling in uname26 tests --- ...fix-stderr-handling-in-uname26-tests.patch | 54 +++++++++++++++++++ util-linux.spec | 6 ++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 setarch-fix-stderr-handling-in-uname26-tests.patch diff --git a/setarch-fix-stderr-handling-in-uname26-tests.patch b/setarch-fix-stderr-handling-in-uname26-tests.patch new file mode 100644 index 0000000..ef8299c --- /dev/null +++ b/setarch-fix-stderr-handling-in-uname26-tests.patch @@ -0,0 +1,54 @@ +From 2261cfdc26b91b50fd7c4c7da56bae9a5999122e Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Wed, 27 May 2020 23:20:58 +0000 +Subject: [PATCH] setarch: fix stderr handling in uname26 tests + +A while ago stdout and stderr have been split in these testcases, but +"FATAL: kernel too old" is actually treated as an "okay" output. However +this FATAL ends up on stderr, so when it happens, it is not seen in +the captured stdout. + +Fix this by merging stdout/stderr in these cases once again. + +Signed-off-by: Helge Deller +Signed-off-by: Chris Hofstaedtler +Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=961639 +Fixes: cbf858aa085e25aa5afd1d06decaea6e14a8963f +--- + tests/ts/misc/setarch | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/ts/misc/setarch b/tests/ts/misc/setarch +index 7c99cca..6c872bf 100755 +--- a/tests/ts/misc/setarch ++++ b/tests/ts/misc/setarch +@@ -45,22 +45,22 @@ ts_init_subtest uname26 + finmsg="" # for debugging 2.6 issues + + echo "###### --uname-2.6 echo" >>$TS_OUTPUT +-$TS_CMD_SETARCH $ARCH -v --uname-2.6 echo "2.6 worked" >> $TS_OUTPUT 2>> $TS_ERRLOG ++$TS_CMD_SETARCH $ARCH -v --uname-2.6 echo "2.6 worked" >> $TS_OUTPUT 2>&1 + if [ $? -eq 0 ]; then + expected='^2.6 worked$' + else +- # this may happen after execvp ++ # this may happen after execvp - gets written to stderr + expected="^FATAL: kernel too old$" + finmsg+=" echo" + fi + sed -i "$ s/$expected/2.6 works or kernel too old/" $TS_OUTPUT + + echo "###### --uname-2.6 true, non-verbose" >>$TS_OUTPUT +-$TS_CMD_SETARCH $ARCH --uname-2.6 true >> $TS_OUTPUT 2>> $TS_ERRLOG ++$TS_CMD_SETARCH $ARCH --uname-2.6 true >> $TS_OUTPUT 2>&1 + if [ $? -eq 0 ]; then + echo "2.6 works or kernel too old" >> $TS_OUTPUT + else +- # this may happen after execvp ++ # this may happen after execvp - gets written to stderr + expected="^FATAL: kernel too old$" + sed -i "$ s/$expected/2.6 works or kernel too old/" $TS_OUTPUT + finmsg+=" true" +-- +1.8.3.1 + diff --git a/util-linux.spec b/util-linux.spec index 557ba59..e7bc5cb 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,7 +2,7 @@ Name: util-linux Version: 2.35.2 -Release: 1 +Release: 2 Summary: A random collection of Linux utilities License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git @@ -39,6 +39,7 @@ Patch1: libmount-move-already-mounted-code-to-separate-funct.patch Patch2: libmount-try-read-only-mount-on-write-protected-supe.patch Patch3: libmount-parser-fix-memory-leak-on-error-before-end-.patch Patch4: tests-Fix-mountpoint-test-failure-in-build-chroots.patch +Patch5: setarch-fix-stderr-handling-in-uname26-tests.patch %description The util-linux package contains a random collection of files that @@ -383,6 +384,9 @@ fi %{_mandir}/man8/{swapoff.8*,swapon.8*,switch_root.8*,umount.8*,wdctl.8.gz,wipefs.8*,zramctl.8*} %changelog +* Tue Nov 24 2020 panxiaohe - 2.35.2-2 +- setarch: fix stderr handling in uname26 tests + * Wed Jul 29 2020 fangxiuning - 2.35.2-1 - Update version to 2.35.2 -- Gitee