Re: [PATCH v2 05/10] Make gnulib's regcomp not abort()
On 12/7/21 10:51, Robbie Harwood wrote: I don't believe we have an implementation of abort() that can be called. (We have grub_abort() instead.) If that's the correct reason, then DEBUG_ASSERT would work and I can make that change. Looking into the code a bit more, it looks like a DEBUG_ASSERT would not be appropriate at least for the first 'abort ()' since the code is trying to make glibc regerror more user- and debugger-friendly, and using DEBUG_ASSERT would make it less friendly. Can you compile regexec.c with -Dabort=gnu_abort instead?
Re: [PATCH v2 05/10] Make gnulib's regcomp not abort()
Paul Eggert writes: > On 12/1/21 19:20, Paul Eggert wrote: >> On 12/1/21 13:02, Robbie Harwood wrote: >>> @@ -1099,7 +1099,7 @@ optimize_utf8 (re_dfa_t *dfa) >>> } >>> break; >>> default: >>> - abort (); >>> + break; >>> } >> >> Likewise, it's not clear why this change is needed. The 'abort' should >> not be reachable. >> >> Is the intent to make the code a bit smaller by avoding calls to 'abort'? > > A followup idea: would it help to replace 'abort ()' with 'DEBUG_ASSERT > (false)', or to replace 'if (!X) abort ();' with 'DEBUG_ASSERT (X);'? Unfortunately Vladimir has not so far been responding to gnulib emails, However, I don't believe we have an implementation of abort() that can be called. (We have grub_abort() instead.) If that's the correct reason, then DEBUG_ASSERT would work and I can make that change. Be well, --Robbie signature.asc Description: PGP signature
Re: [PATCH v2 05/10] Make gnulib's regcomp not abort()
On 12/1/21 19:20, Paul Eggert wrote: On 12/1/21 13:02, Robbie Harwood wrote: @@ -1099,7 +1099,7 @@ optimize_utf8 (re_dfa_t *dfa) } break; default: - abort (); + break; } Likewise, it's not clear why this change is needed. The 'abort' should not be reachable. Is the intent to make the code a bit smaller by avoding calls to 'abort'? A followup idea: would it help to replace 'abort ()' with 'DEBUG_ASSERT (false)', or to replace 'if (!X) abort ();' with 'DEBUG_ASSERT (X);'?
Re: [PATCH v2 05/10] Make gnulib's regcomp not abort()
On 12/1/21 13:02, Robbie Harwood wrote: @@ -1099,7 +1099,7 @@ optimize_utf8 (re_dfa_t *dfa) } break; default: - abort (); + break; } Likewise, it's not clear why this change is needed. The 'abort' should not be reachable. Is the intent to make the code a bit smaller by avoding calls to 'abort'?
Re: [PATCH v2 05/10] Make gnulib's regcomp not abort()
It's not clear why this change is needed. POSIX says that for regerror "the application shall ensure is the last non-zero value returned by regcomp() or regexec() with the given value of preg". If an application violates a "shall" requirement, behavior is undefined so it's OK for regerror to abort in that case.