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

Re: Test failures when Git is built with libpcre and grep is built without it

From
Jeff King <peff@peff.net>
Date
Jan 9, 2017, 11:27 UTC
Message-ID
<20170109112706.zezc2kt44u3652jm@sigill.intra.peff.net>
In-Reply-To
<58736B2A.40003@adelielinux.org>
On Mon, Jan 09, 2017 at 04:51:22AM -0600, A. Wilcox wrote:
Show 17 quoted lines
> Interestingly enough, you seem to be right.  The failure is very
> bizarre and has nothing to do with system /bin/grep:
> 
> test_must_fail: command succeeded: git grep -G -F -P -E a\x{2b}b\x{2a}c ab
> not ok 142 - grep -G -F -P -E pattern
> #
> #               >empty &&
> #               test_must_fail git grep -G -F -P -E "a\x{2b}b\x{2a}c"
> ab >actual &&
> #               test_cmp empty actual
> #
> 
> However:
> 
> elaine trash directory.t7810-grep # git grep -G -F -P -E
> a\x{2b}b\x{2a}c ab >actual
> fatal: command line, 'ax{2b}bx{2a}c': Invalid contents of {}

Hrm, it looks like your shell eats the backslashes in a double-quoted string.

What does:
  printf '%s\n' "a\x{2b}b\x{2a}c"
show?

I'm not sure if that's related or not. And as you said your shell is bash, that seems weird. Lots of other people run bash, and we haven't gotten a report (and your version isn't bleeding edge).

That said, the "invalid contents" error message is expected. What's confusing is that the command returned success. The error comes from compile_regexp(), which sees that regcomp() failed. It calls compile_regexp_failed(), which calls die(), which should end in exit(128). But the shell sees the exit code as 0. Weird.

Your example run after shows that the correct exit code comes out of git. What does:

  ./t7810-grep.sh -x --verbose-only=142
say? That should enable "set -x" in the shell just for that test.
-Peff
PS In my repo, the test that is failing for you is actually 145. Are you
   trying with a version of git older than v2.7.x? If so, you might
   double-check that the problem persists on the latest "master". I
   don't know of any particular fixes, but it's worth a shot.
-Peff
Previous: A. WilcoxNext: Andreas Schwab
Message 5 of 12 in “Test failures when Git is built with libpcre and grep is built without it”
  1. A. WilcoxJan 1, 2017
  2. Torsten BögershausenJan 1, 2017
  3. Jeff KingJan 2, 2017
  4. A. WilcoxJan 9, 2017
  5. Jeff KingJan 9, 2017
  6. Andreas SchwabJan 9, 2017
  7. Jeff KingJan 9, 2017
  8. A. WilcoxJan 10, 2017
  9. Szabolcs NagyJan 10, 2017
  10. Jeff KingJan 11, 2017
  11. t7810: avoid assumption about invalid regex syntaxJeff King, Jan 11, 2017
  12. Junio C HamanoJan 11, 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.