Should the g_dpgettext2, g_dgettext and other functions accept NULL msgid?
The GNU gettext documentation specifies that passing
NULL as the
msgid argument is undefined behavior. The
libintl.h functions in musl libc segfault in this case, since it is the caller's responsibility to ensure that it's passing a valid argument to the function.
In tracking down segfaults in GIMP when localization is enabled, I found multiple cases where the issue was caused by calling
msgid=NULL. I noticed then that it could also call GLib's
g_dpgettext2 in some situations (probably when being used as a library?). In such cases, should GLib's functions return NULL or should they expose the undefined behavior from the underlying gettext impl?
Either is fine for me, I just need to know if I should PR any fix here or if it's all in GIMP's territory.
And if the position is to expose the underlying impl's behavior, that should be noted in the GLib documentation (https://developer.gnome.org/glib/2.66/glib-I18N.html#g-dpgettext)