mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Default binding directory for gettext
@ 2022-12-02  5:31 A. Wilcox
  2022-12-02 15:16 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: A. Wilcox @ 2022-12-02  5:31 UTC (permalink / raw)
  To: musl

Hi,

While updating the package ‘cracklib’ for Adélie Linux, I found it does
not give localised messages, because it does not call bindtextdomain(3),
only textdomain(3).  This does work on glibc and GNU gettext as a
library, which use /usr/share/locale as a default binding.

Is it intentional that there is no default binding for gettext?  I
believe the GNU implementation is meant to be canonical for behaviour of
gettext, and this seems to not match.  From
https://www.gnu.org/software/gettext/manual/html_node/Locating-Catalogs.html,
emphasis mine:

> The directory name given in bindtextdomains second argument **(or the
default directory)**, followed by the name of the locale, the locale
category, and the domain name are concatenated

Since this technically isn’t portable when the software is installed in
a different $PREFIX, I did open
https://github.com/cracklib/cracklib/pull/50, so this should be fixed in
a future release of the package.  Still, I wasn’t sure if this musl
behaviour was desired or not.  My personal feeling is that both are
wrong; bindtextdomain is needed in the case of non-standard PREFIX, but
musl should have a default fallback path for packages that elide the
call.

Best,
-A.

--
A. Wilcox (they/them)
SW Engineering: C/C++, DevOps, POSIX
Wilcox Technologies Inc.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [musl] Default binding directory for gettext
  2022-12-02  5:31 [musl] Default binding directory for gettext A. Wilcox
@ 2022-12-02 15:16 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2022-12-02 15:16 UTC (permalink / raw)
  To: A. Wilcox; +Cc: musl

On Thu, Dec 01, 2022 at 11:31:32PM -0600, A. Wilcox wrote:
> Hi,
> 
> While updating the package ‘cracklib’ for Adélie Linux, I found it does
> not give localised messages, because it does not call bindtextdomain(3),
> only textdomain(3).  This does work on glibc and GNU gettext as a
> library, which use /usr/share/locale as a default binding.
> 
> Is it intentional that there is no default binding for gettext?  I
> believe the GNU implementation is meant to be canonical for behaviour of
> gettext, and this seems to not match.  From
> https://www.gnu.org/software/gettext/manual/html_node/Locating-Catalogs.html,
> emphasis mine:
> 
> > The directory name given in bindtextdomains second argument **(or the
> default directory)**, followed by the name of the locale, the locale
> category, and the domain name are concatenated
> 
> Since this technically isn’t portable when the software is installed in
> a different $PREFIX, I did open
> https://github.com/cracklib/cracklib/pull/50, so this should be fixed in
> a future release of the package.  Still, I wasn’t sure if this musl
> behaviour was desired or not.  My personal feeling is that both are
> wrong; bindtextdomain is needed in the case of non-standard PREFIX, but
> musl should have a default fallback path for packages that elide the
> call.
> 
> Best,
> -A.

I don't remember the details, and this could be subject to
reconsideration in the upcoming locale overhaul, but I think it was
intentional. I seem to recall we found that pretty much all real-world
packages call bindtextdomain (and the docs/i18n guides tell you to do
this) to select a path appropriate to the build-time-chosen install
location or a configured location.

From the musl side, we really try to avoid having libc introduce
hard-coded absolute path locations that aren't an existing
widely-known-to-users convention (like POSIX-specified /dev/null or de
facto universal things like /etc/resolv.conf). In the case of glibc, I
would assume it's using a default based off of glibc's --prefix, which
would make this even more of a mess if we copied that: when users
installed musl to a non-system-wide prefix, they'd end up getting that
prefix embedded into static linked binaries they make, which might
even be a privacy leak. Of course we could opt not to do that and just
hard-code /usr/share/locale, but I'm doubtful that this is a behavior
that makes sense.

Rich

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-02 15:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-02  5:31 [musl] Default binding directory for gettext A. Wilcox
2022-12-02 15:16 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).