gettext-rs icon indicating copy to clipboard operation
gettext-rs copied to clipboard

CI: use system gettext on x86_64-unknown-linux-musl

Open Minoru opened this issue 3 years ago • 1 comments

This works around a segfault in tests: https://github.com/Koka/gettext-rs/issues/99

Minoru avatar Jul 19 '22 19:07 Minoru

Wow, so gettext-rs is broken for musl's built-in implementation of gettext, because:

  1. bind_textdomain_codeset() only supports UTF-8 in musl (returns EINVAL for all other codesets);
  2. bind_textdomain_codeset() always returns NULL, which we treat as an error.

The first one is our problem; we should adjust gettext-rs/tests/integration.rs to handle this.

The second one, I'm not sure. My local manpage for bind_textdomain_codeset() says:

If no codeset has been set for domain domainname, it returns NULL.

And also:

If codeset is NULL, the function returns the previously set codeset for domain domainname. The default is NULL, denoting the locale's character encoding.

I think musl stretches the definitions here, always returning NULL to indicate that it uses locale's charset, which in musl is always UTF-8.

OTOH, regardless of how valid musl's choice is, that's the reality and we should support it. In that case, it's our fault that we assume that NULL return value means failure.

I'll let this sit for a few days while I think how to proceed.

Minoru avatar Jul 21 '22 20:07 Minoru