commit:     667e7bb382d2830f7ca75aff94c9f746ddc89846
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug  8 17:14:00 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug  8 17:40:48 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=667e7bb3

Coerce LC_ALL=C for localedef(1) in get_locale_dir()

The GNU implementation of localedef(1) has translations that affect the
output produced by the --help option.

# LC_MESSAGES=ja_JP.UTF-8 localedef --help | grep -B1 ^/usr/lib/locale
ロケールパス用のシステムディレクトリ       :
/usr/lib/locale:/usr/share/i18n

Presently, the get_locale_dir() subroutine does not account for this and
is therefore unable to match against "locale dir", after which
locale-gen(8) erroneously claims that the OS isn't using glibc.

Address this issue by coercing the C (POSIX) locale for that particular
invocation.

Closes: https://bugs.gentoo.org/961219
Reported-by: YOSHIOKA Takuma <lo48576 <AT> hard-wi.red>
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 locale-gen | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/locale-gen b/locale-gen
index 142af0e..2809055 100755
--- a/locale-gen
+++ b/locale-gen
@@ -131,7 +131,7 @@ umask 0022;
 }
 
 sub get_locale_dir () {
-       my $stdout = qx{ localedef --help 2>/dev/null };
+       my $stdout = qx{ LC_ALL=C localedef --help 2>/dev/null };
        if ($? == 0 && $stdout =~ m/\hlocale path\h*:\s+(\/[^:]+)/) {
                return canonpath($1);
        } elsif (($? & 0xFF) == 0) {

Reply via email to