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

Re: [PATCH] t4210: detect REG_ILLSEQ dynamically

From
Carlo Marcelo Arenas Belón <carenas@gmail.com>
Date
May 13, 2020, 21:04 UTC
Message-ID
<20200513210433.GA38566@Carlos-MBP>
In-Reply-To
<xmqqsgg3sh9v.fsf@gitster.c.googlers.com>
On Wed, May 13, 2020 at 01:37:32PM -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Carlo Marcelo Arenas Belón <carenas@gmail.com> writes:
> 
> > indeed, I would rather go away with the whole prereq and set a variable
> > with a nice sounding name and use it below to `if test` the right tests,
> > would that be ok?
> 
> In a sense, a prerequisite is an overkill if the tests that need to
> be guarded are very well isolated and in a single place.  Do we
> expect other tests outside the context of this script may have to be
> guarded by REG_ILLSEQ?

IMHO in the long term we probably should get rid of those tests (including the need to look for REG_ILLSEQ), because the root cause of this failure is that the test is really relying in undefined behaviour which happen to be common to both glibc and our own compat regex, but that was relevant at that time, because of a bug on the way UTF-8 was being detected.

POSIX regcomp[1], specifically mentions that returned and error is a valid response to a badly encoded pattern, but the test cases were created to specifically ensure no error is ever generated, and to make sure the response (which is undefined, as per POSIX) was consistent for all engines:

"The regcomp() and regexec() functions are required to accept any null-terminated string as the pattern argument. If the meaning of the string is "undefined", the behavior of the function is "unspecified". IEEE Std 1003.1-2001 does not specify how the functions will interpret the pattern; they might return error codes, or they might do pattern matching in some completely unexpected way, but they should not do something like abort the process."
Carlo
[1] https://pubs.opengroup.org/onlinepubs/009695399/functions/regcomp.html
Previous: Junio C HamanoNext: Carlo Marcelo Arenas Belón
Message 6 of 17 in “t4210: detect REG_ILLSEQ dynamically”
  1. t4210: detect REG_ILLSEQ dynamicallyCarlo Marcelo Arenas Belón, May 13, 2020
  2. Eric SunshineMay 13, 2020
  3. Junio C HamanoMay 13, 2020
  4. Carlo Marcelo Arenas BelónMay 13, 2020
  5. Junio C HamanoMay 13, 2020
  6. Carlo Marcelo Arenas BelónMay 13, 2020
  7. t4210: detect REG_ILLSEQ dynamicallyCarlo Marcelo Arenas Belón, May 13, 2020
  8. Eric SunshineMay 13, 2020
  9. Junio C HamanoMay 15, 2020
  10. Carlo Marcelo Arenas BelónMay 15, 2020
  11. t4210: detect REG_ILLSEQ dynamicallyCarlo Marcelo Arenas Belón, May 15, 2020
  12. Junio C HamanoMay 15, 2020
  13. Junio C HamanoMay 15, 2020
  14. 0/2 auto detect REG_ILLSEQCarlo Marcelo Arenas Belón, May 18, 2020
  15. 1/2 t/helper: teach test-regex to report pattern errors (like REG_ILLSEQ)Carlo Marcelo Arenas Belón, May 18, 2020
  16. Junio C HamanoMay 18, 2020
  17. 2/2 t4210: detect REG_ILLSEQ dynamically and skip affected testsCarlo Marcelo Arenas Belón, May 18, 2020

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.