From 93a7e754a44c333140e75e93cac09f61320f7cc9 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 14 Dec 2016 15:47:21 -0500 Subject: [PATCH] tests/opr/softsig-t: Avoid hanging due to intermediate sh -c If the build directory happened to contain shell metacharacters, like the ~ in /build/openafs-vb8tid/openafs-1.8.0~pre1 used by the Debian builders, Perl was running softsig-helper via an intermediate sh -c, which would then intercept the signals we tried to send to softsig-helper. Use the list syntax to avoid this sh -c. Change-Id: I054b9c8f606e197accb414bfe3f89719255c62c4 Reviewed-on: https://gerrit.openafs.org/12488 Tested-by: BuildBot Reviewed-by: Benjamin Kaduk --- tests/opr/softsig-t | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/opr/softsig-t b/tests/opr/softsig-t index 89e66e5..533feb4 100755 --- a/tests/opr/softsig-t +++ b/tests/opr/softsig-t @@ -33,8 +33,14 @@ use FindBin qw($Bin); # Start up our test process, and send it various signals. Check that these # signals make it to it correctly, and are reported on the command line. my $softsig_helper = $Bin . "/softsig-helper"; -my $pid=open(HELPER, "$softsig_helper |") - or die "Couldn't start test helper."; + +# This -dummy argument prevents Perl from putting an intermediate sh +# -c between us and softsig-helper in the case where the build +# directory happens to contain shell metacharacters, like the ~ in +# /build/openafs-vb8tid/openafs-1.8.0~pre1 used by the Debian +# builders. +my $pid = open(HELPER, "-|", $softsig_helper, "-dummy") + or die "Couldn't start test helper."; # Wait for softsig to start up. is(, "Ready\n"); @@ -71,7 +77,7 @@ is($?, SIGKILL, "Helper exited on KILL signal."); # Check that an internal segmentation fault kills the process. -$pid = open(HELPER, "$softsig_helper -crash |") +$pid = open(HELPER, "-|", $softsig_helper, "-crash") or die "Couldn't start test helper."; close(HELPER); is($? & 0x7f, SIGSEGV, "Helper exited on SEGV signal."); @@ -84,7 +90,7 @@ SKIP: { skip("Skipping buserror test; SIGBUS constant is not defined.", 1) unless $sigbus; my ($fh, $path) = mkstemp("/tmp/softsig-t_XXXXXX"); - $pid = open(HELPER, "$softsig_helper -buserror $path |") + $pid = open(HELPER, "-|", $softsig_helper, "-buserror", $path) or die "Couldn't start test helper."; close(HELPER); is($? & 0x7f, $sigbus, "Helper exited on BUS signal."); -- 1.9.4