This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Fix nptl/tst-cancel7 for non-bash shells
- From: "Joseph S. Myers" <joseph at codesourcery dot com>
- To: <libc-alpha at sourceware dot org>
- Date: Thu, 25 Oct 2012 20:48:33 +0000
- Subject: Fix nptl/tst-cancel7 for non-bash shells
This patch, again something that was entangled in the first version of
the cross-testing changes I sent but then separated out because it
didn't belong there, fixes an issue with nptl/tst-cancel7 when /bin/sh
isn't bash. To quote Aurelien's explanation from 2009:
tst-cancel7 tests that system() is cancellable. system() invokes
/bin/sh (and this is hard-coded, not changeable via any environment
variable). When doing /bin/bash -c "/bin/echo foo", bash is clever
enough to invoke /bin/echo with execve() without forking. When
system() kills the it kills the intended subprocess. But dash forks
a further subprocess and waits, so system() just kills dash, not
dash's subprocess. Prefixing the command with "exec" ensure that the
used shell does not fork.
Tested x86_64.
2012-10-25 Aurelien Jarno <aurelien@aurel32.net>
Joseph Myers <joseph@codesourcery.com>
* Makefile (tst-cancel7-ARGS): Use exec in --command argument.
diff --git a/nptl/Makefile b/nptl/Makefile
index f84646e..54d8cc6 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -435,7 +435,7 @@ CFLAGS-tst-initializers1-c99.c = $(CFLAGS-tst-initializers1-<)
CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<)
CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<)
-tst-cancel7-ARGS = --command "$(host-built-program-cmd)"
+tst-cancel7-ARGS = --command "exec $(host-built-program-cmd)"
tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
tst-umask1-ARGS = $(objpfx)tst-umask1.temp
--
Joseph S. Myers
joseph@codesourcery.com