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, 21:33 UTC
Message-ID
<20170109213303.4rupe5cqwejfp6af@sigill.intra.peff.net>
In-Reply-To
<871swcjsd3.fsf@linux-m68k.org>
On Mon, Jan 09, 2017 at 02:05:44PM +0100, Andreas Schwab wrote:
Show 21 quoted lines
> On Jan 09 2017, "A. Wilcox" <awilfox@adelielinux.org> wrote:
> 
> > 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
> 
> You need to quote the regexp argument, see the line starting with
> "test_must_fail" above.

Oh, duh. I checked that the line in the test was quoted, and didn't notice that only the unquoted version he ran later complained. Thanks for noticing, as that explains the mystery, I think.

The problem is that we are expecting the regex "\x{2b}" to complain in regcomp() (as an ERE), but it doesn't. And that probably _is_ related to musl, which is providing the libc regex (I know this looks like a pcre test, but it's checking that "-P -E" overrides the pcre option with "-E").

I'm not sure if musl is wrong for failing to complain about a bogus regex. Generally making something that would break into something that works is an OK way to extend the standard. So our test is at fault for assuming that the regex will fail. I guess we'd need to find some more exotic syntax that pcre supports, but that ERE doesn't. Maybe "(?:)" or something.

-Peff
Previous: Andreas SchwabNext: A. Wilcox
Message 7 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.