git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
 '
Previous: Jeff KingNext: Jeff King
Message 7 of 18 in “Portability: returning void”
  1. Portability: returning voidMichael Witten, Mar 29, 2011
  2. Jonathan NiederMar 29, 2011
  3. Jeff KingMar 29, 2011
  4. Jeff KingMar 29, 2011
  5. Jonathan NiederMar 29, 2011
  6. Jeff KingMar 30, 2011
  7. Jonathan NiederMar 30, 2011
  8. Jeff KingMar 30, 2011
  9. Jonathan NiederMar 30, 2011
  10. Jeff KingMar 30, 2011
  11. Johannes SixtMar 30, 2011
  12. tests: introduce helper to fill a pipe in the backgroundJonathan Nieder, Mar 30, 2011
  13. Jonathan NiederMar 30, 2011
  14. Jeff KingMar 30, 2011
  15. Jonathan NiederMar 30, 2011
  16. [PULL svn-fe] Re: Portability: returning voidJonathan Nieder, Mar 30, 2011
  17. Junio C HamanoMar 30, 2011
  18. Jonathan NiederMar 30, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.