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

Re: [RFC] column: show auto columns when pager is active

From
Jeff King <peff@peff.net>
Date
Oct 10, 2017, 14:29 UTC
Message-ID
<20171010142930.vao2nqg4pv7f2znk@sigill.intra.peff.net>
In-Reply-To
<20171010141019.3vfowj4fvxdvvl3c@sigill.intra.peff.net>
On Tue, Oct 10, 2017 at 10:10:19AM -0400, Jeff King wrote:
Show 7 quoted lines
> That said, I'm still puzzled why it would return zero output. Strace
> shows that the read from stdin is getting no input. I suspect this may
> have to do with how we redirect stdin in test-terminal.perl.
> 
> See 18d8c26930 (test_terminal: redirect child process' stdin to a pty,
> 2015-08-04), which claims there's some raciness with closing the
> descriptor.
Ah, yeah, I think that is it. Try:
  echo input | test_terminal sed s/^/foo:/

it will randomly succeed or fail, depending on whether sed manages to read the input before the stdin terminal is closed.

I'm not sure of an easy way to fix test-terminal, but we could work around it like this (which also uses "-p" to actually invoke the pager, and uses a pager that makes it clear when it's being run):

diff --git a/t/t9002-column.sh b/t/t9002-column.sh
index 9441145bf0..d322c3b745 100755
--- a/t/t9002-column.sh
+++ b/t/t9002-column.sh
@@ -180,14 +180,14 @@ EOF
 
 test_expect_success TTY '20 columns, mode auto, pager' '
 	cat >expected <<\EOF &&
-one    seven
-two    eight
-three  nine
-four   ten
-five   eleven
-six
+paged:one    seven
+paged:two    eight
+paged:three  nine
+paged:four   ten
+paged:five   eleven
+paged:six
 EOF
-	test_terminal env PAGER="cat|cat" git column --mode=auto <lista >actual &&
+	test_terminal env PAGER="sed s/^/paged:/" sh -c "git -p column --mode=auto <lista" >actual &&
 	test_cmp expected actual
 '
 test_done

All that said, I think I'd just as soon test a real command like "git
tag", which doesn't care about reading from stdin.

-Peff
Previous: Jeff KingNext: Martin Ågren
Message 9 of 21 in “[RFC] column: show auto columns when pager is active”
  1. Kevin DaudtOct 9, 2017
  2. Eric SunshineOct 9, 2017
  3. Martin ÅgrenOct 10, 2017
  4. Jeff KingOct 10, 2017
  5. Martin ÅgrenOct 10, 2017
  6. Kevin DaudtOct 11, 2017
  7. Jeff KingOct 12, 2017
  8. Jeff KingOct 10, 2017
  9. Jeff KingOct 10, 2017
  10. Martin ÅgrenOct 10, 2017
  11. Kevin DaudtOct 10, 2017
  12. column: show auto columns when pager is activeKevin Daudt, Oct 11, 2017
  13. Martin ÅgrenOct 11, 2017
  14. Kevin DaudtOct 11, 2017
  15. Martin ÅgrenOct 11, 2017
  16. column: show auto columns when pager is activeKevin Daudt, Oct 16, 2017
  17. Junio C HamanoOct 17, 2017
  18. Jonathan NiederOct 23, 2017
  19. Junio C HamanoOct 24, 2017
  20. Jonathan NiederOct 24, 2017
  21. Kevin DaudtOct 24, 2017

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.