From: Jonathan Nieder Date: Wed, 14 Dec 2011 23:31:19 GMT Subject: Re: tr/pty-all (Re: What's cooking in git.git (Dec 2011, #04; Tue, 13)) Message-ID: <20111214233119.GA2354@elie> In-Reply-To: <20111214232151.GB13128@sigill.intra.peff.net> Jeff King wrote: [...] > A test which accidentally reads stdin would soak up all of > the rest of the input intended for the outer shell loop. > > Let's redirect stdin from a known source to eliminate > variation. We could just connect it to /dev/null. However, > tests which accidentally read stdin would then see immediate > EOF, which may or may not cause them to notice the errror. [...] > +++ b/t/test-lib.sh [...] > @@ -469,7 +471,7 @@ test_debug () { > test_eval_ () { > # This is a separate function because some tests use > # "return" to end a test_expect_success block early. > - eval >&3 2>&4 "$*" > + eval <"$TEST_DIRECTORY/stdin-garbage" >&3 2>&4 "$*" How about /dev/urandom on platforms that support it? It wouldn't be as pleasant to debug as "This is a magic stdin garbage stream", but it would be more likely to (despite the name :)) predictably trip errors, or at least hangs, in problematic tests. With or without something along those lines on top, your patch looks like a good change. Thanks for a thoughtful analysis. Jonathan