[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] [PATCH] Fix a two bashisms in the testsuite



Hi,

The patch below fixes two bashims. This kind of patch is refused in
GLIBC, but I hope they are welcome in EGLIBC.

The first one is a bit tricky and needs some explanations. 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.

With this patch, it is possible to run the testsuite without additional
error with SHELL still forced to /bin/bash, but with /bin/sh != bash.

Regards,
Aurelien


2009-02-14  Aurelien Jarno  <aurelien@xxxxxxxxxxx>

	* nptl/Makefile: Use exec shell command in tst-cancel7 to prevent
	the shell forking. Fix a bashism in the call to tst-cleanup0.

Index: nptl/Makefile
===================================================================
--- nptl/Makefile	(revision 8009)
+++ nptl/Makefile	(working copy)
@@ -447,7 +447,7 @@
 CFLAGS-tst-initializers1-gnu89.c = $(CFLAGS-tst-initializers1-<)
 CFLAGS-tst-initializers1-gnu99.c = $(CFLAGS-tst-initializers1-<)
 
-tst-cancel7-ARGS = --command "$(local-built-program-cmd)"
+tst-cancel7-ARGS = --command "exec $(local-built-program-cmd)"
 tst-cancelx7-ARGS = $(tst-cancel7-ARGS)
 tst-umask1-ARGS = $(objpfx)tst-umask1.temp
 
@@ -559,7 +559,7 @@
 		$(patsubst -f%,-fno-%,$(exceptions)) -o $@
 
 $(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
-	$(make-test-out) 2>&1 | cmp - tst-cleanup0.expect >& $@
+	$(make-test-out) 2>&1 | cmp - tst-cleanup0.expect > $@ 2>&1
 
 # We only have one kind of startup code files.  Static binaries and
 # shared libraries are build using the PIC version.

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@xxxxxxxxxxx                 http://www.aurel32.net