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
Jeff King <peff@peff.net>
Date
Dec 15, 2011, 00:25 UTC
Message-ID
<20111215002530.GA2566@sigill.intra.peff.net>
In-Reply-To
<20111214233119.GA2354@elie>
On Wed, Dec 14, 2011 at 05:31:19PM -0600, Jonathan Nieder wrote:
Show 11 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.

I'd rather have something deterministic. If you really want to be mean to accidental readers of stdin, then put binary junk into stdin-garbage (even the results of a single run of /dev/urandom, if you like). But I suspect arbitrary text is good enough to throw a monkey wrench into anything that will care about its input (and those that don't are beyond our ability to auto-detect anyway[1]). And it's way easier to debug than seeing random binary bits.

-Peff

[1] Actually, you could abandon the idea of feeding garbage altogether, and instead open the descriptor outside the test, then check that its offset is still 0 after the test. You'd have to use a helper program to do the ftell(), but it should work as the descriptor position will be shared.

Previous: Jonathan NiederNext: Jeff King
Message 8 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.