Re: texinfo-7.2.90 on OpenBSD

Patrice Dumas <[email protected]>
Newsgroups gmane.comp.tex.texinfo.bugs
Message-ID <[email protected]>
On Sun, Jan 11, 2026 at 06:25:15PM +0100, Bruno Haible via Bug reports for the GNU Texinfo documentation system wrote:
> On OpenBSD 7.8 I see 1 test failure:
> FAIL: test_scripts/layout_formatting_fr_info.sh
> 
> I'm attaching the tta/tests/test-suite.log .
> 
> "locale -a" shows 4 French locales:
> fr_BE.UTF-8
> fr_CA.UTF-8
> fr_CH.UTF-8
> fr_FR.UTF-8
> 
> but the locale implementation on OpenBSD is known to be crippled.
> 

> D: layout/diffs/formatting_fr_info.diff (printed below)
> diff -a -u -r ../../../tta/tests/layout/res_parser/formatting_fr_info/formatting.2 layout/out_parser/formatting_fr_info/formatting.2
> --- ../../../tta/tests/layout/res_parser/formatting_fr_info/formatting.2	Thu Jan  1 23:38:11 2026
> +++ layout/out_parser/formatting_fr_info/formatting.2	Sun Jan 11 13:39:36 2026
> @@ -337,6 +337,7 @@
>  formatting.texi:89: @ref reference to nonexistent node `node' (possibly involving @mymacro)
>  formatting.texi:228: warning: node `node with xrefname' not in menu
>  formatting.texi:130: warning: empty index key in @findex
> +Cannot switch to a locale compatible with document strings translations

This means that it was not possible to switch to a different locale than
C or POSIX with POSIX::setlocale.  Since it happens for the Info output
and not the HTML output, I think that it is an issue for Perl locales
switching only, similar locale switching code probably works in C.

We try to switch to any locale that is not C or POSIX, not necessarily
to the locale used for the translation, as we just want to be in a
situation where the LANGUAGE environment variable can be used to switch
the language used for translated messages.

I could reproduce the issue on a cfarm OpenBSD 7.8.  What happens is
that in tta/perl/Texinfo/Translations.pm, in _switch_messages_locale,
the following returns 'C':
 $locale = POSIX::setlocale(LC_MESSAGES, "en_US.UTF-8");

I had a look at the setlocale man page on this platform and there is
this paragraph:

     On OpenBSD, the only useful value for the category is LC_CTYPE.  It sets
     the locale used for character encoding, character classification, and
     case conversion.  For compatibility with natural language support in
     packages(7), all other categories -- LC_COLLATE, LC_MESSAGES,
     LC_MONETARY, LC_NUMERIC, and LC_TIME -- can be set and retrieved, too,
     but their values are ignored by the OpenBSD C library.  A category of
     LC_ALL sets the entire locale generically, which is strongly discouraged
     for security reasons in portable programs.

So, unless I misinterpret this, it seems that LC_CTYPE should be used
instead of LC_MESSAGES on that platform.

I tested, and indeed it worked to switch to a locale different from 'C'.
"Cannot switch to a locale compatible with document strings
translations" does not appear anymore, however, the strings are still
not translated.

I do not like the idea to use LC_CTYPE, but maybe others have other
ideas.

My feeling is that it works in C, because we do it a bit differently,
like:

      setenv_status = setenv ("LC_ALL", "en_US.UTF-8", 1)
                      || setenv ("LANG", "en_US.UTF-8", 1);
      locale = setlocale (LC_MESSAGES, "");

-- 
Pat
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.