Re: [PATCH] Portability: returning void
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Mar 30, 2011, 00:29 UTC
- Message-ID
- <20110330002921.GC14578@elie>
- In-Reply-To
- <20110330001653.GA1161@sigill.intra.peff.net>
(-cc: Michael, to stop spamming a kind bug reporter :)) Jeff King wrote:
> On Tue, Mar 29, 2011 at 06:49:55PM -0500, Jonathan Nieder wrote:
Show 16 quoted lines
>> | 19424 18:31:25 <... nanosleep resumed> NULL) = 0 >> | 19424 18:31:25 close(1) = 0 >> | 19424 18:31:25 close(2) = 0 >> | 19424 18:31:25 exit_group(0) = ? >> | 19422 18:31:25 <... wait4 resumed> 0x7fff65d1ee6c, 0, NULL) = ? ERESTARTSYS (To be restarted) >> | 19422 18:31:25 --- SIGTERM (Terminated) @ 0 (0) --- >> >> The first sleep wakes up and dies. The corresponding subshell >> wakes up, reaps the child, and finally accepts SIGTERM. > > Hrm. That's different than what happens on my system. On my system, the > bash process is _already_ dead during the whole procedure, and it is > just the stray sleeps that keep prove waiting. > > Maybe different bash versions? Mine is 4.1.5(1) (from debian unstable, > bash_4.1-3).
$ dpkg-query -W perl bash bash 4.1-3 perl 5.10.1-18
Same version here, but I had modified the test a little. *tries the stock version again* Same behavior still. FWIW I am using the patch below[1] and invoking the tests as
strace -f -o trace.out prove --exec=bash -v t0081-line-buffer.sh :: -v -i
> Did you try my 5>/dev/null patch? With it, I get no hang at all.
Haven't tried it yet but will try.
I really don't like that as a long-term solution. Yes, it gets prove to stop hanging, but meanwhile we have no control over the child processes we have spawned. I'd rather just drop the tests. ---
diff --git a/t/t0081-line-buffer.sh b/t/t0081-line-buffer.sh index 1dbe1c9..054bffa 100755 --- a/t/t0081-line-buffer.sh +++ b/t/t0081-line-buffer.sh @@ -49,13 +49,14 @@ long_read_test () { { { generate_tens_of_lines $tens_of_lines "$line" && - sleep 100 + sleep 15 } >input & } && test-line-buffer input <<-EOF >output && binary $readsize copy $copysize EOF + pstree -p $! && kill $! && test_line_count = $lines output && tail -n 1 <output >actual && @@ -84,12 +85,13 @@ test_expect_success PIPE '0-length read, no input available' ' rm -f input && mkfifo input && { - sleep 100 >input & + sleep 15 >input & } && test-line-buffer input <<-\EOF >actual && binary 0 copy 0 EOF + pstree -p $! && kill $! && test_cmp expect actual ' @@ -112,13 +114,14 @@ test_expect_success PIPE '1-byte read, no input available' ' { printf "%s" a && printf "%s" b && - sleep 100 + sleep 15 } >input & } && test-line-buffer input <<-\EOF >actual && binary 1 copy 1 EOF + pstree -p $! && kill $! && test_cmp expect actual '