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

Re: Test failures with GNU grep 2.23

From
Jeff King <peff@peff.net>
Date
Feb 19, 2016, 11:59 UTC
Message-ID
<20160219115928.GA10204@sigill.intra.peff.net>
In-Reply-To
<20160207162540.GK29880@serenity.lan>
On Sun, Feb 07, 2016 at 04:25:40PM +0000, John Keeping wrote:
> It seems that binary file detection has changed in GNU grep 2.23 as a
> result of commit 40ed879 (grep: fix bug with with invalid unibyte
> sequence).

I read this bug report a while ago when you posted it, but happily ignored it until today, when my debian unstable system pulled in the new version of grep. :)

Show 10 quoted lines
> This causes a couple of test failures in t8005 and t9200 (the t9200 case
> is less obvious so I'm only including t8005 here):
> 
> -- >8 --
> $ ./t8005-blame-i18n.sh -v -i
> [snip]
> expecting success: 
>         git blame --incremental file | \
>                 egrep "^(author|summary) " > actual &&
>         test_cmp actual expected
Just a side note while we are touching these tests:
 - we probably should not pipe, so we check the exist code from
   git-blame
 - we usually flip the test_cmp file order, to show the difference from
   expectation when there is a failure
 - no space after ">" redirection :)
Show 8 quoted lines
> The following patch fixes the tests for me, but I wonder if "-a" is
> supported on all target platforms (it's not in POSIX, which specifies
> that the "input files shall be text files") or whether we should do
> something more comprehensive to provide sane_{e,f,}grep which guarantee
> to treat input as text.
> 
> I also tried setting POSIXLY_CORRECT but that doesn't affect the
> text/binary decision.

Yeah, I'd worry that "-a" is not portable. OTOH, BSD grep seems to have it, so between that and GNU, I think most systems are covered. We could do:

  test_lazy_prereq GREP_A '
	echo foo | grep -a foo
  '

and mark these tests with it. I'd also be happy to skip that step and just do it if and when somebody actually complains about a system without it (I wouldn't be surprised if most people on antique systems end up installing GNU grep anyway).

Another option might be using "sed -ne '/^author/p'" or similar. But that may very well just be trading one portability problem for another.

I also wondered whether we could get away without grepping at all here. But the blame output has a bunch of cruft we don't care about; I think the readability of the tests would suffer if we tried to match the whole thing in a test_cmp.

-Peff
Previous: John KeepingNext: Eric Sunshine
Message 2 of 27 in “Test failures with GNU grep 2.23”
  1. John KeepingFeb 7, 2016
  2. Jeff KingFeb 19, 2016
  3. Eric SunshineFeb 19, 2016
  4. Junio C HamanoFeb 19, 2016
  5. Jeff KingFeb 19, 2016
  6. John KeepingFeb 19, 2016
  7. Jeff KingFeb 19, 2016
  8. 0/2 Fix test failures with GNU grep 2.23John Keeping, Feb 21, 2016
  9. 1/2 t8005: avoid grep on non-ASCII dataJohn Keeping, Feb 21, 2016
  10. Eric SunshineFeb 21, 2016
  11. Jeff KingFeb 21, 2016
  12. Eric SunshineFeb 21, 2016
  13. Jeff KingFeb 21, 2016
  14. John KeepingFeb 21, 2016
  15. Eric SunshineFeb 21, 2016
  16. Jeff KingFeb 22, 2016
  17. Junio C HamanoFeb 22, 2016
  18. Junio C HamanoFeb 23, 2016
  19. John KeepingFeb 24, 2016
  20. Junio C HamanoFeb 21, 2016
  21. Eric SunshineFeb 21, 2016
  22. 2/2 t9200: avoid grep on non-ASCII dataJohn Keeping, Feb 21, 2016
  23. Eric SunshineFeb 21, 2016
  24. John KeepingFeb 21, 2016
  25. Eric SunshineFeb 22, 2016
  26. Jeff KingFeb 22, 2016
  27. Junio C HamanoFeb 23, 2016

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.