git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anders Kaseorg <andersk@MIT.EDU>
To: Junio C Hamano <gitster@pobox.com>
Cc: David Barr <david.barr@cordelta.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	git@vger.kernel.org, Anders Kaseorg <andersk@mit.edu>
Subject: [PATCH] t9010: Open backflow FIFO once to work around kernel race condition
Date: Tue, 26 Jun 2012 18:30:06 -0400	[thread overview]
Message-ID: <1340749806-22734-1-git-send-email-andersk@mit.edu> (raw)

Linux’s implementation of open() on FIFOs suffers from a race
condition (see http://marc.info/?l=linux-kernel&m=134071285509470 )
that causes t9010-svn-fe.sh to occasionally fail with
  t9010-svn-fe.sh: 27: eval: cannot create backflow: Interrupted system call
Although I can’t reproduce this locally, it happens particularly often
on the Launchpad PPA builders.

Sidestep this problem by opening the backflow FIFO once for
read+write.  Also, replace the stream FIFO with a shell pipe so we
don’t have to do manual process management.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
---
 t/t9010-svn-fe.sh | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/t/t9010-svn-fe.sh b/t/t9010-svn-fe.sh
index b7eed24..c52a7de 100755
--- a/t/t9010-svn-fe.sh
+++ b/t/t9010-svn-fe.sh
@@ -11,9 +11,9 @@ reinit_git () {
 		return 127
 	fi
 	rm -fr .git &&
-	rm -f stream backflow &&
+	rm -f backflow &&
 	git init &&
-	mkfifo stream backflow
+	mkfifo backflow
 }
 
 try_dump () {
@@ -22,10 +22,9 @@ try_dump () {
 	maybe_fail_fi=${3:+test_$3} &&
 
 	{
-		$maybe_fail_svnfe test-svn-fe "$input" >stream 3<backflow &
-	} &&
-	$maybe_fail_fi git fast-import --cat-blob-fd=3 <stream 3>backflow &&
-	wait $!
+		$maybe_fail_svnfe test-svn-fe "$input" |
+		$maybe_fail_fi git fast-import --cat-blob-fd=3
+	} 3<>backflow
 }
 
 properties () {
-- 
1.7.11.1

             reply	other threads:[~2012-06-26 22:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26 22:30 Anders Kaseorg [this message]
2012-06-26 22:40 ` [PATCH] t9010: Open backflow FIFO once to work around kernel race condition Jonathan Nieder
2012-06-26 22:46   ` Anders Kaseorg
2012-06-26 22:58   ` Junio C Hamano
2012-06-26 23:08   ` Stefano Lattarini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1340749806-22734-1-git-send-email-andersk@mit.edu \
    --to=andersk@mit.edu \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).