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

Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 16, 2010, 21:19 UTC
Message-ID
<AANLkTim4iI-MMkSCEU6ln9wrlC_X1GvfMHM5Qij3P591@mail.gmail.com>
In-Reply-To
<20100716210609.GA23044@burratino>
On Fri, Jul 16, 2010 at 21:06, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 27 quoted lines
> Ævar Arnfjörð Bjarmason wrote:
>
>> The failure is totally predicated on whether or not REG_STARTEND is
>> available on the system
> [...]
>> Then you could do:
>>
>>     test_expect_success REG_STARTEND 'git grep ile a' '
>>         git grep ile a
>>     '
>
> Sorry to harp on this, but no, that would not be right.  When
> REG_STARTEND is not available on a system, this is still a bug and
> we still want to know when it is fixed.  The test should not be
> skipped.
>
> So one could do:
>
>  if have_reg_startend
>  then
>        expectation=success
>  else
>        expectation=failure
>  fi
>  test_expect_$expectation 'git grep ile a' '
>        git grep ile a
>  '

Well, the assumption I was making that we would do something in the make or ./configure process to set NO_REGEX=YesPlease if we found that the system didn't support REG_STARTEND, and fail loudly if that requirenment wasn't met.

However, what you posted above would be what we'd want if we wanted a soft requirement. Maybe that's what we want, I don't know :)

Show 7 quoted lines
>> The glibc one is probably pretty good as far as minimal POSIX DFA
>> engines go. Hopefully you can patch it up to get it to compile on
>> non-GNU systems.
>
> No promises, in particular because I don’t have any non-GNU
> installations handy to test on.  Probably gnulib’s copy will do,
> as Andreas suggested.
Probably, I didn't look closely at it.
Show 7 quoted lines
>> Regarding regular expression implementations. We might want to look
>> into bundling one implementation and using it everywhere
>
> Please no. :)
>
> If we can do better than glibc, then glibc should be improved (yes,
> I know GNU grep does much better than glibc already).

I think engines like GNU grep get some of their speed by not supporting some POSIX features. So it's not something you can completely solve at the libc level, since regcomp/regexec should only have POSIX semantics.

But I should find out if we need this before we discuss this any further, if it's a big performance win when e.g. grep-ing through the entire history of Linux it might be worth it.

>> Using NFA engines like that also gives you some performance guarantees
>
> Do you mean “using DFA engines”?  i.e. I thought GNU grep avoids
> backtracking by converting the NFA to a DFA, at least conceptually.

Yes, I always mix up my NFA and DFA at this time of night. I should just start writing whatever I think I don't mean, and that'll be what I mean :)

Previous: Jonathan NiederNext: Ævar Arnfjörð Bjarmason
Message 12 of 36 in “grep: Don't pass a TODO test if REG_STARTEND is supported”
  1. grep: Don't pass a TODO test if REG_STARTEND is supportedÆvar Arnfjörð Bjarmason, Jul 8, 2010
  2. Junio C HamanoJul 8, 2010
  3. Ævar Arnfjörð BjarmasonJul 8, 2010
  4. René ScharfeJul 8, 2010
  5. Ævar Arnfjörð BjarmasonJul 15, 2010
  6. Junio C HamanoJul 15, 2010
  7. Ævar Arnfjörð BjarmasonJul 15, 2010
  8. Ævar Arnfjörð BjarmasonJul 16, 2010
  9. Jonathan NiederJul 16, 2010
  10. Ævar Arnfjörð BjarmasonJul 16, 2010
  11. Jonathan NiederJul 16, 2010
  12. Ævar Arnfjörð BjarmasonJul 16, 2010
  13. Ævar Arnfjörð BjarmasonJul 16, 2010
  14. Andreas SchwabJul 16, 2010
  15. Ævar Arnfjörð BjarmasonAug 15, 2010
  16. Paolo BonziniAug 16, 2010
  17. 0/3 Update compat/regexÆvar Arnfjörð Bjarmason, Aug 17, 2010
  18. 2/3 compat/regex: hacks to get the gawk regex engine to compile within gitÆvar Arnfjörð Bjarmason, Aug 17, 2010
  19. Jonathan NiederAug 17, 2010
  20. 3/3 t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTENDÆvar Arnfjörð Bjarmason, Aug 17, 2010
  21. 0/3 Update compat/regexÆvar Arnfjörð Bjarmason, Aug 17, 2010
  22. Jonathan NiederAug 17, 2010
  23. 0/5 Update compat/regexÆvar Arnfjörð Bjarmason, Aug 17, 2010
  24. Paolo BonziniAug 17, 2010
  25. Junio C HamanoAug 17, 2010
  26. Jonathan NiederAug 17, 2010
  27. Ævar Arnfjörð BjarmasonAug 18, 2010
  28. 2/5 compat/regex: get the gawk regex engine to compile within gitÆvar Arnfjörð Bjarmason, Aug 17, 2010
  29. 3/5 Change regerror() declaration from K&R style to ANSI C (C89)Ævar Arnfjörð Bjarmason, Aug 17, 2010
  30. 4/5 t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTENDÆvar Arnfjörð Bjarmason, Aug 17, 2010
  31. 5/5 autoconf: don't use platform regex if it lacks REG_STARTENDÆvar Arnfjörð Bjarmason, Aug 17, 2010
  32. 2/3 compat/regex: get the gawk regex engine to compile within gitÆvar Arnfjörð Bjarmason, Aug 17, 2010
  33. 3/3 t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTENDÆvar Arnfjörð Bjarmason, Aug 17, 2010
  34. Jonathan NiederAug 17, 2010
  35. Ævar Arnfjörð BjarmasonAug 17, 2010
  36. Jonathan NiederAug 17, 2010

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.