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

Re: tr/pty-all (Re: What's cooking in git.git (Dec 2011, #04; Tue, 13))

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 14, 2011, 23:31 UTC
Message-ID
<20111214233119.GA2354@elie>
In-Reply-To
<20111214232151.GB13128@sigill.intra.peff.net>
Jeff King wrote:
[...]
Show 7 quoted lines
> 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
[...]
Show 6 quoted lines
> @@ -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

Previous: Jeff KingNext: Jeff King
Message 7 of 12 in “What's cooking in git.git (Dec 2011, #04; Tue, 13)”
  1. Junio C HamanoDec 14, 2011
  2. tr/pty-all (Re: What's cooking in git.git (Dec 2011, #04; Tue, 13))Jonathan Nieder, Dec 14, 2011
  3. Thomas RastDec 14, 2011
  4. Junio C HamanoDec 14, 2011
  5. Jeff KingDec 14, 2011
  6. Jeff KingDec 14, 2011
  7. Jonathan NiederDec 14, 2011
  8. Jeff KingDec 15, 2011
  9. Jeff KingDec 15, 2011
  10. Junio C HamanoDec 15, 2011
  11. Jeff KingDec 15, 2011
  12. Junio C HamanoDec 15, 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.