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

Re: [RFC PATCH v2] grep: allow for run time disabling of JIT in PCRE

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 31, 2019, 12:32 UTC
Message-ID
<nycvar.QRO.7.76.6.1907311426290.21907@tvgsbejvaqbjf.bet>
In-Reply-To
<20190729105955.44390-1-carenas@gmail.com>
Hi,
On Mon, 29 Jul 2019, Carlo Marcelo Arenas Belón wrote:
>   $ git grep 'foo bar'
>   fatal: Couldn't JIT the PCRE2 pattern 'foo bar', got '-48'

My immediate reaction to this error message was: That's not helpful. What is `-48` supposed to mean? Why do we even think it sensible to throw such an error message at the end user? Can't we do a much better job translating that into something that makes actual sense without knowing implementation details?

But then, I realized that -48 must be a well-known constant in PCRE2, and my reaction transformed into something much more hopeful: why don't we detect the situation where the JIT'ed code was not actually executable [*1*], and fall back to the non-JIT'ed code path ourselves, without troubling the end user (maybe warning, but maybe better not lest we annoy the user with something pointless)?

Even after finding out that -48 disappointingly means PCRE2_ERROR_NOMEMORY (as opposed to something like PCRE2_ERROR_CANNOT_EXECUTE_JIT_CODE), I like the idea of not bothering end users and doing the sensible fallback under the hood.

Ciao, Dscho

Footnote *1*: Why anybody would think it sensible to build a PCRE2 with JIT on an OS that does not allow executing code that was written by the same process is beyond me. Or is there a mode in OpenBSD that *does* allow JIT'ed code to be executed?

Previous: Junio C HamanoNext: Ævar Arnfjörð Bjarmason
Message 17 of 23 in “grep: allow for run time disabling of JIT in PCRE”
  1. grep: allow for run time disabling of JIT in PCRECarlo Marcelo Arenas Belón, Jul 28, 2019
  2. Carlo ArenasJul 29, 2019
  3. Junio C HamanoJul 29, 2019
  4. Carlo ArenasJul 29, 2019
  5. Ævar Arnfjörð BjarmasonJul 29, 2019
  6. Carlo ArenasJul 29, 2019
  7. Ævar Arnfjörð BjarmasonJul 29, 2019
  8. Carlo ArenasJul 30, 2019
  9. grep: allow for run time disabling of JIT in PCRECarlo Marcelo Arenas Belón, Jul 29, 2019
  10. Carlo ArenasJul 29, 2019
  11. René ScharfeJul 29, 2019
  12. Junio C HamanoJul 29, 2019
  13. Carlo ArenasJul 30, 2019
  14. René ScharfeJul 30, 2019
  15. Johannes SchindelinJul 31, 2019
  16. Junio C HamanoJul 31, 2019
  17. Johannes SchindelinJul 31, 2019
  18. Ævar Arnfjörð BjarmasonJul 31, 2019
  19. Carlo ArenasAug 4, 2019
  20. grep: treat PCRE2 jit compilation memory error as non fatalCarlo Marcelo Arenas Belón, Aug 4, 2019
  21. Carlo ArenasAug 4, 2019
  22. Junio C HamanoAug 5, 2019
  23. Johannes SchindelinJul 31, 2019

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.