bug#60708: pcre: improve support for linking with a library without unicode

2023-01-12 Thread Paul Eggert
On 2023-01-12 21:54, Carlo Arenas wrote: On Thu, Jan 12, 2023 at 7:38 PM Paul Eggert wrote: Fair enough, this will likely need a new test though, and of course changes to the current ones as well. Right now they will report that grep doesn't have '-P' support instead of reporting that unicod

bug#60708: pcre: improve support for linking with a library without unicode

2023-01-12 Thread Carlo Arenas
On Thu, Jan 12, 2023 at 7:38 PM Paul Eggert wrote: > > Without the attached patch, in a > UTF-8 locale "grep -P '[[:alpha:]]'" won't report matching alphabetic > characters, if they're multibyte. Silent misbehavior is quite bad, and > it's better for grep to issue a diagnostic and exit than to sil

bug#60708: pcre: improve support for linking with a library without unicode

2023-01-12 Thread Paul Eggert
On 1/11/23 20:03, Carlo Arenas wrote: Your suggested code doesn't address that, it merely changes the error message with one that would be IMHO even less clear and worsens the problem. In that case let's improve the error message wording; something like the attached patch, say. Using a non

bug#60708: pcre: improve support for linking with a library without unicode

2023-01-11 Thread Carlo Arenas
On Wed, Jan 11, 2023 at 6:29 PM Paul Eggert wrote: > > Oh, I think see your point, but doesn't this mean that even my code was > too trusting? It should be something like this: > >if (localeinfo.multibyte) > { >uint32_t unicode; >if (! (localeinfo.using_utf8 >

bug#60708: pcre: improve support for linking with a library without unicode

2023-01-11 Thread Paul Eggert
On 1/11/23 14:12, Carlo Arenas wrote: pcre2_config does a static check (defined at compile time) and therefore is unlikely to fail and might be even under the right circumstances optimized out. Not sure what is meant by "static check" here. The call won't be optimized out unless you compile wi

bug#60708: pcre: improve support for linking with a library without unicode

2023-01-11 Thread Carlo Arenas
pcre2_config does a static check (defined at compile time) and therefore is unlikely to fail and might be even under the right circumstances optimized out. you are correct that setting the original value was meant to protect from that function failing and will ensure the original path was still be

bug#60708: pcre: improve support for linking with a library without unicode

2023-01-11 Thread Paul Eggert
On 2023-01-10 21:37, Jim Meyering wrote: + uint32_t unicode = 1; + pcre2_config (PCRE2_CONFIG_UNICODE, &unicode); + if (unicode && localeinfo.multibyte) Shouldn't that be: uint32_t unicode; if (localeinfo.multibyte && 0 <= pcre2_config (PCRE2_CONFIG_UNICODE, &unicode) && un

bug#60708: pcre: improve support for linking with a library without unicode

2023-01-10 Thread Jim Meyering
On Tue, Jan 10, 2023 at 3:19 AM Carlo Arenas wrote: > Noticed while testing the previous patch, and which resulted in tests > being skipped for the wrong reason. Thanks for catching that. I'll push the following tomorrow. It has a tiny change that moves the declaration of "unicode" down to just b

bug#60708: pcre: improve support for linking with a library without unicode

2023-01-10 Thread Carlo Arenas
Noticed while testing the previous patch, and which resulted in tests being skipped for the wrong reason. Carlo 0001-pcre-only-use-UTF-when-available-in-the-library.patch Description: Binary data