[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dc*gettext call SIGABRT on macOs - version 0.22.5
From: |
Bruno Haible |
Subject: |
Re: dc*gettext call SIGABRT on macOs - version 0.22.5 |
Date: |
Wed, 28 Feb 2024 22:39:13 +0100 |
Hi,
David CARLIER wrote:
> Maybe it had been reported already and it might be only a specific macOs
> issue but a basic code like the following now triggers abort with 0.22.5
> whereas with the previous release it does not (note that s the homebrew
> package but looking at the build, it does not indicate doing something
> fancy neither)
>
> #include <libintl.h>
>
>
> int main(void)
>
> {
>
> dcgettext("", "", 0);
>
> return 0;
>
> }
>
>
> ./a.out
>
> zsh: abort ./a.out
The documentation [1] says about the third argument to dcgettext():
"The third argument of dcgettext allows to use another locale category
but LC_MESSAGES. ... If the domain_name is NULL or category has an
value beside the known ones, the result is undefined."
0 is LC_ALL on macOS. That's not a locale category, but rather a symbol
that denotes all locale categories. So it is invalid.
> here the backrace
>
> frame #2: 0x000000018b1c5a40 libsystem_c.dylib`abort + 180
>
> frame #3: 0x00000001004866e0 libintl.8.dylib`
> *_libintl_locale_name_thread_unsafe* + 108
>
> frame #4: 0x0000000100483aac libintl.8.dylib`libintl_dcigettext + 184
>
> frame #5: 0x0000000100003f88 a.out`main + 40
It means that libintl now does stricter checking against invalid arguments.
Which is a good thing.
Bruno
[1] https://www.gnu.org/software/gettext/manual/html_node/Ambiguities.html