* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-15 22:18 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-15 22:18 UTC (permalink / raw
To: gentoo-commits
commit: 811994394c9866f667d4822975038fb03807a325
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 15 22:05:49 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 15 22:15:22 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=81199439
mkconfig: don't transliterate paths in map_locale_attributes()
Presently, the map_locale_attributes() subroutine employs a two-stage
pipeline, where grep(1) is used to find lines defining the "language"
and "territory" attributes, with iconv(1) transliterating to US-ASCII.
This is done so as to eliminate diacritics and produce a config that is,
at once, valid US-ASCII and valid UTF-8. However, there is a potential
issue with this approach. Imagine a scenario in which Gentoo is
installed beneath the following prefix.
/home/gentoo/gentøø-linux
In that case, the pathname will be transliterated to:
/home/gentoo/gentoo-linux
Thus, the regular expression that separates the pathname from the line
will fail to match. At first, I contemplated switching to the
/usr/share/i18n/locales directory before grep(1) is executed. To do so
would almost certainly have sufficed, because the names of the files
residing in that directory are unaffected by transliteration, and this
will remain the case for the foreseeable future. Then I realised that
Perl is able to perform transliteration using only core modules.
As such, address this issue by having Perl be directly responsible for
opening and parsing the locale files. For any field whose value does not
consist entirely of bytes in the 0x00 - 0x7F range, transliterate the
diacritics in the following way.
1) Decode the bytes to characters (presuming UTF-8 as the encoding)
2) Convert the characters to the NFKD normal form
3) Strip non-spacing combining marks with a zero advance width
This approach appears adequate, and remains about as fast.
It should be noted that dev-perl/File-Slurper is now a requirement. I
favour this module because its read_binary() subroutine performs an
extremely fast unbuffered 'slurp'. Should this requirement be considered
problematic, it may be removed before the next release is issued.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 73 +++++++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 47 insertions(+), 26 deletions(-)
diff --git a/mkconfig b/mkconfig
index 5a7251f..d79b3af 100755
--- a/mkconfig
+++ b/mkconfig
@@ -4,16 +4,17 @@
# consisting only of UTF-8 locales supported by the installed version of glibc,
# with comments indicating the languages and territories in plain English.
#
-# Requires: column(1), grep(1), iconv(1), sh(1)
+# Requires: column(1)
#
# Copyright 2025 Kerin Millar <kfm@plushkava.net>
# License GPL-2.0-only <https://spdx.org/licenses/GPL-2.0-only.html>
use v5.36;
-use File::Spec::Functions qw(catfile);
+use Encode qw(decode);
+use File::Spec::Functions qw(catdir catfile);
+use Unicode::Normalize qw(NFKD);
-# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it.
-delete $ENV{'BASH_ENV'};
+use File::Slurper qw(read_binary);
{
# The first argument shall be treated as a prefix, if any.
@@ -26,8 +27,10 @@ delete $ENV{'BASH_ENV'};
# Gather the language and territory attributes of the locale templates.
my $attr_by = map_locale_attributes($prefix);
- # Use column(1) to write out a nicely columnated list.
- open my $pipe, "| column -t -s \037" or exit 127;
+ # Use column(1) to write out a nicely columnated list. The encoding is
+ # applied as a precaution; should any wide characters unexpectedly slip
+ # through, they shall be backslash-escaped e.g. U+00E5 => "\x{00e5}".
+ open my $pipe, "|-:encoding(US-ASCII)", "column -t -s \037" or exit 127;
while (my $line = readline $fh) {
my ($read_locale, $charmap) = split ' ', $line;
@@ -56,31 +59,49 @@ delete $ENV{'BASH_ENV'};
}
sub map_locale_attributes ($prefix) {
- my $top = local $ENV{'TOP'} = catfile($prefix, '/usr/share/i18n', 'locales');
- my @lines = qx{
- grep -E '^(language|territory)[[:blank:]]' /dev/null "\$TOP"/* |
- iconv -f UTF-8 -t US-ASCII//TRANSLIT
- };
+ my $top = catdir($prefix, '/usr/share/i18n/locales');
+ opendir(my $dh, $top) or die "Can't open '$top' as a directory: $!";
my $regex = qr/
- \Q$top\E\/([^\/:]+) # basename
- : # separates pathname from matching line
- (language|territory) # attribute key
- \h+ # one or more <blank> characters
- "([^"]*)" # attribute value
- /x;
+ ^
+ language # attribute key
+ \h+ # one or more <blank> characters
+ "([^"]+)" # non-empty attribute value
+ \n # line break
+ territory
+ \h+
+ "([^"]*)" # attribute value
+ $
+ /mx;
my %attr_by;
- for my $line (@lines) {
- if ($line =~ m/^${regex}$/) {
- my ($locale, $key, $val) = ($1, $2, ucfirst $3);
- if ($key eq 'territory') {
- if ($val =~ m/^Myanmar/) {
- $val = 'Myanmar/Burma';
- } elsif ($val eq 'Turkiye') {
- $val = 'Turkey';
+ while (my $locale = readdir $dh) {
+ next if $locale =~ m/^\./;
+ my $data = read_binary("$top/$locale");
+ if ($data =~ $regex) {
+ my ($language, $territory) = ($1, ucfirst $2);
+ for my $ref (\$language, \$territory) {
+ if ($ref->$* =~ m/[^\p{ASCII}]/) {
+ $ref->$* = to_ascii($ref->$*);
}
}
- $attr_by{$locale}{$key} = $val;
+ if ($territory =~ m/^Myanmar/) {
+ $territory = 'Myanmar/Burma';
+ } elsif ($territory eq 'Turkiye') {
+ $territory = 'Turkey';
+ }
+ $attr_by{$locale} = {
+ 'language' => $language,
+ 'territory' => $territory
+ };
}
}
return \%attr_by;
}
+
+sub to_ascii ($bytes) {
+ # This behaves similarly to "iconv -f UTF-8 -t US-ASCII//TRANSLIT". At
+ # least, to a degree that is sufficient for the inputs being processed.
+ my $chars = decode('UTF-8', $bytes, Encode::FB_CROAK);
+ $chars = NFKD($chars);
+ $chars =~ s/\p{NonspacingMark}//g;
+ return $chars;
+}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-18 23:06 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-18 23:06 UTC (permalink / raw
To: gentoo-commits
commit: 6a71671c8dac4fb54c31927619dbf4857ea52ff1
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Sep 18 23:06:31 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Sep 18 23:06:31 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=6a71671c
Bump $VERSION to 3.8
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 0299f14..d050490 100644
--- a/locale-gen
+++ b/locale-gen
@@ -19,7 +19,7 @@ use Term::ANSIColor qw(colored);
use experimental qw(try);
my $PROGRAM = basename(__FILE__);
-my $VERSION = '3.7';
+my $VERSION = '3.8';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-18 23:04 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-18 23:04 UTC (permalink / raw
To: gentoo-commits
commit: cf37b8be253e4e4a3f78976ecac4056439933761
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Sep 18 22:39:36 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Sep 18 23:03:27 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=cf37b8be
Tolerate a codeset/charmap of "UTF8" (for now)
It has been observed that some Gentoo installations have locale.gen(5)
files containing "C.UTF8 UTF-8" as an entry. Further, up until recently,
the catalyst tool would populate /etc/locale.gen in that way. Though
glibc tolerates "UTF8" as a codeset, locale-gen(8) does not, because no
file by that name resides in the /usr/share/i18n/charmaps directory.
For now, have the parse_config() subroutine handle "UTF8" as a special
case for both the locale and charmap fields. Where "UTF8" is seen, it
shall now be taken as "UTF-8", with a rather ostentatious warning being
issued. The intention is to ease the transition to >=locale-gen-3 in
advance of stable-keywording, while encouraging users to amend their
config files before eventually dropping support for this edge case.
Bug: https://bugs.gentoo.org/963046
Link: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=99af83b914
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/locale-gen b/locale-gen
index c18858f..0299f14 100644
--- a/locale-gen
+++ b/locale-gen
@@ -13,6 +13,7 @@ use File::Spec::Functions qw(canonpath catfile catdir path splitpath);
use File::Temp qw(tempdir);
use Getopt::Long ();
use List::Util qw(any);
+use Term::ANSIColor qw(colored);
# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
use experimental qw(try);
@@ -360,6 +361,31 @@ sub parse_config ($fh, $path, $locale_by, $charmap_by) {
$thrower->('Malformed locale declaration', $line);
}
+ # Handle "UTF8" as a special case. Though glibc tolerates it,
+ # locale-gen would otherwise not because there is no charmap
+ # file by that name. The intention is to encourage users to
+ # amend their config files before eventually dropping support
+ # for "UTF8" altogether.
+ my @warnings;
+ if ($fields[0] =~ s/\.UTF\K8(?=@|\z)/-8/) {
+ push @warnings,
+ sprintf "WARNING! Codeset specified as UTF8 (should be UTF-8) at %s[%d]: %s",
+ $path, $., render_printable($line);
+ }
+ if ($fields[1] =~ s/^UTF8\z/UTF-8/) {
+ push @warnings,
+ sprintf "WARNING! Charmap specified as UTF8 (should be UTF-8) at %s[%d]: %s",
+ $path, $., render_printable($line);
+ }
+ for my $warning (@warnings) {
+ if (-t 2) {
+ *STDOUT->flush;
+ warn colored($warning, 'bold yellow') . "\n";
+ } else {
+ warn "$warning\n";
+ }
+ }
+
# Extract the specified locale and character map. Upon success,
# a canonicalised representation of the locale is also returned.
my ($locale, $codeset, $charmap, $canonical) = parse_entry(@fields);
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-18 23:04 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-18 23:04 UTC (permalink / raw
To: gentoo-commits
commit: 7074ff3fec20ee1f8b51822878150d2809544876
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Sep 18 21:55:51 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Sep 18 21:55:51 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=7074ff3f
Have generate_archive() accept undef to signify no prior archive
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 9ebadbf..c18858f 100644
--- a/locale-gen
+++ b/locale-gen
@@ -115,7 +115,7 @@ umask 0022;
# Integrate the compiled locales into a new locale archive.
my $src_path = do {
- my $prior_archive = $opt{'update'} ? $dst_path : '';
+ my $prior_archive = $opt{'update'} ? $dst_path : undef;
my @canonicals = map +( $_->[2] ), @locales;
generate_archive($gentoo_prefix, $locale_dir, $prior_archive, @canonicals);
};
@@ -495,7 +495,7 @@ sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals)
run('mkdir', '-p', '--', $output_dir);
# If specified, make a copy of the prior archive for updating.
- if (-e $prior_archive) {
+ if (length $prior_archive && -e $prior_archive) {
run('cp', '--', $prior_archive, "$output_dir/");
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-15 5:08 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-15 5:08 UTC (permalink / raw
To: gentoo-commits
commit: b3ee6d90fe15834e859fd21affe4cadbc56ee9e8
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Sep 15 05:08:24 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Sep 15 05:08:24 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=b3ee6d90
Shorten a comment in generate_locales()
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/locale-gen b/locale-gen
index 871d52b..9ebadbf 100644
--- a/locale-gen
+++ b/locale-gen
@@ -470,9 +470,8 @@ sub generate_locales ($workers, @locales) {
}
# Abort if any of the collected status codes are found to be non-zero.
- # In the case that one subprocess was interrupted by a signal while
- # another exited non-zero, the resulting diagnostic shall allude to the
- # signal. Such determinism is achieved by sorting the values.
+ # Should a subprocess be interrupted by a signal while another exited
+ # non-zero, the resulting diagnostic shall allude only to the signal.
for my $status (sort { $a <=> $b } values %status_by) {
throw_child_error('localedef', $status);
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-15 4:07 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-15 4:07 UTC (permalink / raw
To: gentoo-commits
commit: 46475884156ef41e4f785bdcc4af5b7d0fd91f62
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Sep 14 14:07:58 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Sep 15 04:05:05 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=46475884
Have list_locales() call close to wait for the child
Presently, the list_locales() subroutine uses the waitpid builtin to
wait for the child process in which localedef(1) is executed. Instead,
have the parent process close its end of the pipe. Doing so suffices
because the closure of a filehandle produced by a piped open returns
false if one of the other syscalls involved fails or if the process
exits with a non-zero status. In other words, the child shall be
implicitly waited for.
Besides, it is sensible to close a pipe upon the very moment it no
longer serves any purpose.
See-also: a9c2999d4804ecb5b97782f5011b04158b72317a
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 13a9223..871d52b 100644
--- a/locale-gen
+++ b/locale-gen
@@ -255,7 +255,7 @@ sub list_locales ($prefix) {
run('localedef', @args);
} else {
chomp(my @locales = readline $pipe);
- if (-1 == waitpid($pid, 0) || $? != 0) {
+ if (! close $pipe && $! == 0) {
die "$PROGRAM: Can't obtain a list of the presently installed locales\n";
}
return @locales;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-15 4:07 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-15 4:07 UTC (permalink / raw
To: gentoo-commits
commit: a9c2999d4804ecb5b97782f5011b04158b72317a
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Sep 14 13:47:48 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Sep 15 03:28:14 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=a9c2999d
Capture STDERR with a piped open in generate_archive()
Presently, the generate_archive() subroutine calls the redirect_stderr()
subroutine. The latter manipulates file descriptor #2 in the initial
perl process before executing a callback that causes perl to fork and
execute localedef(1) for the purpose of building the locale archive.
Further, the file descriptor in question is re-opened with a file in
read/write mode. Once localedef(1) exits, the file offset is reset to 0
so that the captured errors may be read.
Simplify matters by initially forking perl with the open builtin and
having the child process perform the equivalent of dup2(1, 2) before
proceeding to exec localedef(1). That way, the parent process can read
directly from the resulting pipe and there is no need to restore the
prior state of the file descriptor.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 38 +++++++++++++-------------------------
1 file changed, 13 insertions(+), 25 deletions(-)
diff --git a/locale-gen b/locale-gen
index 796e8cc..05dabcf 100644
--- a/locale-gen
+++ b/locale-gen
@@ -9,7 +9,6 @@ use v5.36;
use Cwd qw(getcwd);
use Errno qw(ENOENT);
-use Fcntl qw(SEEK_SET);
use File::Spec::Functions qw(canonpath catfile catdir path splitpath);
use File::Temp qw(tempdir);
use Getopt::Long ();
@@ -504,19 +503,20 @@ sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals)
# Integrate all of the compiled locales into the new locale archive.
my $total = scalar @canonicals;
printf "Adding %d locale%s to the locale archive ...\n", $total, plural($total);
- my $stderr = fopen('stderr.log', '+>');
- redirect_stderr($stderr, sub {
+ my $stderr;
+ if (! defined(my $pid = open my $pipe, '-|')) {
+ die "Can't fork: $!";
+ } elsif ($pid == 0) {
+ open *STDERR, '>&=', *STDOUT or die "Can't direct STDERR to STDOUT: $!\n";
run(qw( localedef --prefix . --quiet --add-to-archive -- ), @canonicals);
- });
-
- # Propagate the diagnostics and errors raised by localedef(1), if any.
- seek $stderr, 0, SEEK_SET;
- my $i = 0;
- while (my $line = readline $stderr) {
- warn $line;
- ++$i;
+ } else {
+ local $/;
+ $stderr = readline $pipe;
+ if (length $stderr) {
+ warn $stderr;
+ }
+ close $pipe;
}
- close $stderr;
# Check the status code first.
throw_child_error('localedef');
@@ -524,7 +524,7 @@ sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals)
# Sadly, the exit status of GNU localedef(1) is nigh on useless in the
# case that the --add-to-archive option is provided. If anything was
# printed to STDERR at all, act as if the utility had exited 1.
- if ($i > 0) {
+ if (length $stderr) {
throw_child_error('localedef', 1 << 8);
}
@@ -600,18 +600,6 @@ sub plural ($int) {
return $int == 1 ? '' : 's';
}
-sub redirect_stderr ($stderr, $callback) {
- if (! open my $old_stderr, '>&', *STDERR) {
- die "Can't dup STDERR to a new file descriptor: $!";
- } elsif (! open *STDERR, '>&', $stderr) {
- my $fileno = fileno $stderr;
- die "Can't dup file descriptor #$fileno to STDERR: $!";
- } else {
- $callback->();
- open *STDERR, '>&=', $old_stderr;
- }
-}
-
sub render_printable ($value) {
require JSON::PP;
return JSON::PP->new->ascii->space_after->encode($value)
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-15 4:07 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-15 4:07 UTC (permalink / raw
To: gentoo-commits
commit: 9f988d2587fe96e5ff44f8074dafa9c3924aaefb
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Sep 15 03:32:42 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Sep 15 03:33:43 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=9f988d25
Drop the $mode parameter of the fopen() subroutine
For the mode is no longer required to be anything other than '<'.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 05dabcf..13a9223 100644
--- a/locale-gen
+++ b/locale-gen
@@ -581,8 +581,8 @@ sub copy_security_context ($src_path, $dst_path) {
}
}
-sub fopen ($path, $mode = '<') {
- if (! open my $fh, $mode, $path) {
+sub fopen ($path) {
+ if (! open my $fh, '<', $path) {
die "$PROGRAM: Can't open '$path': $!\n";
} elsif (! -f $fh && canonpath($path) !~ m/^\/dev\/(null|stdin)\z/n) {
die "$PROGRAM: Won't open '$path' because it is not a regular file\n";
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-14 4:24 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-14 4:24 UTC (permalink / raw
To: gentoo-commits
commit: 932e88c030af431404a0825a4208fedb2f478c44
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Sep 14 04:21:02 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Sep 14 04:21:02 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=932e88c0
Bump $VERSION to 3.7
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 45919fa..796e8cc 100644
--- a/locale-gen
+++ b/locale-gen
@@ -19,7 +19,7 @@ use List::Util qw(any);
use experimental qw(try);
my $PROGRAM = basename(__FILE__);
-my $VERSION = '3.6';
+my $VERSION = '3.7';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-14 4:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-14 4:20 UTC (permalink / raw
To: gentoo-commits
commit: 4e8b871a3f592ed66c82fb32e99e9d7c1b92b598
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Sep 14 04:01:30 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Sep 14 04:17:51 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=4e8b871a
Disregard chcon(1) errors caused by ENOTSUP
Version 3.5 introduced support for preserving and restoring SELinux
security contexts. Where an existing archive is found to exist,
locale-gen(8) executes the chcon(1) utility so as to copy the context
from the old archive to the new archive, just before the former is
replaced by a rename(2) syscall. This only happens in the case that the
underlying filesystem is mounted with the "seclabel" option in effect.
However, the presence of the mount option does not prove that the
chcon(1) utility can be successfully employed. Consider a scenario in
which someone installs Gentoo from an SELinux-enabled operating
environment, such as Fedora. The chroot environment depicted below is
one that was prepared from an ordinary "stage3-arm64-systemd" tarball.
# chroot /mnt/gentoo /bin/bash
# findmnt -no options -T /usr/lib/locale-archive
rw,relatime,seclabel,attr2,inode64,logbufs=8,logbsize=32k,noquota
# locale-gen
Found 1 locale declaration in '/etc/locale.gen'.
Compiling 2 locales with 2 workers ...
[1/2] Compiling locale: C.UTF-8
[2/2] Compiling locale: en_GB.UTF-8
Waiting for active workers to finish their jobs ...
The location of the archive shall be '/usr/lib/locale/locale-archive'.
Adding 2 locales to the locale archive ...
chcon: failed to get security context of '/usr/lib/locale/locale-archive
': Operation not supported
Clearly, chcon(1) is incapable of copying the security context. In turn,
that's because sys-apps/coreutils hasn't been built with USE="selinux"
in effect. I was able to make the utility work by copying the instance
provided by Fedora into the chroot environment, along with the
"libselinux.so.1" library to which it links.
It is interesting to note that in a situation such as this, the files
unpacked from the tarball will end up carrying security labels that are
surplus to requirements. That is, the user may have no intention of
using SELinux in Gentoo but will end up with a large number of files
bearing a label of "unconfined_u:object_r:unlabeled_t:s0".
Anyway, address this issue by capturing the standard error of chcon(1)
and quietly disregarding errors where any of the captured lines are
found to end with ": Operation not permitted". The C locale is duly
coerced, ensuring that the error string cannot be translated to any
other language. As unpalatable a solution as it may be, the alternatives
that I am aware of would be worse still.
Reported-by: Dennis Clarke <dc <AT> genunix.com>
Fixes: 42eb5eaf744f5561e86458ba242f2514cfa80595
Closes: https://bugs.gentoo.org/962824
Bug: https://bugs.gentoo.org/962753
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index e360da3..45919fa 100644
--- a/locale-gen
+++ b/locale-gen
@@ -548,7 +548,7 @@ sub install_archive ($src_path, $dst_path, $may_reset_labels) {
# If a prior archive exists, attempt to preserve its SELinux label.
if ($has_seclabels && $has_archive) {
- run('chcon', "--reference=$dst_path", '--', $interim_path);
+ copy_security_context($dst_path, $interim_path);
}
# Activate the new archive by atomically renaming it into place.
@@ -569,6 +569,18 @@ sub install_archive ($src_path, $dst_path, $may_reset_labels) {
}
}
+sub copy_security_context ($src_path, $dst_path) {
+ local @ENV{'SRC_PATH', 'DST_PATH'} = ($src_path, $dst_path);
+ my $stderr = qx{ LC_ALL=C chcon --reference="\$SRC_PATH" -- "\$DST_PATH" 2>&1 >/dev/null };
+ # Throw exceptions for any errors that are not a consequence of ENOTSUP.
+ if ($? != 0 && $stderr !~ m/: Operation not supported$/m) {
+ if (length $stderr) {
+ warn $stderr;
+ }
+ throw_child_error('chcon');
+ }
+}
+
sub fopen ($path, $mode = '<') {
if (! open my $fh, $mode, $path) {
die "$PROGRAM: Can't open '$path': $!\n";
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 23:53 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 23:53 UTC (permalink / raw
To: gentoo-commits
commit: 5f5a651907f8cdf3dbf52f5945ac967df4e37b47
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 23:52:48 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 23:52:48 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=5f5a6519
Bump $VERSION to 3.6
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 8346877..e360da3 100644
--- a/locale-gen
+++ b/locale-gen
@@ -19,7 +19,7 @@ use List::Util qw(any);
use experimental qw(try);
my $PROGRAM = basename(__FILE__);
-my $VERSION = '3.5';
+my $VERSION = '3.6';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 23:51 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 23:51 UTC (permalink / raw
To: gentoo-commits
commit: 42a137eb54c2adba26d4030b981bdf3a1433534e
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 23:43:54 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 23:45:48 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=42a137eb
Revert "Ignore findmnt(8) exiting 1 where / is not a mountpoint"
This reverts commit 4d24a40275db2a0f75cabccade0ef6ea63772194. This is
only so that it may be re-applied with a commit message that mentions
both the bug reporter and tester.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/locale-gen b/locale-gen
index 8346877..9018e7b 100755
--- a/locale-gen
+++ b/locale-gen
@@ -652,16 +652,15 @@ sub dirname ($path) {
}
sub has_mount_option ($target, $option) {
- # Per bug 962817, / may not necessarily exist as a mountpoint. Assuming
- # it does not, ignore the case that findmnt(8) exits with a status of 1.
- local $ENV{'TARGET'} = $target;
- my $stdout = qx{
- findmnt -no options -T "\$TARGET"
- case \$? in 1) ! mountpoint -q / ;; *) exit "\$?" ;; esac
- };
- throw_child_error('findmnt');
- chomp $stdout;
- return ",$stdout," =~ m/\Q,$option,/;
+ if (! open my $pipe, '-|', qw( findmnt -no options -T ), $target) {
+ exit 1;
+ } else {
+ chomp(my $stdout = do { local $/; readline $pipe });
+ if (! close $pipe && $! == 0) {
+ throw_child_error('findmnt');
+ }
+ return ",$stdout," =~ m/\Q,$option,/;
+ }
}
sub can_run ($bin) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 23:51 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 23:51 UTC (permalink / raw
To: gentoo-commits
commit: 2fd0df367ce494dae677b912c453530cd738283a
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 23:47:07 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 23:49:18 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=2fd0df36
Ignore findmnt(8) exiting 1 where / is not a mountpoint
Presently, the has_mount_option() subroutine executes findmnt(8) so as
to determine the mount options of the mountpoint subsuming the directory
that is intended to contain the locale archive.
However, in some cases, such as where using qemu-user, no / mountpoint
exists. In that case, it is highly probable that findmnt -T will recurse
upwards until it reaches /, only to exit 1 because it cannot be
resolved.
Address this issue by disregarding an exit status of 1 in the case that
/ is found not to be a mountpoint.
Closes: https://bugs.gentoo.org/962817
Reported-by: jiakang.cjk <AT> aliyun.com
Tested-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr>
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/locale-gen b/locale-gen
old mode 100755
new mode 100644
index 9018e7b..8346877
--- a/locale-gen
+++ b/locale-gen
@@ -652,15 +652,16 @@ sub dirname ($path) {
}
sub has_mount_option ($target, $option) {
- if (! open my $pipe, '-|', qw( findmnt -no options -T ), $target) {
- exit 1;
- } else {
- chomp(my $stdout = do { local $/; readline $pipe });
- if (! close $pipe && $! == 0) {
- throw_child_error('findmnt');
- }
- return ",$stdout," =~ m/\Q,$option,/;
- }
+ # Per bug 962817, / may not necessarily exist as a mountpoint. Assuming
+ # it does not, ignore the case that findmnt(8) exits with a status of 1.
+ local $ENV{'TARGET'} = $target;
+ my $stdout = qx{
+ findmnt -no options -T "\$TARGET"
+ case \$? in 1) ! mountpoint -q / ;; *) exit "\$?" ;; esac
+ };
+ throw_child_error('findmnt');
+ chomp $stdout;
+ return ",$stdout," =~ m/\Q,$option,/;
}
sub can_run ($bin) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 23:23 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 23:23 UTC (permalink / raw
To: gentoo-commits
commit: 1c1b32c6af1e053338714a850503f632bd25f820
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 22:51:57 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 22:51:57 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=1c1b32c6
Drop the run_localedef() subroutine
Given that run_localedef() no longer expects a $prefix parameter, its
continued existence is difficult to justify. Adapt the run() subroutine
so as to be able to act in its stead.
See-also: 18bead55adee7ad706316320dbeb9abb8cc147e8
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 32 ++++++++++++++------------------
1 file changed, 14 insertions(+), 18 deletions(-)
diff --git a/locale-gen b/locale-gen
index 90ed60b..9018e7b 100755
--- a/locale-gen
+++ b/locale-gen
@@ -28,6 +28,9 @@ my @TEMPFILES;
# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it.
delete $ENV{'BASH_ENV'};
+# Prevent the --verbose option of localedef(1) from being implicitly enabled.
+delete $ENV{'POSIXLY_CORRECT'};
+
# Protect against the inheritance of an unduly restrictive umask.
umask 0022;
@@ -250,7 +253,7 @@ sub list_locales ($prefix) {
if (length $prefix) {
push @args, '--prefix', $prefix;
}
- run_localedef(@args);
+ run('localedef', @args);
} else {
chomp(my @locales = readline $pipe);
if (-1 == waitpid($pid, 0) || $? != 0) {
@@ -485,7 +488,7 @@ sub generate_locales ($workers, @locales) {
sub compile_locale ($locale, $charmap, $canonical) {
my $output_dir = "./$canonical";
- run_localedef('--no-archive', '-i', $locale, '-f', $charmap, '--', $output_dir);
+ run('localedef', '--no-archive', '-i', $locale, '-f', $charmap, '--', $output_dir);
}
sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals) {
@@ -503,7 +506,7 @@ sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals)
printf "Adding %d locale%s to the locale archive ...\n", $total, plural($total);
my $stderr = fopen('stderr.log', '+>');
redirect_stderr($stderr, sub {
- run_localedef(qw( --prefix . --quiet --add-to-archive -- ), @canonicals);
+ run(qw( localedef --prefix . --quiet --add-to-archive -- ), @canonicals);
});
# Propagate the diagnostics and errors raised by localedef(1), if any.
@@ -566,19 +569,6 @@ sub install_archive ($src_path, $dst_path, $may_reset_labels) {
}
}
-sub run_localedef (@args) {
- # Prevent the --verbose option from being potentially implied.
- delete local $ENV{'POSIXLY_CORRECT'};
-
- # Execute localedef(1). Don't fork if doing so from a child process.
- my @cmd = ('localedef', @args);
- if ($$ == $PID) {
- system @cmd;
- } elsif (! exec @cmd) {
- exit 1;
- }
-}
-
sub fopen ($path, $mode = '<') {
if (! open my $fh, $mode, $path) {
die "$PROGRAM: Can't open '$path': $!\n";
@@ -616,8 +606,14 @@ sub render_printable ($value) {
}
sub run ($cmd, @args) {
- system $cmd, @args;
- throw_child_error($cmd);
+ if ($$ == $PID) {
+ system $cmd, @args;
+ throw_child_error($cmd);
+ } else {
+ # Refrain from forking if called from a subprocess.
+ exec $cmd, @args;
+ exit ($! == ENOENT ? 127 : 126);
+ }
}
sub throw_child_error ($cmd, $status = $?) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 23:23 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 23:23 UTC (permalink / raw
To: gentoo-commits
commit: 4d24a40275db2a0f75cabccade0ef6ea63772194
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 23:19:47 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 23:19:47 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=4d24a402
Ignore findmnt(8) exiting 1 where / is not a mountpoint
Presently, the has_mount_option() subroutine executes findmnt(8) so as
to determine the mount options of the mountpoint subsuming the directory
that is intended to contain the locale archive.
However, in some cases, such as where using qemu-user, no / mountpoint
exists. In that case, it is highly probable that findmnt -T will recurse
upwards until it reaches /, only to exit 1 because it cannot be
resolved.
Address this issue by disregarding an exit status of 1 in the case that
/ is found not to be a mountpoint.
Bug: https://bugs.gentoo.org/962817
Bug: https://bugs.gentoo.org/962753
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/locale-gen b/locale-gen
index 9018e7b..8346877 100755
--- a/locale-gen
+++ b/locale-gen
@@ -652,15 +652,16 @@ sub dirname ($path) {
}
sub has_mount_option ($target, $option) {
- if (! open my $pipe, '-|', qw( findmnt -no options -T ), $target) {
- exit 1;
- } else {
- chomp(my $stdout = do { local $/; readline $pipe });
- if (! close $pipe && $! == 0) {
- throw_child_error('findmnt');
- }
- return ",$stdout," =~ m/\Q,$option,/;
- }
+ # Per bug 962817, / may not necessarily exist as a mountpoint. Assuming
+ # it does not, ignore the case that findmnt(8) exits with a status of 1.
+ local $ENV{'TARGET'} = $target;
+ my $stdout = qx{
+ findmnt -no options -T "\$TARGET"
+ case \$? in 1) ! mountpoint -q / ;; *) exit "\$?" ;; esac
+ };
+ throw_child_error('findmnt');
+ chomp $stdout;
+ return ",$stdout," =~ m/\Q,$option,/;
}
sub can_run ($bin) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 9:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 9:42 UTC (permalink / raw
To: gentoo-commits
commit: 58d63fb7758b87e72edc6d4477e685e58f261381
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 09:42:00 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 09:42:00 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=58d63fb7
Simplify a comment in the main block
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 2 --
1 file changed, 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 24b0d74..90ed60b 100755
--- a/locale-gen
+++ b/locale-gen
@@ -49,8 +49,6 @@ umask 0022;
my $prefix = $opt{'prefix'} // $gentoo_prefix;
# Ensure that locale/charmap files are opened relative to the prefix.
- # It is especially important to do so in situations where the value of
- # $prefix is neither <slash> nor an empty string.
$ENV{'I18NPATH'} = catdir($prefix, '/usr/share/i18n');
# For the directory to be unknown strongly implies the absence of glibc.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 9:35 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 9:35 UTC (permalink / raw
To: gentoo-commits
commit: 049d45ff082ddf55db543ea5a4fb9acbba77d627
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 09:34:09 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 09:34:09 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=049d45ff
Refrain from passing the --replace option to localedef(1)
Presently, the generate_archive() subroutine specifies the --replace
option in the course of executing localedef(1). It serves no purpose
because there is no circumstance under which locale-gen(8) attempts to
replace a locale embedded within an existing locale archive.
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 23bb901..24b0d74 100755
--- a/locale-gen
+++ b/locale-gen
@@ -505,7 +505,7 @@ sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals)
printf "Adding %d locale%s to the locale archive ...\n", $total, plural($total);
my $stderr = fopen('stderr.log', '+>');
redirect_stderr($stderr, sub {
- run_localedef(qw( --prefix . --quiet --add-to-archive --replace -- ), @canonicals);
+ run_localedef(qw( --prefix . --quiet --add-to-archive -- ), @canonicals);
});
# Propagate the diagnostics and errors raised by localedef(1), if any.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 9:27 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 9:27 UTC (permalink / raw
To: gentoo-commits
commit: 18bead55adee7ad706316320dbeb9abb8cc147e8
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 09:23:34 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 09:23:34 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=18bead55
Relieve run_localedef() of the duty of incorporating the --prefix option
Presently, the run_localedef() subroutine treats its first parameter as
a value which, if defined, shall result in the --prefix option being
specified for localedef(1). Through surveying the existing call sites,
the following observations can be made.
- list_locales() needs to conditionally specify a prefix
- compile_locale() never needs to specify a prefix
- generate_archive() specifies a constant prefix of "."
Simplify matters by having the run_localedef() subroutine forward all of
its parameters as localedef(1) arguments, and by having both the
list_locale() and generate_archive() subroutines assume responsibility
for conveying the --prefix option.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
diff --git a/locale-gen b/locale-gen
index 0ba8b89..23bb901 100755
--- a/locale-gen
+++ b/locale-gen
@@ -248,7 +248,11 @@ sub list_locales ($prefix) {
if (! defined(my $pid = open my $pipe, '-|')) {
die "Can't fork: $!";
} elsif ($pid == 0) {
- run_localedef($prefix, '--list-archive');
+ my @args = ('--list-archive');
+ if (length $prefix) {
+ push @args, '--prefix', $prefix;
+ }
+ run_localedef(@args);
} else {
chomp(my @locales = readline $pipe);
if (-1 == waitpid($pid, 0) || $? != 0) {
@@ -483,8 +487,7 @@ sub generate_locales ($workers, @locales) {
sub compile_locale ($locale, $charmap, $canonical) {
my $output_dir = "./$canonical";
- my @args = ('--no-archive', '-i', $locale, '-f', $charmap, '--', $output_dir);
- run_localedef(undef, @args);
+ run_localedef('--no-archive', '-i', $locale, '-f', $charmap, '--', $output_dir);
}
sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals) {
@@ -502,8 +505,7 @@ sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals)
printf "Adding %d locale%s to the locale archive ...\n", $total, plural($total);
my $stderr = fopen('stderr.log', '+>');
redirect_stderr($stderr, sub {
- my @args = ('--quiet', '--add-to-archive', '--replace', '--', @canonicals);
- run_localedef('.', @args);
+ run_localedef(qw( --prefix . --quiet --add-to-archive --replace -- ), @canonicals);
});
# Propagate the diagnostics and errors raised by localedef(1), if any.
@@ -566,13 +568,7 @@ sub install_archive ($src_path, $dst_path, $may_reset_labels) {
}
}
-sub run_localedef ($archive_prefix, @args) {
- # Incorporate the --prefix option, if requested. Its only effect is to
- # cause localedef(1) to prepend the option-arg to the archive path.
- if (length $archive_prefix) {
- unshift @args, '--prefix', $archive_prefix;
- }
-
+sub run_localedef (@args) {
# Prevent the --verbose option from being potentially implied.
delete local $ENV{'POSIXLY_CORRECT'};
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 8:46 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 8:46 UTC (permalink / raw
To: gentoo-commits
commit: cce65c0f6a1c028f2a420df9771421ad945598d2
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 08:45:58 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 08:46:07 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=cce65c0f
Remove a stray newline
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 1 -
1 file changed, 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index 368f449..0ba8b89 100755
--- a/locale-gen
+++ b/locale-gen
@@ -487,7 +487,6 @@ sub compile_locale ($locale, $charmap, $canonical) {
run_localedef(undef, @args);
}
-
sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals) {
# Create the temporary subdir that will contain the new locale archive.
my $output_dir = catdir('.', $gentoo_prefix, $locale_dir);
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 8:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 8:42 UTC (permalink / raw
To: gentoo-commits
commit: 4ce533349a7b0fe106852ce4ca8cf9a38d4c2de5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 08:37:49 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 08:39:15 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=4ce53334
Introduce the install_archive() subroutine
The generate_archive() subroutine has grown overly large. This commit
separates the code responsible for installing the archive, moving it
into a new subroutine by the name of install_archive().
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 68 +++++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 41 insertions(+), 27 deletions(-)
diff --git a/locale-gen b/locale-gen
index 760d46b..368f449 100755
--- a/locale-gen
+++ b/locale-gen
@@ -109,10 +109,21 @@ umask 0022;
# Compile the selected locales.
generate_locales($opt{'jobs'}, @locales);
- # Integrate the newly compiled locales into the system's locale archive.
- my $size = do {
+ # Determine the eventual destination path of the archive.
+ my $dst_path = catfile($prefix, $locale_dir, 'locale-archive');
+ print "The location of the archive shall be '$dst_path'.\n";
+
+ # Integrate the compiled locales into a new locale archive.
+ my $src_path = do {
+ my $prior_archive = $opt{'update'} ? $dst_path : '';
my @canonicals = map +( $_->[2] ), @locales;
- generate_archive($prefix, $gentoo_prefix, $locale_dir, $opt{'update'}, @canonicals);
+ generate_archive($gentoo_prefix, $locale_dir, $prior_archive, @canonicals);
+ };
+
+ # Install the new locale archive.
+ my $size = do {
+ my $may_reset_labels = $prefix eq '' || $prefix eq '/';
+ install_archive($src_path, $dst_path, $may_reset_labels);
};
my $total = scalar @locales + scalar %installed_by;
@@ -476,19 +487,15 @@ sub compile_locale ($locale, $charmap, $canonical) {
run_localedef(undef, @args);
}
-sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonicals) {
+
+sub generate_archive ($gentoo_prefix, $locale_dir, $prior_archive, @canonicals) {
# Create the temporary subdir that will contain the new locale archive.
my $output_dir = catdir('.', $gentoo_prefix, $locale_dir);
run('mkdir', '-p', '--', $output_dir);
- # Determine the eventual destination path of the archive.
- my $final_path = catfile($prefix, $locale_dir, 'locale-archive');
- print "The location of the archive shall be '$final_path'.\n";
-
- # If --update was specified, make a copy of the existing archive.
- my $has_archive = -e $final_path;
- if ($do_update && $has_archive) {
- run('cp', '--', $final_path, "$output_dir/");
+ # If specified, make a copy of the prior archive for updating.
+ if (-e $prior_archive) {
+ run('cp', '--', $prior_archive, "$output_dir/");
}
# Integrate all of the compiled locales into the new locale archive.
@@ -519,35 +526,42 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
throw_child_error('localedef', 1 << 8);
}
+ return catfile($output_dir, 'locale-archive');
+}
+
+sub install_archive ($src_path, $dst_path, $may_reset_labels) {
# Determine whether the underlying filesystem supports SELinux labels.
- my $has_seclabels = has_mount_option(dirname($final_path), 'seclabel');
+ my $has_seclabels = has_mount_option(dirname($dst_path), 'seclabel');
+
+ # Determine whether a previously installed archive exists.
+ my $has_archive = $has_seclabels && -e $dst_path;
- # The process of replacing the old archive must not be interrupted.
+ # The process of replacing the prior archive must not be interrupted.
local @SIG{'INT', 'TERM'} = ('IGNORE', 'IGNORE');
- # Move the newly minted archive into the appropriate filesystem. Use
- # mv(1), since there is a chance of crossing a filesystem boundary.
- push @TEMPFILES, my $interim_path = "$final_path.$$";
- run('mv', '--', catfile($output_dir, 'locale-archive'), $interim_path);
+ # Move the new archive into the appropriate filesystem. Use mv(1),
+ # since there is a chance of crossing a filesystem boundary.
+ push @TEMPFILES, my $interim_path = "$dst_path.$$";
+ run('mv', '--', $src_path, $interim_path);
# If a prior archive exists, attempt to preserve its SELinux label.
- if ($has_archive && $has_seclabels) {
- run('chcon', "--reference=$final_path", '--', $interim_path);
+ if ($has_seclabels && $has_archive) {
+ run('chcon', "--reference=$dst_path", '--', $interim_path);
}
- # Atomically replace the old archive.
- if (! rename $interim_path, $final_path) {
- die "$PROGRAM: Can't rename '$interim_path' to '$final_path': $!\n";
+ # Activate the new archive by atomically renaming it into place.
+ if (! rename $interim_path, $dst_path) {
+ die "$PROGRAM: Can't rename '$interim_path' to '$dst_path': $!\n";
}
# If no prior archive existed, restore the appropriate SELinux label.
- if (! $has_archive && $has_seclabels && $prefix =~ m/^\/?\z/ && can_run('restorecon')) {
- run('restorecon', '-Fmv', '--', $final_path);
+ if ($has_seclabels && ! $has_archive && $may_reset_labels && can_run('restorecon')) {
+ run('restorecon', '-Fmv', '--', $dst_path);
}
# Return the size of the archive, in bytes.
- if (! (my @stat = stat $final_path)) {
- die "$PROGRAM: Can't stat '$final_path': $!\n";
+ if (! (my @stat = stat $dst_path)) {
+ die "$PROGRAM: Can't stat '$dst_path': $!\n";
} else {
return $stat[7];
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 1:23 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 1:23 UTC (permalink / raw
To: gentoo-commits
commit: 84bb4a80e03bd2f554762926e1d167a92c17296a
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 01:21:07 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 01:21:07 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=84bb4a80
Don't directly unlink $interim_path if renaming fails
There is no need to explicitly unlink $interim_path because its removal
is now guaranteed by the END block.
See-also: 30b519f15fce4f78de28ccd49b829c327072f4a6
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 4 ----
1 file changed, 4 deletions(-)
diff --git a/locale-gen b/locale-gen
index f2a3ac5..760d46b 100755
--- a/locale-gen
+++ b/locale-gen
@@ -537,10 +537,6 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
# Atomically replace the old archive.
if (! rename $interim_path, $final_path) {
- {
- local $!;
- unlink $interim_path;
- }
die "$PROGRAM: Can't rename '$interim_path' to '$final_path': $!\n";
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-13 1:14 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-13 1:14 UTC (permalink / raw
To: gentoo-commits
commit: 30b519f15fce4f78de28ccd49b829c327072f4a6
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 01:10:32 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 01:12:24 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=30b519f1
Delete interim archives for which installation fails
Presently, the generate_archive() subroutine performs these steps:
1) generates a new locale archive beneath $TEMPDIR
2) installs it with a suffix that incorporates $$ (the PID of perl)
3) calls rename so as to conclude the installation procedure
However, it is possible for an error to occur after the second step has
successfully concluded, yet before the third step has successfully
concluded. In that case, the interim archive will linger.
# ls /usr/lib/locale
locale-archive locale-archive.3241796
Address this issue by replacing the $TEMPDIR scalar variable with the
@TEMPFILES array variable and ensuring that the path of the interim
archive is pushed to it. The elements of the array shall be purged by
the rm(1) utility, as executed by the END block.
Link: https://bugs.gentoo.org/962753#c9
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index d2a6a4c..f2a3ac5 100755
--- a/locale-gen
+++ b/locale-gen
@@ -23,7 +23,7 @@ my $VERSION = '3.5';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
-my $TEMPDIR;
+my @TEMPFILES;
# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it.
delete $ENV{'BASH_ENV'};
@@ -104,7 +104,7 @@ umask 0022;
check_archive_dir($prefix, $locale_dir);
# Create a temporary directory and switch to it.
- $TEMPDIR = enter_tempdir($prefix);
+ push @TEMPFILES, enter_tempdir($prefix);
# Compile the selected locales.
generate_locales($opt{'jobs'}, @locales);
@@ -527,7 +527,7 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
# Move the newly minted archive into the appropriate filesystem. Use
# mv(1), since there is a chance of crossing a filesystem boundary.
- my $interim_path = "$final_path.$$";
+ push @TEMPFILES, my $interim_path = "$final_path.$$";
run('mv', '--', catfile($output_dir, 'locale-archive'), $interim_path);
# If a prior archive exists, attempt to preserve its SELinux label.
@@ -671,9 +671,9 @@ sub can_run ($bin) {
END {
if ($$ == $PID) {
- if (length $TEMPDIR) {
+ if (@TEMPFILES) {
local $?;
- system 'rm', '-r', '--', $TEMPDIR;
+ system 'rm', '-rf', '--', @TEMPFILES;
}
# The default SIGINT and SIGTERM handlers are suppressed by
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-12 16:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-12 16:59 UTC (permalink / raw
To: gentoo-commits
commit: 5eb90f8187b1a7047a1fad2a8b161e98b851c5af
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Sep 12 16:45:32 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Sep 12 16:54:10 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=5eb90f81
Bump $VERSION to 3.5
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 4cb43e8..d2a6a4c 100755
--- a/locale-gen
+++ b/locale-gen
@@ -19,7 +19,7 @@ use List::Util qw(any);
use experimental qw(try);
my $PROGRAM = basename(__FILE__);
-my $VERSION = '3.4';
+my $VERSION = '3.5';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-12 16:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-12 16:59 UTC (permalink / raw
To: gentoo-commits
commit: 42eb5eaf744f5561e86458ba242f2514cfa80595
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Sep 12 16:31:14 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Sep 12 16:54:08 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=42eb5eaf
Add support for preserving/restoring SELinux contexts
Among the changes brought by locale-gen v3.0 was the following:
- During the archive generation phase, localedef(1) is made to generate
its archive in a temporary directory. Only if it succeeds shall any
existing archive be replaced, with locale-gen(1) now assuming that
responsibility. The existing archive is guaranteed to be replaced
atomically or not at all.
Such is problematic for operating environments in which SELinux is
enabled because the newly created archive ends up lacking the
appropriate label. Consequently, programs are unable to read the archive
until such time as the user restores the label.
Address this issue in a manner twofold. Firstly, in the event that a
prior archive exists, execute the chcon(1) utility so as to copy the
label from the old archive to the new archive, just before the former is
replaced by a rename(2) syscall. Secondly, in the event that a prior
archive does not exist, execute the restorecon(8) utility in an attempt
to apply the appropriate label.
No labelling shall be attempted unless the underlying filesystem is
found to be mounted with the "seclabel" option in effect. Further,
restorecon(8) shall only be executed if is found in PATH and the
--prefix option was either a) unspecified b) specified as "/".
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Tested-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr>
Tested-by: Kenton Groombridge <concord <AT> gentoo.org>
Closes: https://bugs.gentoo.org/962753
locale-gen | 40 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 0d180f3..4cb43e8 100755
--- a/locale-gen
+++ b/locale-gen
@@ -10,9 +10,10 @@ use v5.36;
use Cwd qw(getcwd);
use Errno qw(ENOENT);
use Fcntl qw(SEEK_SET);
-use File::Spec::Functions qw(canonpath catfile catdir splitpath);
+use File::Spec::Functions qw(canonpath catfile catdir path splitpath);
use File::Temp qw(tempdir);
use Getopt::Long ();
+use List::Util qw(any);
# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
use experimental qw(try);
@@ -485,7 +486,8 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
print "The location of the archive shall be '$final_path'.\n";
# If --update was specified, make a copy of the existing archive.
- if ($do_update && -e $final_path) {
+ my $has_archive = -e $final_path;
+ if ($do_update && $has_archive) {
run('cp', '--', $final_path, "$output_dir/");
}
@@ -517,6 +519,9 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
throw_child_error('localedef', 1 << 8);
}
+ # Determine whether the underlying filesystem supports SELinux labels.
+ my $has_seclabels = has_mount_option(dirname($final_path), 'seclabel');
+
# The process of replacing the old archive must not be interrupted.
local @SIG{'INT', 'TERM'} = ('IGNORE', 'IGNORE');
@@ -525,6 +530,11 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
my $interim_path = "$final_path.$$";
run('mv', '--', catfile($output_dir, 'locale-archive'), $interim_path);
+ # If a prior archive exists, attempt to preserve its SELinux label.
+ if ($has_archive && $has_seclabels) {
+ run('chcon', "--reference=$final_path", '--', $interim_path);
+ }
+
# Atomically replace the old archive.
if (! rename $interim_path, $final_path) {
{
@@ -534,6 +544,11 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
die "$PROGRAM: Can't rename '$interim_path' to '$final_path': $!\n";
}
+ # If no prior archive existed, restore the appropriate SELinux label.
+ if (! $has_archive && $has_seclabels && $prefix =~ m/^\/?\z/ && can_run('restorecon')) {
+ run('restorecon', '-Fmv', '--', $final_path);
+ }
+
# Return the size of the archive, in bytes.
if (! (my @stat = stat $final_path)) {
die "$PROGRAM: Can't stat '$final_path': $!\n";
@@ -633,6 +648,27 @@ sub basename ($path) {
return (splitpath($path))[2];
}
+sub dirname ($path) {
+ return (splitpath($path))[1];
+}
+
+sub has_mount_option ($target, $option) {
+ if (! open my $pipe, '-|', qw( findmnt -no options -T ), $target) {
+ exit 1;
+ } else {
+ chomp(my $stdout = do { local $/; readline $pipe });
+ if (! close $pipe && $! == 0) {
+ throw_child_error('findmnt');
+ }
+ return ",$stdout," =~ m/\Q,$option,/;
+ }
+}
+
+sub can_run ($bin) {
+ my @paths = path();
+ return any(sub { -f $_ && -x _ }, map +( "$_/$bin" ), @paths);
+}
+
END {
if ($$ == $PID) {
if (length $TEMPDIR) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-12 16:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-12 16:59 UTC (permalink / raw
To: gentoo-commits
commit: 249e7f78d7478a77270527f8e351b32674e63d00
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Sep 12 16:39:10 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Sep 12 16:54:10 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=249e7f78
locale-gen.8: Don't imply that option bundling is supported
Presently, the SYNOPSIS section contains "[-Aqu]", implying that option
bundling is supported. However, locale-gen(8) only supports the bundling
of options and option-args (such as -j1).
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 6f725a5..b1adda1 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -3,7 +3,9 @@
locale\-gen - safely compile and install a glibc locale archive
.SH "SYNOPSIS"
.SY locale-gen
-.RB [ \-Aqu ]
+.RB [ \-A ]
+.RB [ \-q ]
+.RB [ \-u ]
.RB [ \-c\~\c
.IR config ]
.RB [ \-j\~\c
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-12 16:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-12 16:59 UTC (permalink / raw
To: gentoo-commits
commit: ddaf36a45890b09de80f49e15f6b6bdd741cde4c
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Sep 12 16:40:56 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Sep 12 16:54:10 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=ddaf36a4
locale-gen.8: Don't subject "LOCALEGEN_CONFIG" to word-breaking
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index b1adda1..fc208ad 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -24,14 +24,14 @@ The locale\-gen utility provides a means by which a system administrator may con
.P
A default installation of Gentoo Linux provides an archive that contains all supported locales, numbering 500 or more. However, it is typical for an administrator to require only one or two of these. In that case, the \fI/etc/locale.gen\fR configuration file may be populated with a list of the required locales. By default, locale\-gen shall read this file and compile only the locales that are specified, saving both time and space in the longer term.
.P
-If the configuration file is missing, empty, or consists only of comments, locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR option or LOCALEGEN_CONFIG environment variable was specified. If neither was specified, locale\-gen shall act as if the \fB\-A\fR option had been specified. Otherwise, locale\-gen shall abort with a suitable diagnostic message.
+If the configuration file is missing, empty, or consists only of comments, locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR option or LOCALEGEN\_CONFIG environment variable was specified. If neither was specified, locale\-gen shall act as if the \fB\-A\fR option had been specified. Otherwise, locale\-gen shall abort with a suitable diagnostic message.
.SH "OPTIONS"
.TP
\fB\-A\fR, \fB\-\-all\fR
Compile all locales that are officially supported by glibc. Cannot be combined with the \fB-c\fR option.
.TP
\fB\-c\fR, \fB\-\-config\fR \fIconfig\fR
-Read the given \fIconfig\fR file (defaults to \fIprefix\fR/etc/locale.gen). The file may be specified as <hyphen-minus>, in which case locale\-gen shall read the configuration from standard input. If the LOCALEGEN_CONFIG variable is found to be set in the environment, and neither the \fB-A\fR nor \fB-c\fR option is specified, its value shall be taken as a literal \fIconfig\fR file path.
+Read the given \fIconfig\fR file (defaults to \fIprefix\fR/etc/locale.gen). The file may be specified as <hyphen-minus>, in which case locale\-gen shall read the configuration from standard input. If the LOCALEGEN\_CONFIG variable is found to be set in the environment, and neither the \fB-A\fR nor \fB-c\fR option is specified, its value shall be taken as a literal \fIconfig\fR file path.
.TP
\fB\-h\fR, \fB\-\-help\fR
Write out a synopsis and summary of the supported options then exit.
@@ -68,7 +68,7 @@ Contains locale definition files that serve as inputs to \fBlocaledef\fR(1).
Contains character map files that serve as inputs to \fBlocaledef\fR(1).
.SH "ENVIRONMENT"
.TP
-LOCALEGEN_CONFIG
+LOCALEGEN\_CONFIG
Defines the path of the \fIconfig\fR file in the absence of the \fB-A\fR and \fB-c\fR options.
.SH "EXIT STATUS"
The exit status shall be 0 under any of these conditions:
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-12 16:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-12 16:59 UTC (permalink / raw
To: gentoo-commits
commit: d855d71c4d12fb7ed6e458c3be91ec9c8aa33fe7
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Sep 12 04:13:28 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Sep 12 16:42:13 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=d855d71c
Introduce the basename() helper subroutine
Add a new subroutine that serves as a simple wrapper for
File::Spec->splitpath().
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index 16bcc00..0d180f3 100755
--- a/locale-gen
+++ b/locale-gen
@@ -17,10 +17,7 @@ use Getopt::Long ();
# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
use experimental qw(try);
-# Determine the basename of the presently compiling script.
-my $PROGRAM;
-BEGIN { $PROGRAM = (splitpath(__FILE__))[-1]; }
-
+my $PROGRAM = basename(__FILE__);
my $VERSION = '3.4';
my $DEFERRED_SIGNAL = '';
@@ -309,7 +306,7 @@ sub get_valid_locales ($prefix) {
die "$PROGRAM: Can't chdir to '$pwd': $!\n";
} else {
chomp @paths;
- return map +( (splitpath($_))[-1] ), @paths;
+ return map +basename($_), @paths;
}
}
@@ -632,6 +629,10 @@ sub round ($number) {
return eval(sprintf '%.2f', $number);
}
+sub basename ($path) {
+ return (splitpath($path))[2];
+}
+
END {
if ($$ == $PID) {
if (length $TEMPDIR) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-09-12 16:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-09-12 16:59 UTC (permalink / raw
To: gentoo-commits
commit: 1b7216734a26707fcdc03c89969fbe58bc50faee
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Sep 12 16:32:54 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Sep 12 16:54:10 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=1b721673
Drop the locale.gen file
It is no longer required, because the mkconfig utility generates it.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen | 328 -------------------------------------------------------------
1 file changed, 328 deletions(-)
diff --git a/locale.gen b/locale.gen
deleted file mode 100644
index 47d5a4f..0000000
--- a/locale.gen
+++ /dev/null
@@ -1,328 +0,0 @@
-# This file defines which locales to incorporate into the glibc locale archive.
-# See the locale.gen(5) and locale-gen(8) man pages for more details.
-
-# aa_DJ.UTF-8 UTF-8 # Afar (Djibouti)
-# aa_ER UTF-8 # Afar (Eritrea)
-# aa_ET UTF-8 # Afar (Ethiopia)
-# af_ZA.UTF-8 UTF-8 # Afrikaans (South Africa)
-# agr_PE UTF-8 # Aguaruna (Peru)
-# ak_GH UTF-8 # Akan (Ghana)
-# am_ET UTF-8 # Amharic (Ethiopia)
-# an_ES.UTF-8 UTF-8 # Aragonese (Spain)
-# anp_IN UTF-8 # Angika (India)
-# ar_AE.UTF-8 UTF-8 # Arabic (United Arab Emirates)
-# ar_BH.UTF-8 UTF-8 # Arabic (Bahrain)
-# ar_DZ.UTF-8 UTF-8 # Arabic (Algeria)
-# ar_EG.UTF-8 UTF-8 # Arabic (Egypt)
-# ar_IN UTF-8 # Arabic (India)
-# ar_IQ.UTF-8 UTF-8 # Arabic (Iraq)
-# ar_JO.UTF-8 UTF-8 # Arabic (Jordan)
-# ar_KW.UTF-8 UTF-8 # Arabic (Kuwait)
-# ar_LB.UTF-8 UTF-8 # Arabic (Lebanon)
-# ar_LY.UTF-8 UTF-8 # Arabic (Libya)
-# ar_MA.UTF-8 UTF-8 # Arabic (Morocco)
-# ar_OM.UTF-8 UTF-8 # Arabic (Oman)
-# ar_QA.UTF-8 UTF-8 # Arabic (Qatar)
-# ar_SA.UTF-8 UTF-8 # Arabic (Saudi Arabia)
-# ar_SD.UTF-8 UTF-8 # Arabic (Sudan)
-# ar_SS UTF-8 # Arabic (South Sudan)
-# ar_SY.UTF-8 UTF-8 # Arabic (Syria)
-# ar_TN.UTF-8 UTF-8 # Arabic (Tunisia)
-# ar_YE.UTF-8 UTF-8 # Arabic (Yemen)
-# ayc_PE UTF-8 # Aymara (Peru)
-# az_AZ UTF-8 # Azerbaijani (Azerbaijan)
-# az_IR UTF-8 # South Azerbaijani (Iran)
-# as_IN UTF-8 # Assamese (India)
-# ast_ES.UTF-8 UTF-8 # Asturian (Spain)
-# be_BY.UTF-8 UTF-8 # Belarusian (Belarus)
-# be_BY@latin UTF-8 # Belarusian (Belarus)
-# bem_ZM UTF-8 # Bemba (Zambia)
-# ber_DZ UTF-8 # Berber (Algeria)
-# ber_MA UTF-8 # Berber (Morocco)
-# bg_BG.UTF-8 UTF-8 # Bulgarian (Bulgaria)
-# bhb_IN.UTF-8 UTF-8 # Bhili (India)
-# bho_IN UTF-8 # Bhojpuri (India)
-# bho_NP UTF-8 # Bhojpuri (Nepal)
-# bi_VU UTF-8 # Bislama (Vanuatu)
-# bn_BD UTF-8 # Bangla (Bangladesh)
-# bn_IN UTF-8 # Bangla (India)
-# bo_CN UTF-8 # Tibetan (China)
-# bo_IN UTF-8 # Tibetan (India)
-# br_FR.UTF-8 UTF-8 # Breton (France)
-# brx_IN UTF-8 # Bodo (India)
-# bs_BA.UTF-8 UTF-8 # Bosnian (Bosnia & Herzegovina)
-# byn_ER UTF-8 # Blin (Eritrea)
-# ca_AD.UTF-8 UTF-8 # Catalan (Andorra)
-# ca_ES.UTF-8 UTF-8 # Catalan (Spain)
-# ca_ES@valencia UTF-8 # Catalan (Spain)
-# ca_FR.UTF-8 UTF-8 # Catalan (France)
-# ca_IT.UTF-8 UTF-8 # Catalan (Italy)
-# ce_RU UTF-8 # Chechen (Russia)
-# chr_US UTF-8 # Cherokee (United States)
-# ckb_IQ UTF-8 # Central Kurdish (Iraq)
-# cmn_TW UTF-8 # Mandarin Chinese (Taiwan)
-# crh_RU UTF-8 # Crimean Tatar (Russian Federation)
-# crh_UA UTF-8 # Crimean Tatar (Ukraine)
-# cs_CZ.UTF-8 UTF-8 # Czech (Czech Republic)
-# csb_PL UTF-8 # Kashubian (Poland)
-# cv_RU UTF-8 # Chuvash (Russia)
-# cy_GB.UTF-8 UTF-8 # Welsh (United Kingdom)
-# da_DK.UTF-8 UTF-8 # Danish (Denmark)
-# de_AT.UTF-8 UTF-8 # Austrian German (Austria)
-# de_BE.UTF-8 UTF-8 # German (Belgium)
-# de_CH.UTF-8 UTF-8 # Swiss High German (Switzerland)
-# de_DE.UTF-8 UTF-8 # German (Germany)
-# de_IT.UTF-8 UTF-8 # German (Italy)
-# de_LI.UTF-8 UTF-8 # German (Liechtenstein)
-# de_LU.UTF-8 UTF-8 # German (Luxembourg)
-# doi_IN UTF-8 # Dogri (India)
-# dsb_DE UTF-8 # Lower Sorbian (Germany)
-# dv_MV UTF-8 # Divehi (Maldives)
-# dz_BT UTF-8 # Dzongkha (Bhutan)
-# el_GR.UTF-8 UTF-8 # Greek (Greece)
-# el_CY.UTF-8 UTF-8 # Greek (Cyprus)
-# en_AG UTF-8 # English (Antigua & Barbuda)
-# en_AU.UTF-8 UTF-8 # Australian English (Australia)
-# en_BW.UTF-8 UTF-8 # English (Botswana)
-# en_CA.UTF-8 UTF-8 # Canadian English (Canada)
-# en_DK.UTF-8 UTF-8 # English (Denmark)
-# en_GB.UTF-8 UTF-8 # British English (United Kingdom)
-# en_HK.UTF-8 UTF-8 # English (Hong Kong SAR China)
-# en_IE.UTF-8 UTF-8 # English (Ireland)
-# en_IL UTF-8 # English (Israel)
-# en_IN UTF-8 # English (India)
-# en_NG UTF-8 # English (Nigeria)
-# en_NZ.UTF-8 UTF-8 # English (New Zealand)
-# en_PH.UTF-8 UTF-8 # English (Philippines)
-# en_SC.UTF-8 UTF-8 # English (Seychelles)
-# en_SG.UTF-8 UTF-8 # English (Singapore)
-# en_US.UTF-8 UTF-8 # American English (United States)
-# en_ZA.UTF-8 UTF-8 # English (South Africa)
-# en_ZM UTF-8 # English (Zambia)
-# en_ZW.UTF-8 UTF-8 # English (Zimbabwe)
-# eo UTF-8 # Esperanto
-# es_AR.UTF-8 UTF-8 # Spanish (Argentina)
-# es_BO.UTF-8 UTF-8 # Spanish (Bolivia)
-# es_CL.UTF-8 UTF-8 # Spanish (Chile)
-# es_CO.UTF-8 UTF-8 # Spanish (Colombia)
-# es_CR.UTF-8 UTF-8 # Spanish (Costa Rica)
-# es_CU UTF-8 # Spanish (Cuba)
-# es_DO.UTF-8 UTF-8 # Spanish (Dominican Republic)
-# es_EC.UTF-8 UTF-8 # Spanish (Ecuador)
-# es_ES.UTF-8 UTF-8 # European Spanish (Spain)
-# es_GT.UTF-8 UTF-8 # Spanish (Guatemala)
-# es_HN.UTF-8 UTF-8 # Spanish (Honduras)
-# es_MX.UTF-8 UTF-8 # Mexican Spanish (Mexico)
-# es_NI.UTF-8 UTF-8 # Spanish (Nicaragua)
-# es_PA.UTF-8 UTF-8 # Spanish (Panama)
-# es_PE.UTF-8 UTF-8 # Spanish (Peru)
-# es_PR.UTF-8 UTF-8 # Spanish (Puerto Rico)
-# es_PY.UTF-8 UTF-8 # Spanish (Paraguay)
-# es_SV.UTF-8 UTF-8 # Spanish (El Salvador)
-# es_US.UTF-8 UTF-8 # Spanish (United States)
-# es_UY.UTF-8 UTF-8 # Spanish (Uruguay)
-# es_VE.UTF-8 UTF-8 # Spanish (Venezuela)
-# et_EE.UTF-8 UTF-8 # Estonian (Estonia)
-# eu_ES.UTF-8 UTF-8 # Basque (Spain)
-# fa_IR UTF-8 # Persian (Iran)
-# ff_SN UTF-8 # Fulah (Senegal)
-# fi_FI.UTF-8 UTF-8 # Finnish (Finland)
-# fil_PH UTF-8 # Filipino (Philippines)
-# fo_FO.UTF-8 UTF-8 # Faroese (Faroe Islands)
-# fr_BE.UTF-8 UTF-8 # French (Belgium)
-# fr_CA.UTF-8 UTF-8 # Canadian French (Canada)
-# fr_CH.UTF-8 UTF-8 # Swiss French (Switzerland)
-# fr_FR.UTF-8 UTF-8 # French (France)
-# fr_LU.UTF-8 UTF-8 # French (Luxembourg)
-# fur_IT UTF-8 # Friulian (Italy)
-# fy_NL UTF-8 # Western Frisian (Netherlands)
-# fy_DE UTF-8 # Western Frisian (Germany)
-# ga_IE.UTF-8 UTF-8 # Irish (Ireland)
-# gbm_IN UTF-8 # Garhwali (India)
-# gd_GB.UTF-8 UTF-8 # Scottish Gaelic (United Kingdom)
-# gez_ER UTF-8 # Geez (Eritrea)
-# gez_ER@abegede UTF-8 # Geez (Eritrea)
-# gez_ET UTF-8 # Geez (Ethiopia)
-# gez_ET@abegede UTF-8 # Geez (Ethiopia)
-# gl_ES.UTF-8 UTF-8 # Galician (Spain)
-# gu_IN UTF-8 # Gujarati (India)
-# gv_GB.UTF-8 UTF-8 # Manx (United Kingdom)
-# ha_NG UTF-8 # Hausa (Nigeria)
-# hak_TW UTF-8 # Hakka Chinese (Taiwan)
-# he_IL.UTF-8 UTF-8 # Hebrew (Israel)
-# hi_IN UTF-8 # Hindi (India)
-# hif_FJ UTF-8 # Fiji Hindi (Fiji)
-# hne_IN UTF-8 # Chhattisgarhi (India)
-# hr_HR.UTF-8 UTF-8 # Croatian (Croatia)
-# hsb_DE.UTF-8 UTF-8 # Upper Sorbian (Germany)
-# ht_HT UTF-8 # Haitian Creole (Haiti)
-# hu_HU.UTF-8 UTF-8 # Hungarian (Hungary)
-# hy_AM UTF-8 # Armenian (Armenia)
-# ia_FR UTF-8 # Interlingua (France)
-# id_ID.UTF-8 UTF-8 # Indonesian (Indonesia)
-# ig_NG UTF-8 # Igbo (Nigeria)
-# ik_CA UTF-8 # Inupiaq (Canada)
-# is_IS.UTF-8 UTF-8 # Icelandic (Iceland)
-# it_CH.UTF-8 UTF-8 # Italian (Switzerland)
-# it_IT.UTF-8 UTF-8 # Italian (Italy)
-# iu_CA UTF-8 # Inuktitut (Canada)
-# ja_JP.UTF-8 UTF-8 # Japanese (Japan)
-# ka_GE.UTF-8 UTF-8 # Georgian (Georgia)
-# kab_DZ UTF-8 # Kabyle (Algeria)
-# kk_KZ.UTF-8 UTF-8 # Kazakh (Kazakhstan)
-# kl_GL.UTF-8 UTF-8 # Kalaallisut (Greenland)
-# km_KH UTF-8 # Khmer (Cambodia)
-# kn_IN UTF-8 # Kannada (India)
-# ko_KR.UTF-8 UTF-8 # Korean (South Korea)
-# kok_IN UTF-8 # Konkani (India)
-# ks_IN UTF-8 # Kashmiri (India)
-# ks_IN@devanagari UTF-8 # Kashmiri (India)
-# ku_TR.UTF-8 UTF-8 # Kurdish (Turkey)
-# kv_RU UTF-8 # Komi (Russia)
-# kw_GB.UTF-8 UTF-8 # Cornish (United Kingdom)
-# ky_KG UTF-8 # Kyrgyz (Kyrgyzstan)
-# lb_LU UTF-8 # Luxembourgish (Luxembourg)
-# lg_UG.UTF-8 UTF-8 # Ganda (Uganda)
-# li_BE UTF-8 # Limburgish (Belgium)
-# li_NL UTF-8 # Limburgish (Netherlands)
-# lij_IT UTF-8 # Ligurian (Italy)
-# ln_CD UTF-8 # Lingala (Democratic Republic of the Congo)
-# lo_LA UTF-8 # Lao (Laos)
-# lt_LT.UTF-8 UTF-8 # Lithuanian (Lithuania)
-# ltg_LV.UTF-8 UTF-8 # Latgalian (Latvia)
-# lv_LV.UTF-8 UTF-8 # Latvian (Latvia)
-# lzh_TW UTF-8 # Literary Chinese (Taiwan)
-# mag_IN UTF-8 # Magahi (India)
-# mai_IN UTF-8 # Maithili (India)
-# mai_NP UTF-8 # Maithili (Nepal)
-# mdf_RU UTF-8 # Moksha (Russia)
-# mfe_MU UTF-8 # Morisyen (Mauritius)
-# mg_MG.UTF-8 UTF-8 # Malagasy (Madagascar)
-# mhr_RU UTF-8 # Meadow Mari (Russia)
-# mi_NZ.UTF-8 UTF-8 # Maori (New Zealand)
-# miq_NI UTF-8 # Miskito (Nicaragua)
-# mjw_IN UTF-8 # Karbi (India)
-# mk_MK.UTF-8 UTF-8 # Macedonian (Macedonia)
-# ml_IN UTF-8 # Malayalam (India)
-# mn_MN UTF-8 # Mongolian (Mongolia)
-# mni_IN UTF-8 # Manipuri (India)
-# mnw_MM UTF-8 # Mon (Myanmar/Burma)
-# mr_IN UTF-8 # Marathi (India)
-# ms_MY.UTF-8 UTF-8 # Malay (Malaysia)
-# mt_MT.UTF-8 UTF-8 # Maltese (Malta)
-# my_MM UTF-8 # Burmese (Myanmar/Burma)
-# nan_TW UTF-8 # Min Nan Chinese (Taiwan)
-# nan_TW@latin UTF-8 # Min Nan Chinese (Taiwan)
-# nb_NO.UTF-8 UTF-8 # Norwegian Bokmål (Norway)
-# nds_DE UTF-8 # Low German (Germany)
-# nds_NL UTF-8 # Low Saxon (Netherlands)
-# ne_NP UTF-8 # Nepali (Nepal)
-# nhn_MX UTF-8 # Central Nahuatl (Mexico)
-# niu_NU UTF-8 # Niuean (Niue)
-# niu_NZ UTF-8 # Niuean (New Zealand)
-# nl_AW UTF-8 # Dutch (Aruba)
-# nl_BE.UTF-8 UTF-8 # Flemish (Belgium)
-# nl_NL.UTF-8 UTF-8 # Dutch (Netherlands)
-# nn_NO.UTF-8 UTF-8 # Norwegian Nynorsk (Norway)
-# nr_ZA UTF-8 # South Ndebele (South Africa)
-# nso_ZA UTF-8 # Northern Sotho (South Africa)
-# oc_FR.UTF-8 UTF-8 # Occitan (France)
-# om_ET UTF-8 # Oromo (Ethiopia)
-# om_KE.UTF-8 UTF-8 # Oromo (Kenya)
-# or_IN UTF-8 # Odia (India)
-# os_RU UTF-8 # Ossetic (Russia)
-# pa_IN UTF-8 # Punjabi (India)
-# pa_PK UTF-8 # Punjabi (Pakistan)
-# pap_AW UTF-8 # Papiamento (Aruba)
-# pap_CW UTF-8 # Papiamento (Curaçao)
-# pl_PL.UTF-8 UTF-8 # Polish (Poland)
-# ps_AF UTF-8 # Pashto (Afghanistan)
-# pt_BR.UTF-8 UTF-8 # Brazilian Portuguese (Brazil)
-# pt_PT.UTF-8 UTF-8 # European Portuguese (Portugal)
-# quz_PE UTF-8 # Cusco Quechua (Peru)
-# raj_IN UTF-8 # Rajasthani (India)
-# rif_MA UTF-8 # Tarifit (Morocco)
-# ro_RO.UTF-8 UTF-8 # Romanian (Romania)
-# ru_RU.UTF-8 UTF-8 # Russian (Russia)
-# ru_UA.UTF-8 UTF-8 # Russian (Ukraine)
-# rw_RW UTF-8 # Kinyarwanda (Rwanda)
-# sa_IN UTF-8 # Sanskrit (India)
-# sah_RU UTF-8 # Sakha (Russian Federation)
-# sat_IN UTF-8 # Santali (India)
-# sc_IT UTF-8 # Sardinian (Italy)
-# scn_IT UTF-8 # Sicilian (Italy)
-# sd_IN UTF-8 # Sindhi (India)
-# sd_IN@devanagari UTF-8 # Sindhi (India)
-# se_NO UTF-8 # Northern Sami (Norway)
-# sgs_LT UTF-8 # Samogitian (Lithuania)
-# shn_MM UTF-8 # Shan (Myanmar/Burma)
-# shs_CA UTF-8 # Shuswap (Canada)
-# si_LK UTF-8 # Sinhala (Sri Lanka)
-# sid_ET UTF-8 # Sidamo (Ethiopia)
-# sk_SK.UTF-8 UTF-8 # Slovak (Slovakia)
-# sl_SI.UTF-8 UTF-8 # Slovenian (Slovenia)
-# sm_WS UTF-8 # Samoan (Samoa)
-# so_DJ.UTF-8 UTF-8 # Somali (Djibouti)
-# so_ET UTF-8 # Somali (Ethiopia)
-# so_KE.UTF-8 UTF-8 # Somali (Kenya)
-# so_SO.UTF-8 UTF-8 # Somali (Somalia)
-# sq_AL.UTF-8 UTF-8 # Albanian (Albania)
-# sq_MK UTF-8 # Albanian (Macedonia)
-# sr_ME UTF-8 # Serbian (Montenegro)
-# sr_RS UTF-8 # Serbian (Serbia)
-# sr_RS@latin UTF-8 # Serbian (Serbia)
-# ss_ZA UTF-8 # Swati (South Africa)
-# ssy_ER UTF-8 # Saho (Eritrea)
-# st_ZA.UTF-8 UTF-8 # Southern Sotho (South Africa)
-# su_ID UTF-8 # Sundanese (Indonesia)
-# sv_FI.UTF-8 UTF-8 # Swedish (Finland)
-# sv_SE.UTF-8 UTF-8 # Swedish (Sweden)
-# sw_KE UTF-8 # Swahili (Kenya)
-# sw_TZ UTF-8 # Swahili (Tanzania)
-# syr UTF-8 # Syriac
-# szl_PL UTF-8 # Silesian (Poland)
-# ta_IN UTF-8 # Tamil (India)
-# ta_LK UTF-8 # Tamil (Sri Lanka)
-# tcy_IN.UTF-8 UTF-8 # Tulu (India)
-# te_IN UTF-8 # Telugu (India)
-# tg_TJ.UTF-8 UTF-8 # Tajik (Tajikistan)
-# th_TH.UTF-8 UTF-8 # Thai (Thailand)
-# the_NP UTF-8 # Chitwania Tharu (Nepal)
-# ti_ER UTF-8 # Tigrinya (Eritrea)
-# ti_ET UTF-8 # Tigrinya (Ethiopia)
-# tig_ER UTF-8 # Tigre (Eritrea)
-# tk_TM UTF-8 # Turkmen (Turkmenistan)
-# tl_PH.UTF-8 UTF-8 # Tagalog (Philippines)
-# tn_ZA UTF-8 # Tswana (South Africa)
-# to_TO UTF-8 # Tongan (Tonga)
-# tok UTF-8 # Toki Pona
-# tpi_PG UTF-8 # Tok Pisin (Papua New Guinea)
-# tr_CY.UTF-8 UTF-8 # Turkish (Cyprus)
-# tr_TR.UTF-8 UTF-8 # Turkish (Turkey)
-# ts_ZA UTF-8 # Tsonga (South Africa)
-# tt_RU UTF-8 # Tatar (Russia)
-# tt_RU@iqtelif UTF-8 # Tatar (Russia)
-# ug_CN UTF-8 # Uyghur (China)
-# uk_UA.UTF-8 UTF-8 # Ukrainian (Ukraine)
-# unm_US UTF-8 # Unami Delaware (United States)
-# ur_IN UTF-8 # Urdu (India)
-# ur_PK UTF-8 # Urdu (Pakistan)
-# uz_UZ.UTF-8 UTF-8 # Uzbek (Uzbekistan)
-# uz_UZ@cyrillic UTF-8 # Uzbek (Uzbekistan)
-# ve_ZA UTF-8 # Venda (South Africa)
-# vi_VN UTF-8 # Vietnamese (Vietnam)
-# wa_BE.UTF-8 UTF-8 # Walloon (Belgium)
-# wae_CH UTF-8 # Walser (Switzerland)
-# wal_ET UTF-8 # Wolaytta (Ethiopia)
-# wo_SN UTF-8 # Wolof (Senegal)
-# xh_ZA.UTF-8 UTF-8 # Xhosa (South Africa)
-# yi_US.UTF-8 UTF-8 # Yiddish (United States)
-# yo_NG UTF-8 # Yoruba (Nigeria)
-# yue_HK UTF-8 # Cantonese (Hong Kong SAR China)
-# yuw_PG UTF-8 # Yau (Papua New Guinea)
-# zgh_MA UTF-8 # Moroccan Tamazight (Morocco)
-# zh_CN.UTF-8 UTF-8 # Chinese (China)
-# zh_HK.UTF-8 UTF-8 # Chinese (Hong Kong SAR China)
-# zh_SG.UTF-8 UTF-8 # Chinese (Singapore)
-# zh_TW.UTF-8 UTF-8 # Chinese (Taiwan)
-# zu_ZA.UTF-8 UTF-8 # Zulu (South Africa)
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:42 UTC (permalink / raw
To: gentoo-commits
commit: 8124a2fecf661acb219330c98a9aa2e482492a5c
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 23:17:42 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 23:42:05 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=8124a2fe
Bump $VERSION to 3.4
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 96e54ec..16bcc00 100755
--- a/locale-gen
+++ b/locale-gen
@@ -21,7 +21,7 @@ use experimental qw(try);
my $PROGRAM;
BEGIN { $PROGRAM = (splitpath(__FILE__))[-1]; }
-my $VERSION = '3.3';
+my $VERSION = '3.4';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: ac1c7987b4fac9327ee8764786d9fa802545e1fa
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 22:48:40 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:48:40 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=ac1c7987
Refine the wording of the comment preceding I18NPATH assignment
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 f7812aa..96e54ec 100755
--- a/locale-gen
+++ b/locale-gen
@@ -52,7 +52,7 @@ umask 0022;
# Ensure that locale/charmap files are opened relative to the prefix.
# It is especially important to do so in situations where the value of
- # $prefix is something other than "" or "/".
+ # $prefix is neither <slash> nor an empty string.
$ENV{'I18NPATH'} = catdir($prefix, '/usr/share/i18n');
# For the directory to be unknown strongly implies the absence of glibc.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: d9a99681c4fa8f11010087ae938752d489be2223
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 20:42:40 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:44:46 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=d9a99681
Compose an array of canonicals before passing to generate_archive()
Construct an array of canonical locale names before passing the array as
a parameter list to the generate_archive() subroutine. Though the array
is not truly needed, this should render the code easier for the casual
observer to understand.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index 236f8fc..f7812aa 100755
--- a/locale-gen
+++ b/locale-gen
@@ -112,7 +112,10 @@ umask 0022;
generate_locales($opt{'jobs'}, @locales);
# Integrate the newly compiled locales into the system's locale archive.
- my $size = generate_archive($prefix, $gentoo_prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
+ my $size = do {
+ my @canonicals = map +( $_->[2] ), @locales;
+ generate_archive($prefix, $gentoo_prefix, $locale_dir, $opt{'update'}, @canonicals);
+ };
my $total = scalar @locales + scalar %installed_by;
printf "Successfully installed an archive containing %d locale%s, of %s MiB in size.\n",
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: 584ff491608907197112649e72214fdb0ae659f7
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 06:22:56 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:44:42 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=584ff491
Have render_printable() load JSON::PP on demand
Presently, the render_printable() subroutine calls the encode() method
of the JSON::PP subroutine. Given that this only occurs in the course of
throwing certain exceptions, load the JSON::PP module at that juncture.
See-also: 3a2dbe021877709c97708f0b2ebf4af53532053e
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 8bcbb05..236f8fc 100755
--- a/locale-gen
+++ b/locale-gen
@@ -13,7 +13,6 @@ use Fcntl qw(SEEK_SET);
use File::Spec::Functions qw(canonpath catfile catdir splitpath);
use File::Temp qw(tempdir);
use Getopt::Long ();
-use JSON::PP ();
# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
use experimental qw(try);
@@ -594,6 +593,7 @@ sub redirect_stderr ($stderr, $callback) {
}
sub render_printable ($value) {
+ require JSON::PP;
return JSON::PP->new->ascii->space_after->encode($value)
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: f8ce3f7a7ba2f25b3b60fd27a63215b2243d9c79
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 22:55:18 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:56:45 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f8ce3f7a
locale-gen.8: mention locales and charmaps under FILES
Mention the existence of the /usr/share/i18n/locales and
/usr/share/i18n/charmaps directories within the FILES section of the
locale-gen(8) man page, not only the locale.gen(5) man page. This helps
to contextualise the sentence that is used to describe the behaviour of
the --prefix option.
"Treat FILES as being relative to the specified prefix"
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 8 +++++++-
locale.gen.5 | 4 ++--
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index a461a9a..62e6c97 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -54,10 +54,16 @@ Write out some details regarding the program then exit.
Specifies the locales to be compiled.
.TP
.I /usr/share/i18n/SUPPORTED
-A list of officially supported locales.
+Specifies the officially supported locales.
.TP
.I /usr/lib/locale/locale\-archive
Contains the currently installed locales.
+.TP
+.I /usr/share/i18n/locales
+Contains locale definition files that serve as inputs to \fBlocaledef\fR(1).
+.TP
+.I /usr/share/i18n/charmaps
+Contains character map files that serve as inputs to \fBlocaledef\fR(1).
.SH "ENVIRONMENT"
.TP
LOCALEGEN_CONFIG
diff --git a/locale.gen.5 b/locale.gen.5
index c4134e4..b8eab26 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -52,10 +52,10 @@ The default location of the configuration file.
A list of supported \fIlocalename\fR and \fIcharmap\fR combinations.
.TP
.I /usr/share/i18n/locales
-Contains locale definition files that can serve as inputs to \fBlocaledef\fR(1).
+Contains locale definition files that serve as inputs to \fBlocaledef\fR(1).
.TP
.I /usr/share/i18n/charmaps
-Contains character map files that can serve as inputs to \fBlocaledef\fR(1).
+Contains character map files that serve as inputs to \fBlocaledef\fR(1).
.SH "SEE ALSO"
.BR locale (1),
.BR localedef (1),
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: c6428f222ec719c2b0c4a7f6d5268dcec33f56ba
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 23:04:50 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 23:04:50 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=c6428f22
locale-gen.8: document the behaviour of "-" as a -c option-arg
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 62e6c97..6f725a5 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -29,7 +29,7 @@ If the configuration file is missing, empty, or consists only of comments, local
Compile all locales that are officially supported by glibc. Cannot be combined with the \fB-c\fR option.
.TP
\fB\-c\fR, \fB\-\-config\fR \fIconfig\fR
-Read the given \fIconfig\fR file (defaults to \fIprefix\fR/etc/locale.gen). If the LOCALEGEN_CONFIG variable is found to be set in the environment, and neither the \fB-A\fR nor \fB-c\fR option is specified, its value shall be taken as the \fIconfig\fR file path instead.
+Read the given \fIconfig\fR file (defaults to \fIprefix\fR/etc/locale.gen). The file may be specified as <hyphen-minus>, in which case locale\-gen shall read the configuration from standard input. If the LOCALEGEN_CONFIG variable is found to be set in the environment, and neither the \fB-A\fR nor \fB-c\fR option is specified, its value shall be taken as a literal \fIconfig\fR file path.
.TP
\fB\-h\fR, \fB\-\-help\fR
Write out a synopsis and summary of the supported options then exit.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: 3a2dbe021877709c97708f0b2ebf4af53532053e
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 21 12:03:40 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 21 12:03:40 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=3a2dbe02
Simplify the render_printable() subroutine
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 5eb73fc..8c1fd53 100755
--- a/locale-gen
+++ b/locale-gen
@@ -601,8 +601,7 @@ sub redirect_stderr ($stderr, $callback) {
}
sub render_printable ($value) {
- my $coder = JSON::PP->new->ascii->space_after;
- return $coder->encode($value);
+ return JSON::PP->new->ascii->space_after->encode($value)
}
sub run ($cmd, @args) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: 8d83f01b0548d5b3ff29bb81ec6af4e1a8aa84a0
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 20 03:10:57 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 20 03:10:57 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=8d83f01b
Clarify a comment preceding the setting of I18NPATH
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index 7e0d9ba..03527f6 100755
--- a/locale-gen
+++ b/locale-gen
@@ -61,7 +61,8 @@ umask 0022;
my $prefix = $opt{'prefix'} // $gentoo_prefix;
# Ensure that locale/charmap files are opened relative to the prefix.
- # This is important in situations where the --prefix option is given.
+ # It is especially important to do so in situations where the value of
+ # $prefix is something other than "" or "/".
$ENV{'I18NPATH'} = catdir($prefix, '/usr/share/i18n');
# For the directory to be unknown strongly implies the absence of glibc.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: f783e065ed0bfba4432a435ae68274dd0f099087
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 06:22:42 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:24:29 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f783e065
Specify the /n regex modifier where appropriate
There are two instances in which a regular expression incorporating
capturing parentheses is matched against, where nothing actually
requires capturing. Specify the /n modifier for these.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 2c551ad..8bcbb05 100755
--- a/locale-gen
+++ b/locale-gen
@@ -333,7 +333,7 @@ sub parse_config ($fh, $path, $locale_by, $charmap_by) {
while (my $line = readline $fh) {
# Skip comments and blank lines. Note that \h will match only
# " " and "\t", since the input stream is not being decoded.
- next if $line =~ m/^\h*($|#)/;
+ next if $line =~ m/^\h*($|#)/n;
# Permit comments trailing locale declarations.
$line =~ s/\h\K#\h.*//;
@@ -565,7 +565,7 @@ sub run_localedef ($archive_prefix, @args) {
sub fopen ($path, $mode = '<') {
if (! open my $fh, $mode, $path) {
die "$PROGRAM: Can't open '$path': $!\n";
- } elsif (! -f $fh && canonpath($path) !~ m/^\/dev\/(null|stdin)\z/) {
+ } elsif (! -f $fh && canonpath($path) !~ m/^\/dev\/(null|stdin)\z/n) {
die "$PROGRAM: Won't open '$path' because it is not a regular file\n";
} else {
return $fh;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: 309e763e5f6da8fd38c5e5ab58788f103d7b6495
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 20 03:13:47 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 20 03:13:47 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=309e763e
Simplify an exit call
Perl considers "exit" as "exit 0".
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 03527f6..5eb73fc 100755
--- a/locale-gen
+++ b/locale-gen
@@ -109,7 +109,7 @@ umask 0022;
# If a non-actionable update was requested, proceed no further.
if (! @locales) {
print "All of the requested locales are presently installed.\n";
- exit 0;
+ exit;
}
# A proxy check is justified because compilation may take a long time.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: 5d770d578e34cfeee5e23d8e52ecd6434c46e1fd
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 21 14:34:54 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 21 14:34:54 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=5d770d57
Don't bother loading and using List::Util
As useful as the List::Util module can be, it's not worth loading it for
the sole purpose of clamping $workers to $total.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 8c1fd53..33dad6e 100755
--- a/locale-gen
+++ b/locale-gen
@@ -14,7 +14,6 @@ use File::Spec::Functions qw(canonpath catfile catdir splitpath);
use File::Temp qw(tempdir);
use Getopt::Long ();
use JSON::PP ();
-use List::Util qw(min);
use POSIX qw(LC_ALL setlocale);
# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
@@ -424,7 +423,9 @@ sub generate_locales ($workers, @locales) {
local @SIG{'INT', 'TERM'} = ($handler, $handler);
my $total = scalar @locales;
- $workers = min($workers, $total);
+ if ($total < $workers) {
+ $workers = $total;
+ }
printf "Compiling %d locale%s with %d worker%s ...\n",
$total, plural($total), $workers, plural($workers);
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: 04c08067b15933d195d8500eefdc363cb46c1b32
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 05:37:33 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:24:29 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=04c08067
Refrain from calling POSIX::setlocale()
Presently, the POSIX::setlocale() subroutine is used to determine the
currently effective locale. If found to be 'C', the 'LANG' environment
variable shall be unset, along with all variables bearing a prefix of
'LC_'. The idea is to prevent locale-aware subprocesses from trying to
call setlocale(3) to activate a locale that is not yet available.
However, I was recently able to make the Perl 5.40.2 interpreter panic.
Executing: locale-gen '--prefix' '/home/gentoo/gentoo/var/tmp/portage/sy
s-libs/glibc-2.41-r4/image/home/gentoo/gentoo' '--jobs' '12'
locale.c: 3126: panic: Internal length calculation wrong.
"C.utf8" was not entirely added to "C.utf8;C.utf8;C.utf8;C.utf8;C.utf8;C
.utf8;C.utf8;C.utf8;C.utf8;C.utf8;C.ut"; needed=76, had=75; errno=0
Called by locale.c: 4393
* ERROR: sys-libs/glibc-2.41-r4::gentoo failed (install phase):
* locale-gen(1) unexpectedly failed during the src_install phase
Upon the first occurrence of this, I issued the very same locale-gen(8)
command from my interactive shell without issue. I was able to reproduce
the panic several more times, always by building sys-libs/glibc with
portage. Unfortunately, during the course of my investigation, there
came a point at which I was no longer able to reproduce the issue.
Given that locale-gen(8) needs to be robust, refrain from calling
POSIX::setlocale() until such time as the above matter is clarified.
Where necessary, the utilities executed by locale-gen(8) should quietly
fall back to the C locale anyway.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 8 --------
1 file changed, 8 deletions(-)
diff --git a/locale-gen b/locale-gen
index 146a545..2c551ad 100755
--- a/locale-gen
+++ b/locale-gen
@@ -14,7 +14,6 @@ use File::Spec::Functions qw(canonpath catfile catdir splitpath);
use File::Temp qw(tempdir);
use Getopt::Long ();
use JSON::PP ();
-use POSIX qw(LC_ALL setlocale);
# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
use experimental qw(try);
@@ -29,13 +28,6 @@ my $DEFERRED_SIGNAL = '';
my $PID = $$;
my $TEMPDIR;
-# For the C locale to be in effect can be a consequence of the user's chosen
-# locale not yet being available. That being the case, unset all environment
-# variables pertaining to locale handling for the benefit of any subprocesses.
-if (setlocale(LC_ALL) eq 'C') {
- delete @ENV{ grep +( m/^(LANG\z|LC_)/ ), keys %ENV };
-}
-
# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it.
delete $ENV{'BASH_ENV'};
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: e0f280f3aa0d52f16f6af2f58b3fdcb3715573a8
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 21 23:15:53 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:23:16 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=e0f280f3
Reduce the extent to which render_printable() is used
Presently, there are diagnostic messages in which pathnames are enclosed
by single quotes, and others that use the render_printable() subroutine
to convert to ASCII-constrained JSON, duly enclosing them within double
quotes. Partly address this inconsistency by refraining from calling
render_printable() other than in the following three cases.
1) throwing from normalize() for malformed locale names
2) throwing from read_config() where no locale entries were found
3) throwing from parse_config()
There remains an inconsistency in that the second of these cases
continues to render pathnames as JSON. I have let it be because it is
useful to be able to render the entirety of the @paths array in an
unambiguous fashion.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index 33dad6e..146a545 100755
--- a/locale-gen
+++ b/locale-gen
@@ -292,8 +292,8 @@ sub read_config ($prefix, @paths) {
}
my @locales = parse_config($fh, $path, \%locale_by, \%charmap_by);
if (my $count = scalar @locales) {
- printf "Found %d locale declaration%s in %s.\n",
- $count, plural($count), render_printable($path);
+ printf "Found %d locale declaration%s in '%s'.\n",
+ $count, plural($count), $path;
return @locales;
}
}
@@ -491,7 +491,7 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
# Determine the eventual destination path of the archive.
my $final_path = catfile($prefix, $locale_dir, 'locale-archive');
- printf "The location of the archive shall be %s.\n", render_printable($final_path);
+ print "The location of the archive shall be '$final_path'.\n";
# If --update was specified, make a copy of the existing archive.
if ($do_update && -e $final_path) {
@@ -616,9 +616,8 @@ sub throw_child_error ($cmd, $status = $?) {
# have printed a warning, no supplemental diagnostic is needed.
exit 1;
} elsif ($status != 0) {
- my $printable_cmd = render_printable($cmd);
my $fate = ($status & 0x7F) ? 'interrupted by a signal' : 'unsuccessful';
- die "$PROGRAM: Aborting because the execution of $printable_cmd was $fate\n";
+ die "$PROGRAM: Aborting because the execution of '$cmd' was $fate\n";
}
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-22 23:12 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-22 23:12 UTC (permalink / raw
To: gentoo-commits
commit: 40076405be04550a89eca017e76591b5c3e210b8
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 20 03:02:51 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 20 03:02:51 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=40076405
Clarify the behaviour of the --prefix option in run_localedef()
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/locale-gen b/locale-gen
index 8d9fc94..7e0d9ba 100755
--- a/locale-gen
+++ b/locale-gen
@@ -549,10 +549,11 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
}
}
-sub run_localedef ($prefix, @args) {
- # Incorporate the --prefix option, if requested.
- if (length $prefix) {
- unshift @args, '--prefix', $prefix;
+sub run_localedef ($archive_prefix, @args) {
+ # Incorporate the --prefix option, if requested. Its only effect is to
+ # cause localedef(1) to prepend the option-arg to the archive path.
+ if (length $archive_prefix) {
+ unshift @args, '--prefix', $archive_prefix;
}
# Prevent the --verbose option from being potentially implied.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-20 2:39 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-20 2:39 UTC (permalink / raw
To: gentoo-commits
commit: a11addf203d3ee4d043f5dc1aca9451ec98166a9
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 19 15:42:53 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 19 15:42:53 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=a11addf2
mkconfig: use read_lines() to read the SUPPORTED file
Use the read_lines() method of File::Slurper to consume the SUPPORTED
file. Doing so might use a little more memory than does reading line by
line. However, it confers the advantage of decoding the input as UTF-8
and throwing an exception if malformed.
See-also: 945525e71206428f87f94b839fe4ce36b9d85e1e
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/mkconfig b/mkconfig
index c455a54..b52beb5 100755
--- a/mkconfig
+++ b/mkconfig
@@ -13,15 +13,15 @@ use v5.36;
use File::Spec::Functions qw(catdir catfile);
use Unicode::Normalize qw(NFKD);
-use File::Slurper qw(read_text);
+use File::Slurper qw(read_lines read_text);
{
# The first argument shall be treated as a prefix, if any.
my $prefix = @ARGV ? $ARGV[0] : '';
- # Open the file containing the supported locale/charmap combinations.
+ # Read the file containing the supported locale/charmap combinations.
my $path = catfile($prefix, '/usr/share/i18n', 'SUPPORTED');
- open my $fh, '<', $path or die "Can't open '$path': $!";
+ my @lines = read_lines($path);
# Gather the language and territory attributes of the locale templates.
my $attr_by = map_locale_attributes($prefix);
@@ -29,7 +29,7 @@ use File::Slurper qw(read_text);
# Use column(1) to write out a nicely columnated list.
my $pipe = open_column("\037");
- while (my $line = readline $fh) {
+ for my $line (@lines) {
my ($read_locale, $charmap) = split ' ', $line;
# The names of the templates don't incorporate a codeset part.
@@ -51,7 +51,6 @@ use File::Slurper qw(read_text);
printf {$pipe} "# %s\037%s\037# %s\n", $read_locale, $charmap, $comment;
}
}
- close $fh;
close $pipe or exit 1;
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-20 2:39 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-20 2:39 UTC (permalink / raw
To: gentoo-commits
commit: 545e4af5d2b50214998351268d2ba4844e9c48af
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 20 02:34:26 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 20 02:36:01 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=545e4af5
Support charmaps compressed with bzip2
Character map files may be uncompressed, compressed with gzip, or
compressed with bzip2. Revise the get_valid_charmaps() subroutine so
that it is able to handle the latter case.
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 3f21196..8d9fc94 100755
--- a/locale-gen
+++ b/locale-gen
@@ -323,7 +323,7 @@ sub get_valid_charmaps ($prefix) {
my $top = catdir($prefix, '/usr/share/i18n/charmaps');
if (! opendir my $dh, $top) {
die "$PROGRAM: Can't open '$top' for reading: $!\n";
- } elsif (! (my @names = map +( -f "$top/$_" ? s/\.gz\z//r : () ), readdir $dh)) {
+ } elsif (! (my @names = map +( -f "$top/$_" ? s/\.(gz|bz2)\z//nr : () ), readdir $dh)) {
die "$PROGRAM: Failed to compose a list of valid character maps from '$top'\n";
} else {
return @names;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-19 13:37 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-19 13:37 UTC (permalink / raw
To: gentoo-commits
commit: 576f604108368b021237e4607e2624375adf17e5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 19 13:29:50 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 19 13:33:33 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=576f6041
mkconfig: ensure column(1) considers its input stream as US-ASCII
In the course of executing column(1), ensure that LC_ALL=C is set in its
environment so that the appropriate character type is in effect.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/mkconfig b/mkconfig
index fa42452..c455a54 100755
--- a/mkconfig
+++ b/mkconfig
@@ -26,10 +26,8 @@ use File::Slurper qw(read_text);
# Gather the language and territory attributes of the locale templates.
my $attr_by = map_locale_attributes($prefix);
- # Use column(1) to write out a nicely columnated list. The encoding is
- # applied as a precaution; should any wide characters unexpectedly slip
- # through, they shall be backslash-escaped e.g. U+00E5 => "\x{00e5}".
- open my $pipe, "|-:encoding(US-ASCII)", "column -t -s \037" or exit 127;
+ # Use column(1) to write out a nicely columnated list.
+ my $pipe = open_column("\037");
while (my $line = readline $fh) {
my ($read_locale, $charmap) = split ' ', $line;
@@ -107,3 +105,16 @@ sub to_ascii ($str) {
$str =~ s/\p{NonspacingMark}//g;
return $str;
}
+
+sub open_column ($sep) {
+ # Ensure that column(1) considers its input stream as US-ASCII.
+ local $ENV{'LC_ALL'} = 'C';
+
+ # The encoding is applied as a precaution; over-wide characters written
+ # to the pipe become Perl escape sequences e.g. U+00E5 => \x{00e5}.
+ if (! open my $pipe, '|-:encoding(US-ASCII)', 'column', '-ts', $sep) {
+ exit 127;
+ } else {
+ return $pipe;
+ }
+}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-19 13:19 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-19 13:19 UTC (permalink / raw
To: gentoo-commits
commit: 945525e71206428f87f94b839fe4ce36b9d85e1e
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 19 05:21:52 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 19 05:21:52 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=945525e7
mkconfig: always decode the locale files as UTF-8
Through inspecting the glibc release tarballs, it can be seen that the
locale files are always encoded as UTF-8. With that in mind, use the
read_text() method of File::Slurper so that the bytes are always decoded
as UTF-8. In turn, this simplifies the to_ascii() subroutine.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/mkconfig b/mkconfig
index 25a8ad6..fa42452 100755
--- a/mkconfig
+++ b/mkconfig
@@ -10,11 +10,10 @@
# License GPL-2.0-only <https://spdx.org/licenses/GPL-2.0-only.html>
use v5.36;
-use Encode qw(decode);
use File::Spec::Functions qw(catdir catfile);
use Unicode::Normalize qw(NFKD);
-use File::Slurper qw(read_binary);
+use File::Slurper qw(read_text);
{
# The first argument shall be treated as a prefix, if any.
@@ -75,9 +74,9 @@ sub map_locale_attributes ($prefix) {
my %attr_by;
while (my $locale = readdir $dh) {
next if $locale =~ m/^\./;
- my $data = read_binary("$top/$locale");
+ my $data = read_text("$top/$locale");
if ($data =~ $regex) {
- my ($language, $territory) = ($1, $2);
+ my ($language, $territory) = ($1, ucfirst $2);
for ($language, $territory) {
if (m/[^\p{ASCII}]/) {
$_ = to_ascii($_);
@@ -94,18 +93,17 @@ sub map_locale_attributes ($prefix) {
}
$attr_by{$locale} = {
'language' => $language,
- 'territory' => ucfirst $territory
+ 'territory' => $territory
};
}
}
return \%attr_by;
}
-sub to_ascii ($bytes) {
+sub to_ascii ($str) {
# This behaves similarly to "iconv -f UTF-8 -t US-ASCII//TRANSLIT". At
# least, to a degree that is sufficient for the inputs being processed.
- my $chars = decode('UTF-8', $bytes, Encode::FB_CROAK);
- $chars = NFKD($chars);
- $chars =~ s/\p{NonspacingMark}//g;
- return $chars;
+ $str = NFKD($str);
+ $str =~ s/\p{NonspacingMark}//g;
+ return $str;
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-18 2:46 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-18 2:46 UTC (permalink / raw
To: gentoo-commits
commit: 943eb812b612dfef3facaef54cc86b457ff3b2d9
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 18 01:35:30 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 18 01:35:30 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=943eb812
Claim to be compiling "locales" rather than "locale definition files"
To count locales as "locale definition files" isn't strictly correct.
For instance, to compile the en_US.UTF-8 and en_US.ISO-8859-1 locales
would entail opening the /usr/share/i18n/locales/en_US file both times.
Use the term, locales, instead.
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 56ab9f3..3f21196 100755
--- a/locale-gen
+++ b/locale-gen
@@ -424,7 +424,7 @@ sub generate_locales ($workers, @locales) {
my $total = scalar @locales;
$workers = min($workers, $total);
- printf "Compiling %d locale definition file%s with %d worker%s ...\n",
+ printf "Compiling %d locale%s with %d worker%s ...\n",
$total, plural($total), $workers, plural($workers);
my $num_width = length $total;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-18 1:18 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-18 1:18 UTC (permalink / raw
To: gentoo-commits
commit: f4c8321de860badb72363f26ece35b0105922dc3
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 18 00:47:16 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 18 00:47:16 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f4c8321d
Report the file from which the locales are chosen
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index b3052ed..56ab9f3 100755
--- a/locale-gen
+++ b/locale-gen
@@ -290,7 +290,10 @@ sub read_config ($prefix, @paths) {
die $e;
}
}
- if (my @locales = parse_config($fh, $path, \%locale_by, \%charmap_by)) {
+ my @locales = parse_config($fh, $path, \%locale_by, \%charmap_by);
+ if (my $count = scalar @locales) {
+ printf "Found %d locale declaration%s in %s.\n",
+ $count, plural($count), render_printable($path);
return @locales;
}
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-18 1:18 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-18 1:18 UTC (permalink / raw
To: gentoo-commits
commit: f3d88990de718c19996976fbe2bb30bdf58b475e
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 18 01:10:47 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 18 01:17:05 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f3d88990
mkconfig: capitalise first letter of territory *after* decoding
Presently, the map_locale_attributes() subroutine uses ucfirst() to
capitalise the first character of the $territory variable. This happens
at the point that its initial value is captured, before UTF-8 decoding
potentially occurs as a consequence of calling the to_ascii()
subroutine. Instead, ensure that it can only happen after decoding, thus
avoiding the issue demonstrated by the following program.
#!/usr/bin/perl
binmode *STDOUT, ':encoding(US-ASCII)';
my $territory = 'ïmaginary-territory'; # UTF-8 bytes, not characters!
print $territory, "\n";
print ucfirst $territory, "\n";
Running this program produces:
\x{00c3}\x{00af}maginary-territory
\x{00c3}\x{00af}maginary-territory
Had the UTF-8 bytes been decoded to characters first, the program would
have instead produced:
\x{00ef}maginary-territory
\x{00cf}maginary-territory
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mkconfig b/mkconfig
index 5e54dbb..25a8ad6 100755
--- a/mkconfig
+++ b/mkconfig
@@ -77,7 +77,7 @@ sub map_locale_attributes ($prefix) {
next if $locale =~ m/^\./;
my $data = read_binary("$top/$locale");
if ($data =~ $regex) {
- my ($language, $territory) = ($1, ucfirst $2);
+ my ($language, $territory) = ($1, $2);
for ($language, $territory) {
if (m/[^\p{ASCII}]/) {
$_ = to_ascii($_);
@@ -94,7 +94,7 @@ sub map_locale_attributes ($prefix) {
}
$attr_by{$locale} = {
'language' => $language,
- 'territory' => $territory
+ 'territory' => ucfirst $territory
};
}
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-17 2:01 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-17 2:01 UTC (permalink / raw
To: gentoo-commits
commit: f5371db11967838deb85ce0d11ea76f3676ccadd
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 17 01:38:04 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Aug 17 01:56:01 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f5371db1
Ensure that locales/charmaps are opened relative to the prefix
Consider a scenario in which an arbitrary prefix is specified.
# mkdir /var/tmp/rootfs
# cd /
# cp -a --parents usr/share/i18n /var/tmp/rootfs
# locale-gen -c - --prefix /var/tmp/rootfs <<<"C.UTF-8 UTF-8"
Compiling 1 locale definition file with 1 worker ...
[1/1] Compiling locale: C.UTF-8
The location of the archive shall be "/var/tmp/rootfs/usr/lib/locale/locale-archive".
Adding 1 locale to the locale archive ...
Successfully installed an archive containing 1 locale, of 0.46 MiB in size.
At first glance, it would appear that all has gone well. However,
through the use of the strace(1) utility, it can be seen that the
localedef(1) utility is unable to honour the specified prefix in the
course of opening the locale and charmap files.
openat(AT_FDCWD, "/usr/share/i18n/charmaps/UTF-8.gz", O_RDONLY) = 3
openat(AT_FDCWD, "/usr/share/i18n/locales/C", O_RDONLY) = 3
Address this issue by setting the I18NPATH environment variable in
accordance with the specified prefix. With that, it can be seen that the
appropriate files are now opened.
openat(AT_FDCWD, "/var/tmp/rootfs/usr/share/i18n/charmaps/UTF-8.gz", O_RDONLY) = 3
openat(AT_FDCWD, "/var/tmp/rootfs/usr/share/i18n/locales/C", O_RDONLY) = 3
It should be noted that this bug would have been rather difficult to
reproduce in a Gentoo Prefix environment, since its localedef(1) binary
hard-codes the appropriate prefix.
Bug: https://bugs.gentoo.org/785406
Reported-by: Joakim Tjernlund <joakim.tjernlund <AT> nokia.com>
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/locale-gen b/locale-gen
index f0b85fe..b3052ed 100755
--- a/locale-gen
+++ b/locale-gen
@@ -60,6 +60,10 @@ umask 0022;
my %opt = parse_opts($gentoo_prefix, @ARGV);
my $prefix = $opt{'prefix'} // $gentoo_prefix;
+ # Ensure that locale/charmap files are opened relative to the prefix.
+ # This is important in situations where the --prefix option is given.
+ $ENV{'I18NPATH'} = catdir($prefix, '/usr/share/i18n');
+
# For the directory to be unknown strongly implies the absence of glibc.
if (! defined $locale_dir) {
die "$PROGRAM: Aborting because the OS does not appear to use GNU libc\n";
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-16 23:17 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-16 23:17 UTC (permalink / raw
To: gentoo-commits
commit: f91c2b76255afe6baae7f720bc4dd9fe278998df
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 16 20:27:18 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Aug 16 23:16:00 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f91c2b76
Let the config be set by LOCALEGEN_CONFIG in the environment
This commit allows for the config file path to be explicitly specified
by the LOCALEGEN_CONFIG environment variable. Both the -A and -c options
take precedence, so one must refrain from specifying those for the
variable to be considered.
Bug: https://bugs.gentoo.org/961109
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 8 +++++---
locale-gen.8 | 12 ++++++++----
2 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/locale-gen b/locale-gen
index c415529..f0b85fe 100755
--- a/locale-gen
+++ b/locale-gen
@@ -204,10 +204,12 @@ sub select_config_files ($prefix, %opt) {
return do {
if (exists $opt{'config'}) {
$opt{'config'};
- } elsif (! $opt{'all'}) {
- $path1, $path2;
- } else {
+ } elsif ($opt{'all'}) {
$path2;
+ } elsif (exists $ENV{'LOCALEGEN_CONFIG'}) {
+ $ENV{'LOCALEGEN_CONFIG'};
+ } else {
+ $path1, $path2;
}
};
}
diff --git a/locale-gen.8 b/locale-gen.8
index 33342e6..a461a9a 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -22,14 +22,14 @@ The locale\-gen utility provides a means by which a system administrator may con
.P
A default installation of Gentoo Linux provides an archive that contains all supported locales, numbering 500 or more. However, it is typical for an administrator to require only one or two of these. In that case, the \fI/etc/locale.gen\fR configuration file may be populated with a list of the required locales. By default, locale\-gen shall read this file and compile only the locales that are specified, saving both time and space in the longer term.
.P
-If the configuration file is missing, empty, or consists only of comments, locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR option was specified. If specified then locale\-gen shall abort with a suitable diagnostic message. Otherwise, locale\-gen shall act as if the \fB\-A\fR option had been specified.
+If the configuration file is missing, empty, or consists only of comments, locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR option or LOCALEGEN_CONFIG environment variable was specified. If neither was specified, locale\-gen shall act as if the \fB\-A\fR option had been specified. Otherwise, locale\-gen shall abort with a suitable diagnostic message.
.SH "OPTIONS"
.TP
\fB\-A\fR, \fB\-\-all\fR
-Compile all locales that are officially supported by glibc.
+Compile all locales that are officially supported by glibc. Cannot be combined with the \fB-c\fR option.
.TP
\fB\-c\fR, \fB\-\-config\fR \fIconfig\fR
-Read the given \fIconfig\fR file (defaults to /etc/locale.gen).
+Read the given \fIconfig\fR file (defaults to \fIprefix\fR/etc/locale.gen). If the LOCALEGEN_CONFIG variable is found to be set in the environment, and neither the \fB-A\fR nor \fB-c\fR option is specified, its value shall be taken as the \fIconfig\fR file path instead.
.TP
\fB\-h\fR, \fB\-\-help\fR
Write out a synopsis and summary of the supported options then exit.
@@ -38,7 +38,7 @@ Write out a synopsis and summary of the supported options then exit.
Spawn up to the specified number of \fIjobs\fR to compile locales in parallel (defaults to the number of logical processors).
.TP
\fB\-p\fR, \fB\-\-prefix\fR \fIprefix\fR
-Treat most filesystem paths as being relative to the specified \fIprefix\fR (defaults to / if not a Gentoo Prefix system).
+Treat FILES as being relative to the specified \fIprefix\fR (defaults to / if not a Gentoo Prefix system). Where explicitly specified, the \fIconfig\fR file shall be exempted from this behaviour.
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Suppress the writing of informational messages to standard output.
@@ -58,6 +58,10 @@ A list of officially supported locales.
.TP
.I /usr/lib/locale/locale\-archive
Contains the currently installed locales.
+.SH "ENVIRONMENT"
+.TP
+LOCALEGEN_CONFIG
+Defines the path of the \fIconfig\fR file in the absence of the \fB-A\fR and \fB-c\fR options.
.SH "EXIT STATUS"
The exit status shall be 0 under any of these conditions:
.IP \[bu] 2
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-16 23:17 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-16 23:17 UTC (permalink / raw
To: gentoo-commits
commit: dca81b64431c17b2b1920f85e98065f5051f2bd5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 16 20:00:35 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Aug 16 23:15:13 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=dca81b64
locale-gen.8: replace "-d, --prefix" with "-p, --prefix"
Upon the man page being updated to drop the --destdir option in favour
of --prefix, the -d option should also have been dropped in favour of
-p. Rectify this oversight.
Fixes: 9d6d44c0f3aa44ebee45f8c5bea794b3c693edd4
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 4d163dd..33342e6 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -31,15 +31,15 @@ Compile all locales that are officially supported by glibc.
\fB\-c\fR, \fB\-\-config\fR \fIconfig\fR
Read the given \fIconfig\fR file (defaults to /etc/locale.gen).
.TP
-\fB\-d\fR, \fB\-\-prefix\fR \fIprefix\fR
-Treat most filesystem paths as being relative to the specified \fIprefix\fR (defaults to / if not a Gentoo Prefix system).
-.TP
\fB\-h\fR, \fB\-\-help\fR
Write out a synopsis and summary of the supported options then exit.
.TP
\fB\-j\fR, \fB\-\-jobs\fR \fIjobs\fR
Spawn up to the specified number of \fIjobs\fR to compile locales in parallel (defaults to the number of logical processors).
.TP
+\fB\-p\fR, \fB\-\-prefix\fR \fIprefix\fR
+Treat most filesystem paths as being relative to the specified \fIprefix\fR (defaults to / if not a Gentoo Prefix system).
+.TP
\fB\-q\fR, \fB\-\-quiet\fR
Suppress the writing of informational messages to standard output.
.TP
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-16 3:46 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-16 3:46 UTC (permalink / raw
To: gentoo-commits
commit: 1ff7d7b64958183748526fa221a1263ab02b5a91
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 16 03:43:54 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Aug 16 03:43:54 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=1ff7d7b6
mkconfig: don't operate on refs of $language and $territory
Presently, the map_locale_attributes() subroutine creates references of
the $language and $territory variables, so as to be able to loop over -
and operate on - both. Yet one need not bother, since the for keyword
renders the topicaliser a temporary alias of each item in the list.
See-also: 87b724f3b5bf14ade06d3a15123e08677d05efbe
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mkconfig b/mkconfig
index 4397ca3..5e54dbb 100755
--- a/mkconfig
+++ b/mkconfig
@@ -78,9 +78,9 @@ sub map_locale_attributes ($prefix) {
my $data = read_binary("$top/$locale");
if ($data =~ $regex) {
my ($language, $territory) = ($1, ucfirst $2);
- for my $ref (\$language, \$territory) {
- if ($ref->$* =~ m/[^\p{ASCII}]/) {
- $ref->$* = to_ascii($ref->$*);
+ for ($language, $territory) {
+ if (m/[^\p{ASCII}]/) {
+ $_ = to_ascii($_);
}
}
for ($territory) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-15 22:29 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-15 22:29 UTC (permalink / raw
To: gentoo-commits
commit: a9b851aa79d0eed2b34e2a7763bc1ff23f64e598
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 15 22:27:21 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 15 22:28:01 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=a9b851aa
mkconfig: replace "Russian Federation" with "Russia"
Some Russian locales describe the territory as "Russian Federation",
whereas others describe it as "Russia". Given that the ru_RU locale has
it as "Russia", apply that name consistently.
See-also: ee1745e88deda1d3dc57ce7348de3c57fb4830d5
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 2 ++
1 file changed, 2 insertions(+)
diff --git a/mkconfig b/mkconfig
index d69597e..4397ca3 100755
--- a/mkconfig
+++ b/mkconfig
@@ -86,6 +86,8 @@ sub map_locale_attributes ($prefix) {
for ($territory) {
if (m/^Myanmar/) {
$_ = 'Myanmar/Burma';
+ } elsif (m/^Russian Federation\z/) {
+ $_ = 'Russia';
} elsif (m/^Turkiye\z/) {
$_ = 'Turkey';
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-15 22:29 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-15 22:29 UTC (permalink / raw
To: gentoo-commits
commit: 87b724f3b5bf14ade06d3a15123e08677d05efbe
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 15 22:22:28 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 15 22:22:28 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=87b724f3
mkconfig: marginally simplify the territory cleanup code
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/mkconfig b/mkconfig
index d79b3af..d69597e 100755
--- a/mkconfig
+++ b/mkconfig
@@ -83,10 +83,12 @@ sub map_locale_attributes ($prefix) {
$ref->$* = to_ascii($ref->$*);
}
}
- if ($territory =~ m/^Myanmar/) {
- $territory = 'Myanmar/Burma';
- } elsif ($territory eq 'Turkiye') {
- $territory = 'Turkey';
+ for ($territory) {
+ if (m/^Myanmar/) {
+ $_ = 'Myanmar/Burma';
+ } elsif (m/^Turkiye\z/) {
+ $_ = 'Turkey';
+ }
}
$attr_by{$locale} = {
'language' => $language,
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-15 5:35 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-15 5:35 UTC (permalink / raw
To: gentoo-commits
commit: 315fe56307f69ccebb732f20a0470ab67683d2f1
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 15 05:34:25 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 15 05:34:25 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=315fe563
mkconfig: capture basename directly in map_locale_attributes()
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/mkconfig b/mkconfig
index c67c630..5a7251f 100755
--- a/mkconfig
+++ b/mkconfig
@@ -10,7 +10,7 @@
# License GPL-2.0-only <https://spdx.org/licenses/GPL-2.0-only.html>
use v5.36;
-use File::Spec::Functions qw(catfile splitpath);
+use File::Spec::Functions qw(catfile);
# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it.
delete $ENV{'BASH_ENV'};
@@ -62,7 +62,7 @@ sub map_locale_attributes ($prefix) {
iconv -f UTF-8 -t US-ASCII//TRANSLIT
};
my $regex = qr/
- (\Q$top\E\/[^\/:]+) # pathname
+ \Q$top\E\/([^\/:]+) # basename
: # separates pathname from matching line
(language|territory) # attribute key
\h+ # one or more <blank> characters
@@ -71,7 +71,7 @@ sub map_locale_attributes ($prefix) {
my %attr_by;
for my $line (@lines) {
if ($line =~ m/^${regex}$/) {
- my ($locale, $key, $val) = (basename($1), $2, ucfirst $3);
+ my ($locale, $key, $val) = ($1, $2, ucfirst $3);
if ($key eq 'territory') {
if ($val =~ m/^Myanmar/) {
$val = 'Myanmar/Burma';
@@ -84,7 +84,3 @@ sub map_locale_attributes ($prefix) {
}
return \%attr_by;
}
-
-sub basename ($path) {
- return (splitpath($path))[-1];
-}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-15 4:07 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-15 4:07 UTC (permalink / raw
To: gentoo-commits
commit: 02c74069b62876935b12183fd2f8548a74f458f7
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 15 04:05:22 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 15 04:06:28 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=02c74069
mkconfig: protect against BASH_ENV being set
Just as locale-gen(8) already does.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mkconfig b/mkconfig
index 8a29782..c67c630 100755
--- a/mkconfig
+++ b/mkconfig
@@ -12,6 +12,9 @@
use v5.36;
use File::Spec::Functions qw(catfile splitpath);
+# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it.
+delete $ENV{'BASH_ENV'};
+
{
# The first argument shall be treated as a prefix, if any.
my $prefix = @ARGV ? $ARGV[0] : '';
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-15 3:57 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-15 3:57 UTC (permalink / raw
To: gentoo-commits
commit: b13cd44fd74c2a9715aa06b568201a2c03bfe480
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 15 03:48:48 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 15 03:54:02 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=b13cd44f
Introduce the mkconfig utility
The mkconfig utility writes a sample /etc/locale.gen file to standard
output as a columnated list, consisting only of UTF-8 locales supported
by the installed version of glibc, with comments indicating the
languages and territories in plain English.
Given the necessary effort to integrate it into the sys-apps/locale-gen
ebuild, it could be used by the next release of locale-gen. The idea is
not to have to carry a stock "locale.gen" file that requires manual
review upon each new glibc release.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
mkconfig | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 87 insertions(+)
diff --git a/mkconfig b/mkconfig
new file mode 100755
index 0000000..8a29782
--- /dev/null
+++ b/mkconfig
@@ -0,0 +1,87 @@
+#!/usr/bin/perl
+
+# Writes a sample /etc/locale.gen file to standard output as a columnated list,
+# consisting only of UTF-8 locales supported by the installed version of glibc,
+# with comments indicating the languages and territories in plain English.
+#
+# Requires: column(1), grep(1), iconv(1), sh(1)
+#
+# Copyright 2025 Kerin Millar <kfm@plushkava.net>
+# License GPL-2.0-only <https://spdx.org/licenses/GPL-2.0-only.html>
+
+use v5.36;
+use File::Spec::Functions qw(catfile splitpath);
+
+{
+ # The first argument shall be treated as a prefix, if any.
+ my $prefix = @ARGV ? $ARGV[0] : '';
+
+ # Open the file containing the supported locale/charmap combinations.
+ my $path = catfile($prefix, '/usr/share/i18n', 'SUPPORTED');
+ open my $fh, '<', $path or die "Can't open '$path': $!";
+
+ # Gather the language and territory attributes of the locale templates.
+ my $attr_by = map_locale_attributes($prefix);
+
+ # Use column(1) to write out a nicely columnated list.
+ open my $pipe, "| column -t -s \037" or exit 127;
+
+ while (my $line = readline $fh) {
+ my ($read_locale, $charmap) = split ' ', $line;
+
+ # The names of the templates don't incorporate a codeset part.
+ my $locale = $read_locale =~ s/\.[^@]+//r;
+
+ # Select only UTF-8 locales and refrain from incorporating the
+ # C.UTF-8 locale because is always compiled by locale-gen(8).
+ next if $charmap ne 'UTF-8' || $locale eq 'C';
+
+ # Compose a commented entry which also has a trailing comment,
+ # indicating the language and territory in plain English.
+ my ($comment, $territory) = $attr_by->{$locale}->@{'language', 'territory'};
+ if (! length $comment) {
+ die "Can't find a language attribute for '$read_locale'";
+ } else {
+ if (length $territory) {
+ $comment .= " ($territory)";
+ }
+ printf {$pipe} "# %s\037%s\037# %s\n", $read_locale, $charmap, $comment;
+ }
+ }
+ close $fh;
+ close $pipe or exit 1;
+}
+
+sub map_locale_attributes ($prefix) {
+ my $top = local $ENV{'TOP'} = catfile($prefix, '/usr/share/i18n', 'locales');
+ my @lines = qx{
+ grep -E '^(language|territory)[[:blank:]]' /dev/null "\$TOP"/* |
+ iconv -f UTF-8 -t US-ASCII//TRANSLIT
+ };
+ my $regex = qr/
+ (\Q$top\E\/[^\/:]+) # pathname
+ : # separates pathname from matching line
+ (language|territory) # attribute key
+ \h+ # one or more <blank> characters
+ "([^"]*)" # attribute value
+ /x;
+ my %attr_by;
+ for my $line (@lines) {
+ if ($line =~ m/^${regex}$/) {
+ my ($locale, $key, $val) = (basename($1), $2, ucfirst $3);
+ if ($key eq 'territory') {
+ if ($val =~ m/^Myanmar/) {
+ $val = 'Myanmar/Burma';
+ } elsif ($val eq 'Turkiye') {
+ $val = 'Turkey';
+ }
+ }
+ $attr_by{$locale}{$key} = $val;
+ }
+ }
+ return \%attr_by;
+}
+
+sub basename ($path) {
+ return (splitpath($path))[-1];
+}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 23:49 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 23:49 UTC (permalink / raw
To: gentoo-commits
commit: 29b6da6ba5f5ab2a26c945e5f5781a07839d84da
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 23:14:23 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 23:14:23 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=29b6da6b
Bump $VERSION to 3.3
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 27c1787..c415529 100755
--- a/locale-gen
+++ b/locale-gen
@@ -24,7 +24,7 @@ use experimental qw(try);
my $PROGRAM;
BEGIN { $PROGRAM = (splitpath(__FILE__))[-1]; }
-my $VERSION = '3.2';
+my $VERSION = '3.3';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 22:53 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 22:53 UTC (permalink / raw
To: gentoo-commits
commit: 5cc3eed537ffb9ae06854fe65923b8c4ee451248
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 22:52:52 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 22:52:52 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=5cc3eed5
Reformat a comment in the normalize() subroutine
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 7e313f5..27c1787 100755
--- a/locale-gen
+++ b/locale-gen
@@ -254,7 +254,7 @@ sub normalize ($canonical) {
if ($canonical !~ m/(?<=\.)[^@]+/p) {
die "Can't normalize " . render_printable($canonical);
} else {
- # en_US.UTF-8 => en_US.utf8
+ # en_US.UTF-8 => en_US.utf8
# de_DE.ISO-8859-15@euro => de_DE.iso885915@euro
my $codeset = lc ${^MATCH} =~ tr/0-9A-Za-z//cdr;
return ${^PREMATCH} . $codeset . ${^POSTMATCH};
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 22:45 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 22:45 UTC (permalink / raw
To: gentoo-commits
commit: 6ab521ec91607c47280551344700158745c4b752
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 22:40:26 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 22:40:26 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=6ab521ec
Assign TEMPDIR in the main block rather than enter_tempdir()
This makes it more apparent as to how TEMPDIR comes to be populated.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/locale-gen b/locale-gen
index 766df77..7e313f5 100755
--- a/locale-gen
+++ b/locale-gen
@@ -111,7 +111,7 @@ umask 0022;
check_archive_dir($prefix, $locale_dir);
# Create a temporary directory and switch to it.
- enter_tempdir($prefix);
+ $TEMPDIR = enter_tempdir($prefix);
# Compile the selected locales.
generate_locales($opt{'jobs'}, @locales);
@@ -400,9 +400,11 @@ sub enter_tempdir ($prefix) {
if (! -d $dir) {
$dir = File::Spec->tmpdir;
}
- $TEMPDIR = tempdir('locale-gen.XXXXXXXXXX', 'DIR' => $dir);
- if (! chdir $TEMPDIR) {
- die "$PROGRAM: Can't chdir to '$TEMPDIR': $!\n";
+ my $tmpdir = tempdir('locale-gen.XXXXXXXXXX', 'DIR' => $dir);
+ if (! chdir $tmpdir) {
+ die "$PROGRAM: Can't chdir to '$tmpdir': $!\n";
+ } else {
+ return $tmpdir;
}
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 21:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 21:42 UTC (permalink / raw
To: gentoo-commits
commit: f67ab6941fd7b3539b7d61bee21e5df9f7324962
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 16:03:10 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 16:03:37 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f67ab694
Link to spdx.org from the output of --version
GNU has a track record of downplaying the GPL-2.0-only license and
wilfully breaking existing links to it.
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 ee96985..766df77 100755
--- a/locale-gen
+++ b/locale-gen
@@ -231,7 +231,7 @@ sub show_version () {
print <<~EOF;
locale-gen $VERSION
Copyright 2024 Kerin Millar <kfm\@plushkava.net>
- License GPL-2.0-only <https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html>
+ License GPL-2.0-only <https://spdx.org/licenses/GPL-2.0-only.html>
EOF
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 21:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 21:42 UTC (permalink / raw
To: gentoo-commits
commit: adbceac80c2c62ea193812fcac1d6fc3d5363f34
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 21:16:43 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 21:35:44 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=adbceac8
locale.gen.5: define what a locale is under LOCALE NAMES
Begin the LOCALE NAMES section by defining what a locale is, just as the
CHARACTER MAPS section begins by defining what a charmap is.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale.gen.5 b/locale.gen.5
index e342ac8..b3a177d 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -10,7 +10,7 @@ Lines that are empty, or which contain only <blank> characters, shall be disrega
.P
The definition of a <blank> character is that it is either the <tab> or <space> character.
.SH "LOCALE NAMES"
-The GNU C Library employs a locale naming scheme that is based upon the X/Open Common Applications Environment (CAE) Portability Guide Issue 4 (XPG4) specification. A \fIlocalename\fR is composed of between one and four parts.
+A locale defines a set of cultural conventions, including the writing system, the calendar used, and the means by which dates and numbers are formatted. The GNU C Library employs a locale naming scheme that is based upon the X/Open Common Applications Environment (CAE) Portability Guide Issue 4 (XPG4) specification. A \fIlocalename\fR is composed of between one and four parts.
.P
.RS
.EX
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 21:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 21:42 UTC (permalink / raw
To: gentoo-commits
commit: f02615dc24e8fdded82f5b444ea2cb57b5f24e13
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 21:00:12 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 21:00:12 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f02615dc
locale.gen.5: remove a stray leading space
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale.gen.5 b/locale.gen.5
index 3eb25af..3af61cc 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -4,7 +4,7 @@ locale.gen - configuration file for locale\-gen
.SH "DESCRIPTION"
The \fBlocale\-gen\fR(8) utility compiles the locales specified by the \fI/etc/locale.gen\fR file and integrates them into a locale archive.
.P
-If present, the file must be comprised by zero or more lines, each of which must be comprised by two fields, separated by one or more <blank> characters. Leading and trailing <blank> characters are permitted. The first field shall be considered as a \fIlocalename\fR and the second field as a \fIcharmap\fR. The \fI/usr/share/i18n/SUPPORTED\fR file contains a complete list of the supported combinations.
+If present, the file must be comprised by zero or more lines, each of which must be comprised by two fields, separated by one or more <blank> characters. Leading and trailing <blank> characters are permitted. The first field shall be considered as a \fIlocalename\fR and the second field as a \fIcharmap\fR. The \fI/usr/share/i18n/SUPPORTED\fR file contains a complete list of the supported combinations.
.P
Lines that are empty, or which contain only <blank> characters, shall be disregarded. Lines that begin with zero or more <blank> characters, followed by a <number\-sign> character, shall be considered as comments and disregarded. Further, the two fields that form a locale definition may be followed by a comment, provided that its leading <number\-sign> character is enclosed by <blank> characters.
.P
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 21:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 21:42 UTC (permalink / raw
To: gentoo-commits
commit: 6024e9b26359f4a645ccf883f2bb956992068c6c
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 21:02:54 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 21:02:54 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=6024e9b2
locale.gen.5: document /usr/share/i18n/{locales,charmaps}
Document both the /usr/share/i18n/locales and /usr/share/i18n/charmaps
directories by explaining their relationship with the
/usr/share/i18n/SUPPORTED file.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/locale.gen.5 b/locale.gen.5
index 3af61cc..595e37a 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -18,13 +18,13 @@ language[_territory][.codeset][@modifier]
.EE
.RE
.P
-A complete list of supported \fIlocalename\fR values can be obtained by reading the first column of the \fI/usr/share/i18n/SUPPORTED\fR file.
+A complete list of supported \fIlocalename\fR values can be obtained by reading the first column of the \fI/usr/share/i18n/SUPPORTED\fR file. Its values map directly to the names of files residing in the \fI/usr/share/i18n/locales\fR directory, provided that codeset parts are stripped.
.P
Assuming that a given locale is available, it can be effected by assigning its \fIlocalename\fR to the LANG environment variable.
.SH "CHARACTER MAPS"
A \fIcharmap\fR, also known as a character set or codeset, is a mapping of character symbols and collating element symbols to actual character encodings, allowing for computers to encode and decode text in a standard way.
.P
-A complete list of supported \fIcharmap\fR values can be obtained by reading the second column of the \fI/usr/share/i18n/SUPPORTED\fR file.
+A complete list of supported \fIcharmap\fR values can be obtained by reading the second column of the \fI/usr/share/i18n/SUPPORTED\fR file. Its values map directly to the names of files residing in the \fI/usr/share/i18n/charmaps\fR directory, notwithstanding that the names may have a suffix as a consequence of having been compressed.
.P
Given that not all values of \fIlocalename\fR incorporate a codeset, the configuration file requires for the second field of each line to define a \fIcharmap\fR.
.SH "EXAMPLES"
@@ -50,6 +50,12 @@ The default location of the configuration file.
.TP
.I /usr/share/i18n/SUPPORTED
A list of supported \fIlocalename\fR and \fIcharmap\fR combinations.
+.TP
+.I /usr/share/i18n/locales
+Contains locale definition files that can serve as inputs to \fBlocaledef\fR(1).
+.TP
+.I /usr/share/i18n/charmaps
+Contains character map files that can serve as inputs to \fBlocaledef\fR(1).
.SH "SEE ALSO"
.BR locale (1),
.BR localedef (1),
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 21:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 21:42 UTC (permalink / raw
To: gentoo-commits
commit: 4658c4a3469707892212a382b203a044755e34e0
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 21:29:30 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 21:40:15 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=4658c4a3
locale.gen.5: reference several specifications from SEE ALSO
Have the SEE ALSO section reference the following publications.
- System Interface Definitions, Issue 4, Version 2 (XBD) (1994)
- XPG3\-XPG4 Base Migration Guide, Version 2 (1995)
- The Open Group Standard Base Specifications, Issue 8 (POSIX-1.2024)
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/locale.gen.5 b/locale.gen.5
index b3a177d..c4134e4 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -61,6 +61,24 @@ Contains character map files that can serve as inputs to \fBlocaledef\fR(1).
.BR localedef (1),
.BR locale.conf (5),
.BR locale\-gen (8)
+.P
+System Interface Definitions, Issue 4, Version 2 (XBD) (1994)
+.br
+.UR https:\://pubs\:.opengroup\:.org/onlinepubs/009656599/toc\:.pdf
+.UE
+.P
+XPG3\-XPG4 Base Migration Guide, Version 2 (1995).
+.br
+.UR https://\:archive\:.opengroup\:.org/publications/archive/CDROM/g501\:.pdf
+.UE
+.P
+The Open Group Standard Base Specifications, Issue 8 (POSIX-1.2024).
+.br
+.UR https://\:pubs\:.opengroup\:.org/onlinepubs/9799919799/basedefs/V1\:_chap03\:.html
+.UE
+.br
+.UR https://\:pubs\:.opengroup\:.org/onlinepubs/9799919799/basedefs/V1\:_chap07\:.html
+.UE
.SH "AUTHORS"
.nf
Alastair McKinstry <mckinstry@computer.org>
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 21:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 21:42 UTC (permalink / raw
To: gentoo-commits
commit: a493889f3341833a2f737bce97d2d2ba785367bd
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 21:04:00 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 21:23:41 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=a493889f
locale.gen.5: clarify the means by which a locale can be effected
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale.gen.5 b/locale.gen.5
index 595e37a..e342ac8 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -20,7 +20,7 @@ language[_territory][.codeset][@modifier]
.P
A complete list of supported \fIlocalename\fR values can be obtained by reading the first column of the \fI/usr/share/i18n/SUPPORTED\fR file. Its values map directly to the names of files residing in the \fI/usr/share/i18n/locales\fR directory, provided that codeset parts are stripped.
.P
-Assuming that a given locale is available, it can be effected by assigning its \fIlocalename\fR to the LANG environment variable.
+Assuming that a given locale is available, it can be effected by assigning its \fIlocalename\fR to the LANG environment variable, provided that a codeset part is incorporated.
.SH "CHARACTER MAPS"
A \fIcharmap\fR, also known as a character set or codeset, is a mapping of character symbols and collating element symbols to actual character encodings, allowing for computers to encode and decode text in a standard way.
.P
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 10:09 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 10:09 UTC (permalink / raw
To: gentoo-commits
commit: a6c081557721a094bdc549a4b720ab291b7c75fe
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 09:23:10 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 09:35:27 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=a6c08155
Don't call parse_config() from a try block in read_config()
Presently, the read_config() subroutine employs a try block to catch
exceptions thrown in the case that a given config file cannot be opened.
However, it also calls the parse_config() subroutine from that same
block. Given that config parsing exceptions need not be caught - even if
only to be re-thrown - there is no sense in doing so. Hoist the call so
that it is no longer enclosed by the try block.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/locale-gen b/locale-gen
index 4b5edd6..aa14728 100755
--- a/locale-gen
+++ b/locale-gen
@@ -271,20 +271,21 @@ sub read_config ($prefix, @paths) {
# valid locale declarations that can be found among them, if any.
for my $i (keys @paths) {
my $path = $paths[$i];
+ my $fh;
try {
- my $fh = fopen($path);
- $! = 0;
- if (my @locales = parse_config($fh, $path, \%locale_by, \%charmap_by)) {
- return @locales;
- }
+ $fh = fopen($path);
} catch ($e) {
- # Disregard open errors concerning non-existent files
- # unless there are no more paths to be tried. Validation
- # errors shall also be propagated here.
- if ($! != ENOENT || $i == $#paths) {
+ # Disregard open(2) errors concerning non-existent files
+ # unless there are no more paths to be tried.
+ if ($! == ENOENT && $i < $#paths) {
+ next;
+ } else {
die $e;
}
}
+ if (my @locales = parse_config($fh, $path, \%locale_by, \%charmap_by)) {
+ return @locales;
+ }
}
# For no locales to have been discovered at this point is exceptional.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-13 10:09 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-13 10:09 UTC (permalink / raw
To: gentoo-commits
commit: 265ec148dd39af832c27a313aae594b84e384fe1
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 13 09:58:16 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 13 09:58:16 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=265ec148
Don't report more workers than there are locales to be compiled
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 2 ++
1 file changed, 2 insertions(+)
diff --git a/locale-gen b/locale-gen
index aa14728..ee96985 100755
--- a/locale-gen
+++ b/locale-gen
@@ -14,6 +14,7 @@ use File::Spec::Functions qw(canonpath catfile catdir splitpath);
use File::Temp qw(tempdir);
use Getopt::Long ();
use JSON::PP ();
+use List::Util qw(min);
use POSIX qw(LC_ALL setlocale);
# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
@@ -411,6 +412,7 @@ sub generate_locales ($workers, @locales) {
local @SIG{'INT', 'TERM'} = ($handler, $handler);
my $total = scalar @locales;
+ $workers = min($workers, $total);
printf "Compiling %d locale definition file%s with %d worker%s ...\n",
$total, plural($total), $workers, plural($workers);
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-12 17:32 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-12 17:32 UTC (permalink / raw
To: gentoo-commits
commit: 7cd8eb7cc675990c6f435c4aec7870ed28dcb8b8
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 12 17:21:06 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 12 17:30:50 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=7cd8eb7c
Better align the behaviour of normalize() with localedef(1)
The purpose of the normalize() subroutine is to normalize the codeset
portion of a locale name as the localedef(1) utility would; at least, to
the extent that is necessary for locale-gen(8) to function correctly.
Presently, it does so by splitting the string into two parts (with the
<period> character serving as a separator), stripping all instances of
the <hyphen-minus> from the second part, then converting the second part
to lowercase. This approach dates from April 2006, when the --update
option was introduced. However, it is not strictly correct. For one
thing, only the codeset part is supposed to be altered. Consider the
following locale name.
de_DE.ISO-8859-15@euro
The present routine operates on a substring of "ISO-8859-15@euro".
Instead, it ought to operate only on "ISO-8859-15". While it seems
unlikely ever to occur, imagine a scenario in which GNU introduces a new
modifier that does not consist exclusively of lower case characters.
Another issue is that the routine strips only the <hyphen-minus>
character. Instead, it ought to strip all non-alphanumeric characters,
as does the normalize_codeset() function of the localedef(1) utility.
Revise the normalize() subroutine so as to address both of these issues
and maintain a theoretically high degree of forward-compatibility.
Fixes: 2df969d53ea596038a4857060a42d7f2fd25d7e3
Link: https://sourceware.org/git?p=glibc.git;a=blob;f=locale/programs/localedef.c;hb=glibc-2.42#l561
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/locale-gen b/locale-gen
index fda1830..4b5edd6 100755
--- a/locale-gen
+++ b/locale-gen
@@ -249,11 +249,14 @@ sub list_locales ($prefix) {
}
sub normalize ($canonical) {
- if (2 == (my ($locale, $charmap) = split /\./, $canonical, 3)) {
- # en_US.UTF-8 => en_US.utf8; en_US.ISO-8859-1 => en_US.iso88591
- return join '.', $locale, lc($charmap =~ s/-//gr);
- } else {
+ # This is similar to the normalize_codeset() function of localedef(1).
+ if ($canonical !~ m/(?<=\.)[^@]+/p) {
die "Can't normalize " . render_printable($canonical);
+ } else {
+ # en_US.UTF-8 => en_US.utf8
+ # de_DE.ISO-8859-15@euro => de_DE.iso885915@euro
+ my $codeset = lc ${^MATCH} =~ tr/0-9A-Za-z//cdr;
+ return ${^PREMATCH} . $codeset . ${^POSTMATCH};
}
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-12 5:06 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-12 5:06 UTC (permalink / raw
To: gentoo-commits
commit: 77302f5b63edce9ffbf6853bcdb9cb255ff258df
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 12 05:02:07 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 12 05:04:45 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=77302f5b
Use ($CHILD_ERROR & 0x7F) to check for death by signal
Should a child process die to a signal, the lower 7 bits of the $?
variable shall contain the signal number, whereas the 8th bit shall
indicate whether a core dump was produced. Hence, either of ($? & 0xFF)
and ($? & 0x7F) can be used to determine whether a process exited
normally. The latter expression is idiomatic, however.
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 baa520f..fda1830 100755
--- a/locale-gen
+++ b/locale-gen
@@ -127,7 +127,7 @@ sub get_locale_dir () {
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) {
+ } elsif (($? & 0x7F) == 0) {
# The child terminated normally (in the sense of WIFEXITED).
return undef;
} else {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-12 5:06 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-12 5:06 UTC (permalink / raw
To: gentoo-commits
commit: 4460bb48e69c8f6fb8a354f45f556ba50f83eab7
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 12 04:30:34 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 12 04:36:31 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=4460bb48
Refrain from unsetting the CDPATH environment variable
The cd builtin of sh(1) is no longer used.
See-also: a009d7c7ab382065555d60250752f11ef40c1c1c
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/locale-gen b/locale-gen
index bc3ef6f..baa520f 100755
--- a/locale-gen
+++ b/locale-gen
@@ -36,9 +36,8 @@ if (setlocale(LC_ALL) eq 'C') {
delete @ENV{ grep +( m/^(LANG\z|LC_)/ ), keys %ENV };
}
-# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it. Unset
-# CDPATH also, for it is nothing but a liability in a non-interactive context.
-delete @ENV{'BASH_ENV', 'CDPATH'};
+# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it.
+delete $ENV{'BASH_ENV'};
# Protect against the inheritance of an unduly restrictive umask.
umask 0022;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-11 22:43 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-11 22:43 UTC (permalink / raw
To: gentoo-commits
commit: 87b601f3a5d30ee6897085b92c74f5a1fbd9f08d
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 11 22:42:27 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 11 22:42:27 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=87b601f3
Correct a typo where $total is assigned
The += operator crept in where = ought to be. Though it does no harm,
rectify this accident.
Fixes: d01f4edd83cf9d41abe9941244a949a6f1100187
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 1513384..bc3ef6f 100755
--- a/locale-gen
+++ b/locale-gen
@@ -119,7 +119,7 @@ umask 0022;
# Integrate the newly compiled locales into the system's locale archive.
my $size = generate_archive($prefix, $gentoo_prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
- my $total += scalar @locales + scalar %installed_by;
+ my $total = scalar @locales + scalar %installed_by;
printf "Successfully installed an archive containing %d locale%s, of %s MiB in size.\n",
$total, plural($total), round($size / 2 ** 20);
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-11 16:04 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-11 16:04 UTC (permalink / raw
To: gentoo-commits
commit: ee1745e88deda1d3dc57ce7348de3c57fb4830d5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 11 15:56:45 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 11 15:59:27 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=ee1745e8
locale.gen: refine the annotations
Adjust the comments for the mnw_MM and shn_MM locales so that Myanmar is
referred to as "Myanmar/Burma", thereby matching the my_MM locale.
Adjust the comments for the ku_TR and tr_TR locales so that Turkey is
referred to by its English name rather than as "Türkiye". All of the
other entries employ English names.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/locale.gen b/locale.gen
index 0e33a3d..47d5a4f 100644
--- a/locale.gen
+++ b/locale.gen
@@ -177,7 +177,7 @@
# kok_IN UTF-8 # Konkani (India)
# ks_IN UTF-8 # Kashmiri (India)
# ks_IN@devanagari UTF-8 # Kashmiri (India)
-# ku_TR.UTF-8 UTF-8 # Kurdish (Türkiye)
+# ku_TR.UTF-8 UTF-8 # Kurdish (Turkey)
# kv_RU UTF-8 # Komi (Russia)
# kw_GB.UTF-8 UTF-8 # Cornish (United Kingdom)
# ky_KG UTF-8 # Kyrgyz (Kyrgyzstan)
@@ -206,7 +206,7 @@
# ml_IN UTF-8 # Malayalam (India)
# mn_MN UTF-8 # Mongolian (Mongolia)
# mni_IN UTF-8 # Manipuri (India)
-# mnw_MM UTF-8 # Mon (Myanmar)
+# mnw_MM UTF-8 # Mon (Myanmar/Burma)
# mr_IN UTF-8 # Marathi (India)
# ms_MY.UTF-8 UTF-8 # Malay (Malaysia)
# mt_MT.UTF-8 UTF-8 # Maltese (Malta)
@@ -255,7 +255,7 @@
# sd_IN@devanagari UTF-8 # Sindhi (India)
# se_NO UTF-8 # Northern Sami (Norway)
# sgs_LT UTF-8 # Samogitian (Lithuania)
-# shn_MM UTF-8 # Shan (Myanmar)
+# shn_MM UTF-8 # Shan (Myanmar/Burma)
# shs_CA UTF-8 # Shuswap (Canada)
# si_LK UTF-8 # Sinhala (Sri Lanka)
# sid_ET UTF-8 # Sidamo (Ethiopia)
@@ -298,7 +298,7 @@
# tok UTF-8 # Toki Pona
# tpi_PG UTF-8 # Tok Pisin (Papua New Guinea)
# tr_CY.UTF-8 UTF-8 # Turkish (Cyprus)
-# tr_TR.UTF-8 UTF-8 # Turkish (Türkiye)
+# tr_TR.UTF-8 UTF-8 # Turkish (Turkey)
# ts_ZA UTF-8 # Tsonga (South Africa)
# tt_RU UTF-8 # Tatar (Russia)
# tt_RU@iqtelif UTF-8 # Tatar (Russia)
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-11 16:04 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-11 16:04 UTC (permalink / raw
To: gentoo-commits
commit: d01f4edd83cf9d41abe9941244a949a6f1100187
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 11 16:01:25 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 11 16:01:25 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=d01f4edd
Report the size of the installed archive
Upon success, have the final diagnostic message report the size of the
installed archive. Further, have it accurately report how many locales
are incorporated by the archive for the -u option.
# printf '%s UTF-8\n' en_US en_GB | locale-gen -c - | tail -n2
Adding 3 locales to the locale archive ...
Successfully installed an archive containing 3 locales, of 2.93 MiB in size.
# printf '%s UTF-8\n' en_AU | locale-gen -u -c - | tail -n2
Adding 1 locale to the locale archive ...
Successfully installed an archive containing 4 locales, of 2.94 MiB in size.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/locale-gen b/locale-gen
index 3a1dadf..1513384 100755
--- a/locale-gen
+++ b/locale-gen
@@ -117,10 +117,11 @@ umask 0022;
generate_locales($opt{'jobs'}, @locales);
# Integrate the newly compiled locales into the system's locale archive.
- generate_archive($prefix, $gentoo_prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
+ my $size = generate_archive($prefix, $gentoo_prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
- my $total = scalar @locales;
- printf "Successfully installed %d locale%s.\n", $total, plural($total);
+ my $total += scalar @locales + scalar %installed_by;
+ printf "Successfully installed an archive containing %d locale%s, of %s MiB in size.\n",
+ $total, plural($total), round($size / 2 ** 20);
}
sub get_locale_dir () {
@@ -523,6 +524,13 @@ sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonic
}
die "$PROGRAM: Can't rename '$interim_path' to '$final_path': $!\n";
}
+
+ # Return the size of the archive, in bytes.
+ if (! (my @stat = stat $final_path)) {
+ die "$PROGRAM: Can't stat '$final_path': $!\n";
+ } else {
+ return $stat[7];
+ }
}
sub run_localedef ($prefix, @args) {
@@ -607,6 +615,11 @@ sub get_username () {
return getpwuid($>) // $ENV{'LOGNAME'};
}
+sub round ($number) {
+ # Evaluation conveniently trims insignificant trailing zeroes.
+ return eval(sprintf '%.2f', $number);
+}
+
END {
if ($$ == $PID) {
if (length $TEMPDIR) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-11 0:39 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-11 0:39 UTC (permalink / raw
To: gentoo-commits
commit: f7cbd623b8477919674855d0afe7eb8b50d01ada
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 11 00:38:28 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 11 00:38:48 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f7cbd623
Eliminate all unescaped line continuations from the man pages
Presently, some of the paragraphs in the man pages are wrapped at the 80
column mark. However, the effect of an unescaped newline is significant.
As groff(7) states, a newline "puts an inter-word space onto the output
and, if filling is enabled, triggers end-of-sentence recognition on the
preceding text."
Address this issue by observing the status quo and refraining from
wrapping the affected text.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 19 +++----------------
locale.gen.5 | 41 ++++++++++-------------------------------
2 files changed, 13 insertions(+), 47 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 51e573a..4d163dd 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -18,24 +18,11 @@ locale\-gen - safely compile and install a glibc locale archive
.B \-V
.YS
.SH "DESCRIPTION"
-The locale\-gen utility provides a means by which a system administrator may
-conveniently manage the set of locales that are made available to the GNU C
-Library. It accomplishes this by acting as a user-friendly frontend for the
-standard \fBlocaledef\fR(1) utility, which is used to compile locales and
-integrate them into a central archive.
+The locale\-gen utility provides a means by which a system administrator may conveniently manage the set of locales that are made available to the GNU C Library. It accomplishes this by acting as a user-friendly frontend for the standard \fBlocaledef\fR(1) utility, which is used to compile locales and integrate them into a central archive.
.P
-A default installation of Gentoo Linux provides an archive that contains all
-supported locales, numbering 500 or more. However, it is typical for an
-administrator to require only one or two of these. In that case, the
-\fI/etc/locale.gen\fR configuration file may be populated with a list of the
-required locales. By default, locale\-gen shall read this file and compile only
-the locales that are specified, saving both time and space in the longer term.
+A default installation of Gentoo Linux provides an archive that contains all supported locales, numbering 500 or more. However, it is typical for an administrator to require only one or two of these. In that case, the \fI/etc/locale.gen\fR configuration file may be populated with a list of the required locales. By default, locale\-gen shall read this file and compile only the locales that are specified, saving both time and space in the longer term.
.P
-If the configuration file is missing, empty, or consists only of comments,
-locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR
-option was specified. If specified then locale\-gen shall abort with a suitable
-diagnostic message. Otherwise, locale\-gen shall act as if the \fB\-A\fR option
-had been specified.
+If the configuration file is missing, empty, or consists only of comments, locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR option was specified. If specified then locale\-gen shall abort with a suitable diagnostic message. Otherwise, locale\-gen shall act as if the \fB\-A\fR option had been specified.
.SH "OPTIONS"
.TP
\fB\-A\fR, \fB\-\-all\fR
diff --git a/locale.gen.5 b/locale.gen.5
index e5bf25c..3eb25af 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -2,29 +2,15 @@
.SH "NAME"
locale.gen - configuration file for locale\-gen
.SH "DESCRIPTION"
-The \fBlocale\-gen\fR(8) utility compiles the locales specified by the
-\fI/etc/locale.gen\fR file and integrates them into a locale archive.
+The \fBlocale\-gen\fR(8) utility compiles the locales specified by the \fI/etc/locale.gen\fR file and integrates them into a locale archive.
.P
-If present, the file must be comprised by zero or more lines, each of which
-must be comprised by two fields, separated by one or more <blank> characters.
-Leading and trailing <blank> characters are permitted. The first field shall be
-considered as a \fIlocalename\fR and the second field as a \fIcharmap\fR. The
-\fI/usr/share/i18n/SUPPORTED\fR file contains a complete list of the supported
-combinations.
+If present, the file must be comprised by zero or more lines, each of which must be comprised by two fields, separated by one or more <blank> characters. Leading and trailing <blank> characters are permitted. The first field shall be considered as a \fIlocalename\fR and the second field as a \fIcharmap\fR. The \fI/usr/share/i18n/SUPPORTED\fR file contains a complete list of the supported combinations.
.P
-Lines that are empty, or which contain only <blank> characters, shall be
-disregarded. Lines that begin with zero or more <blank> characters, followed by
-a <number\-sign> character, shall be considered as comments and disregarded.
-Further, the two fields that form a locale definition may be followed by a
-comment, provided that its leading <number\-sign> character is enclosed by
-<blank> characters.
+Lines that are empty, or which contain only <blank> characters, shall be disregarded. Lines that begin with zero or more <blank> characters, followed by a <number\-sign> character, shall be considered as comments and disregarded. Further, the two fields that form a locale definition may be followed by a comment, provided that its leading <number\-sign> character is enclosed by <blank> characters.
.P
-The definition of a <blank> character is that it is either the <tab> or <space>
-character.
+The definition of a <blank> character is that it is either the <tab> or <space> character.
.SH "LOCALE NAMES"
-The GNU C Library employs a locale naming scheme that is based upon the X/Open
-Common Applications Environment (CAE) Portability Guide Issue 4 (XPG4)
-specification. A \fIlocalename\fR is composed of between one and four parts.
+The GNU C Library employs a locale naming scheme that is based upon the X/Open Common Applications Environment (CAE) Portability Guide Issue 4 (XPG4) specification. A \fIlocalename\fR is composed of between one and four parts.
.P
.RS
.EX
@@ -32,22 +18,15 @@ language[_territory][.codeset][@modifier]
.EE
.RE
.P
-A complete list of supported \fIlocalename\fR values can be obtained by reading
-the first column of the \fI/usr/share/i18n/SUPPORTED\fR file.
+A complete list of supported \fIlocalename\fR values can be obtained by reading the first column of the \fI/usr/share/i18n/SUPPORTED\fR file.
.P
-Assuming that a given locale is available, it can be effected by assigning its
-\fIlocalename\fR to the LANG environment variable.
+Assuming that a given locale is available, it can be effected by assigning its \fIlocalename\fR to the LANG environment variable.
.SH "CHARACTER MAPS"
-A \fIcharmap\fR, also known as a character set or codeset, is a mapping of
-character symbols and collating element symbols to actual character encodings,
-allowing for computers to encode and decode text in a standard way.
+A \fIcharmap\fR, also known as a character set or codeset, is a mapping of character symbols and collating element symbols to actual character encodings, allowing for computers to encode and decode text in a standard way.
.P
-A complete list of supported \fIcharmap\fR values can be obtained by reading
-the second column of the \fI/usr/share/i18n/SUPPORTED\fR file.
+A complete list of supported \fIcharmap\fR values can be obtained by reading the second column of the \fI/usr/share/i18n/SUPPORTED\fR file.
.P
-Given that not all values of \fIlocalename\fR incorporate a codeset, the
-configuration file requires for the second field of each line to define a
-\fIcharmap\fR.
+Given that not all values of \fIlocalename\fR incorporate a codeset, the configuration file requires for the second field of each line to define a \fIcharmap\fR.
.SH "EXAMPLES"
.EX
# This is a comment, followed by some valid locale declarations.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-10 22:53 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-10 22:53 UTC (permalink / raw
To: gentoo-commits
commit: 9a211de1491c3e6a2c01f125fc51d76014ec13a3
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 10 22:53:28 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Aug 10 22:53:39 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=9a211de1
locale.gen.5: remove a stray blank line
Fixes: 882fce549fd5ea663b0bf550f9da4433332353c5
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 1 -
1 file changed, 1 deletion(-)
diff --git a/locale.gen.5 b/locale.gen.5
index f5e6edf..e5bf25c 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -18,7 +18,6 @@ a <number\-sign> character, shall be considered as comments and disregarded.
Further, the two fields that form a locale definition may be followed by a
comment, provided that its leading <number\-sign> character is enclosed by
<blank> characters.
-
.P
The definition of a <blank> character is that it is either the <tab> or <space>
character.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-10 22:22 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-10 22:22 UTC (permalink / raw
To: gentoo-commits
commit: 882fce549fd5ea663b0bf550f9da4433332353c5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 10 21:08:11 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Aug 10 21:17:20 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=882fce54
Allow for locale declarations to have trailing comments
The two fields that form a locale definition may now be followed by a
comment, provided that its leading <number-sign> character is enclosed
by <blank> characters.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 3 +++
locale.gen.5 | 12 ++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/locale-gen b/locale-gen
index 948ee59..3a1dadf 100755
--- a/locale-gen
+++ b/locale-gen
@@ -329,6 +329,9 @@ sub parse_config ($fh, $path, $locale_by, $charmap_by) {
# " " and "\t", since the input stream is not being decoded.
next if $line =~ m/^\h*($|#)/;
+ # Permit comments trailing locale declarations.
+ $line =~ s/\h\K#\h.*//;
+
# Expect for two fields, separated by horizontal whitespace.
my @fields;
chomp $line;
diff --git a/locale.gen.5 b/locale.gen.5
index 5a56e60..f5e6edf 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -13,9 +13,12 @@ considered as a \fIlocalename\fR and the second field as a \fIcharmap\fR. The
combinations.
.P
Lines that are empty, or which contain only <blank> characters, shall be
-disregarded. Also, lines that begin with zero or more <blank> characters,
-followed by a <number\-sign> character, shall be considered as comments and
-disregarded.
+disregarded. Lines that begin with zero or more <blank> characters, followed by
+a <number\-sign> character, shall be considered as comments and disregarded.
+Further, the two fields that form a locale definition may be followed by a
+comment, provided that its leading <number\-sign> character is enclosed by
+<blank> characters.
+
.P
The definition of a <blank> character is that it is either the <tab> or <space>
character.
@@ -53,7 +56,8 @@ en_US.UTF\-8 UTF\-8
zh_CN.UTF\-8 UTF\-8
de_DE.UTF\-8 UTF\-8
hi_IN.UTF\-8 UTF\-8
-ja_JP.UTF\-8 UTF\-8
+ja_JP.UTF\-8 UTF\-8 # trailing comments are permitted
+
.sp
# This is invalid because the charmap field is missing.
en_US.UTF\-8
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-10 22:22 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-10 22:22 UTC (permalink / raw
To: gentoo-commits
commit: 035c45bbf8338989e3e98bf67fd6151a497170b6
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 10 22:03:45 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Aug 10 22:16:32 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=035c45bb
locale.gen: Annotate the entries with descriptive trailing comments
Incorporate trailing comments that spell out the language and territory
(where applicable), in plain English.
See-also: 882fce549fd5ea663b0bf550f9da4433332353c5
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen | 650 ++++++++++++++++++++++++++++++-------------------------------
1 file changed, 325 insertions(+), 325 deletions(-)
diff --git a/locale.gen b/locale.gen
index fe72e5f..0e33a3d 100644
--- a/locale.gen
+++ b/locale.gen
@@ -1,328 +1,328 @@
# This file defines which locales to incorporate into the glibc locale archive.
# See the locale.gen(5) and locale-gen(8) man pages for more details.
-# aa_DJ.UTF-8 UTF-8
-# aa_ER UTF-8
-# aa_ET UTF-8
-# af_ZA.UTF-8 UTF-8
-# agr_PE UTF-8
-# ak_GH UTF-8
-# am_ET UTF-8
-# an_ES.UTF-8 UTF-8
-# anp_IN UTF-8
-# ar_AE.UTF-8 UTF-8
-# ar_BH.UTF-8 UTF-8
-# ar_DZ.UTF-8 UTF-8
-# ar_EG.UTF-8 UTF-8
-# ar_IN UTF-8
-# ar_IQ.UTF-8 UTF-8
-# ar_JO.UTF-8 UTF-8
-# ar_KW.UTF-8 UTF-8
-# ar_LB.UTF-8 UTF-8
-# ar_LY.UTF-8 UTF-8
-# ar_MA.UTF-8 UTF-8
-# ar_OM.UTF-8 UTF-8
-# ar_QA.UTF-8 UTF-8
-# ar_SA.UTF-8 UTF-8
-# ar_SD.UTF-8 UTF-8
-# ar_SS UTF-8
-# ar_SY.UTF-8 UTF-8
-# ar_TN.UTF-8 UTF-8
-# ar_YE.UTF-8 UTF-8
-# ayc_PE UTF-8
-# az_AZ UTF-8
-# az_IR UTF-8
-# as_IN UTF-8
-# ast_ES.UTF-8 UTF-8
-# be_BY.UTF-8 UTF-8
-# be_BY@latin UTF-8
-# bem_ZM UTF-8
-# ber_DZ UTF-8
-# ber_MA UTF-8
-# bg_BG.UTF-8 UTF-8
-# bhb_IN.UTF-8 UTF-8
-# bho_IN UTF-8
-# bho_NP UTF-8
-# bi_VU UTF-8
-# bn_BD UTF-8
-# bn_IN UTF-8
-# bo_CN UTF-8
-# bo_IN UTF-8
-# br_FR.UTF-8 UTF-8
-# brx_IN UTF-8
-# bs_BA.UTF-8 UTF-8
-# byn_ER UTF-8
-# ca_AD.UTF-8 UTF-8
-# ca_ES.UTF-8 UTF-8
-# ca_ES@valencia UTF-8
-# ca_FR.UTF-8 UTF-8
-# ca_IT.UTF-8 UTF-8
-# ce_RU UTF-8
-# chr_US UTF-8
-# ckb_IQ UTF-8
-# cmn_TW UTF-8
-# crh_RU UTF-8
-# crh_UA UTF-8
-# cs_CZ.UTF-8 UTF-8
-# csb_PL UTF-8
-# cv_RU UTF-8
-# cy_GB.UTF-8 UTF-8
-# da_DK.UTF-8 UTF-8
-# de_AT.UTF-8 UTF-8
-# de_BE.UTF-8 UTF-8
-# de_CH.UTF-8 UTF-8
-# de_DE.UTF-8 UTF-8
-# de_IT.UTF-8 UTF-8
-# de_LI.UTF-8 UTF-8
-# de_LU.UTF-8 UTF-8
-# doi_IN UTF-8
-# dsb_DE UTF-8
-# dv_MV UTF-8
-# dz_BT UTF-8
-# el_GR.UTF-8 UTF-8
-# el_CY.UTF-8 UTF-8
-# en_AG UTF-8
-# en_AU.UTF-8 UTF-8
-# en_BW.UTF-8 UTF-8
-# en_CA.UTF-8 UTF-8
-# en_DK.UTF-8 UTF-8
-# en_GB.UTF-8 UTF-8
-# en_HK.UTF-8 UTF-8
-# en_IE.UTF-8 UTF-8
-# en_IL UTF-8
-# en_IN UTF-8
-# en_NG UTF-8
-# en_NZ.UTF-8 UTF-8
-# en_PH.UTF-8 UTF-8
-# en_SC.UTF-8 UTF-8
-# en_SG.UTF-8 UTF-8
-# en_US.UTF-8 UTF-8
-# en_ZA.UTF-8 UTF-8
-# en_ZM UTF-8
-# en_ZW.UTF-8 UTF-8
-# eo UTF-8
-# es_AR.UTF-8 UTF-8
-# es_BO.UTF-8 UTF-8
-# es_CL.UTF-8 UTF-8
-# es_CO.UTF-8 UTF-8
-# es_CR.UTF-8 UTF-8
-# es_CU UTF-8
-# es_DO.UTF-8 UTF-8
-# es_EC.UTF-8 UTF-8
-# es_ES.UTF-8 UTF-8
-# es_GT.UTF-8 UTF-8
-# es_HN.UTF-8 UTF-8
-# es_MX.UTF-8 UTF-8
-# es_NI.UTF-8 UTF-8
-# es_PA.UTF-8 UTF-8
-# es_PE.UTF-8 UTF-8
-# es_PR.UTF-8 UTF-8
-# es_PY.UTF-8 UTF-8
-# es_SV.UTF-8 UTF-8
-# es_US.UTF-8 UTF-8
-# es_UY.UTF-8 UTF-8
-# es_VE.UTF-8 UTF-8
-# et_EE.UTF-8 UTF-8
-# eu_ES.UTF-8 UTF-8
-# fa_IR UTF-8
-# ff_SN UTF-8
-# fi_FI.UTF-8 UTF-8
-# fil_PH UTF-8
-# fo_FO.UTF-8 UTF-8
-# fr_BE.UTF-8 UTF-8
-# fr_CA.UTF-8 UTF-8
-# fr_CH.UTF-8 UTF-8
-# fr_FR.UTF-8 UTF-8
-# fr_LU.UTF-8 UTF-8
-# fur_IT UTF-8
-# fy_NL UTF-8
-# fy_DE UTF-8
-# ga_IE.UTF-8 UTF-8
-# gbm_IN UTF-8
-# gd_GB.UTF-8 UTF-8
-# gez_ER UTF-8
-# gez_ER@abegede UTF-8
-# gez_ET UTF-8
-# gez_ET@abegede UTF-8
-# gl_ES.UTF-8 UTF-8
-# gu_IN UTF-8
-# gv_GB.UTF-8 UTF-8
-# ha_NG UTF-8
-# hak_TW UTF-8
-# he_IL.UTF-8 UTF-8
-# hi_IN UTF-8
-# hif_FJ UTF-8
-# hne_IN UTF-8
-# hr_HR.UTF-8 UTF-8
-# hsb_DE.UTF-8 UTF-8
-# ht_HT UTF-8
-# hu_HU.UTF-8 UTF-8
-# hy_AM UTF-8
-# ia_FR UTF-8
-# id_ID.UTF-8 UTF-8
-# ig_NG UTF-8
-# ik_CA UTF-8
-# is_IS.UTF-8 UTF-8
-# it_CH.UTF-8 UTF-8
-# it_IT.UTF-8 UTF-8
-# iu_CA UTF-8
-# ja_JP.UTF-8 UTF-8
-# ka_GE.UTF-8 UTF-8
-# kab_DZ UTF-8
-# kk_KZ.UTF-8 UTF-8
-# kl_GL.UTF-8 UTF-8
-# km_KH UTF-8
-# kn_IN UTF-8
-# ko_KR.UTF-8 UTF-8
-# kok_IN UTF-8
-# ks_IN UTF-8
-# ks_IN@devanagari UTF-8
-# ku_TR.UTF-8 UTF-8
-# kv_RU UTF-8
-# kw_GB.UTF-8 UTF-8
-# ky_KG UTF-8
-# lb_LU UTF-8
-# lg_UG.UTF-8 UTF-8
-# li_BE UTF-8
-# li_NL UTF-8
-# lij_IT UTF-8
-# ln_CD UTF-8
-# lo_LA UTF-8
-# lt_LT.UTF-8 UTF-8
-# ltg_LV.UTF-8 UTF-8
-# lv_LV.UTF-8 UTF-8
-# lzh_TW UTF-8
-# mag_IN UTF-8
-# mai_IN UTF-8
-# mai_NP UTF-8
-# mdf_RU UTF-8
-# mfe_MU UTF-8
-# mg_MG.UTF-8 UTF-8
-# mhr_RU UTF-8
-# mi_NZ.UTF-8 UTF-8
-# miq_NI UTF-8
-# mjw_IN UTF-8
-# mk_MK.UTF-8 UTF-8
-# ml_IN UTF-8
-# mn_MN UTF-8
-# mni_IN UTF-8
-# mnw_MM UTF-8
-# mr_IN UTF-8
-# ms_MY.UTF-8 UTF-8
-# mt_MT.UTF-8 UTF-8
-# my_MM UTF-8
-# nan_TW UTF-8
-# nan_TW@latin UTF-8
-# nb_NO.UTF-8 UTF-8
-# nds_DE UTF-8
-# nds_NL UTF-8
-# ne_NP UTF-8
-# nhn_MX UTF-8
-# niu_NU UTF-8
-# niu_NZ UTF-8
-# nl_AW UTF-8
-# nl_BE.UTF-8 UTF-8
-# nl_NL.UTF-8 UTF-8
-# nn_NO.UTF-8 UTF-8
-# nr_ZA UTF-8
-# nso_ZA UTF-8
-# oc_FR.UTF-8 UTF-8
-# om_ET UTF-8
-# om_KE.UTF-8 UTF-8
-# or_IN UTF-8
-# os_RU UTF-8
-# pa_IN UTF-8
-# pa_PK UTF-8
-# pap_AW UTF-8
-# pap_CW UTF-8
-# pl_PL.UTF-8 UTF-8
-# ps_AF UTF-8
-# pt_BR.UTF-8 UTF-8
-# pt_PT.UTF-8 UTF-8
-# quz_PE UTF-8
-# raj_IN UTF-8
-# rif_MA UTF-8
-# ro_RO.UTF-8 UTF-8
-# ru_RU.UTF-8 UTF-8
-# ru_UA.UTF-8 UTF-8
-# rw_RW UTF-8
-# sa_IN UTF-8
-# sah_RU UTF-8
-# sat_IN UTF-8
-# sc_IT UTF-8
-# scn_IT UTF-8
-# sd_IN UTF-8
-# sd_IN@devanagari UTF-8
-# se_NO UTF-8
-# sgs_LT UTF-8
-# shn_MM UTF-8
-# shs_CA UTF-8
-# si_LK UTF-8
-# sid_ET UTF-8
-# sk_SK.UTF-8 UTF-8
-# sl_SI.UTF-8 UTF-8
-# sm_WS UTF-8
-# so_DJ.UTF-8 UTF-8
-# so_ET UTF-8
-# so_KE.UTF-8 UTF-8
-# so_SO.UTF-8 UTF-8
-# sq_AL.UTF-8 UTF-8
-# sq_MK UTF-8
-# sr_ME UTF-8
-# sr_RS UTF-8
-# sr_RS@latin UTF-8
-# ss_ZA UTF-8
-# ssy_ER UTF-8
-# st_ZA.UTF-8 UTF-8
-# su_ID UTF-8
-# sv_FI.UTF-8 UTF-8
-# sv_SE.UTF-8 UTF-8
-# sw_KE UTF-8
-# sw_TZ UTF-8
-# syr UTF-8
-# szl_PL UTF-8
-# ta_IN UTF-8
-# ta_LK UTF-8
-# tcy_IN.UTF-8 UTF-8
-# te_IN UTF-8
-# tg_TJ.UTF-8 UTF-8
-# th_TH.UTF-8 UTF-8
-# the_NP UTF-8
-# ti_ER UTF-8
-# ti_ET UTF-8
-# tig_ER UTF-8
-# tk_TM UTF-8
-# tl_PH.UTF-8 UTF-8
-# tn_ZA UTF-8
-# to_TO UTF-8
-# tok UTF-8
-# tpi_PG UTF-8
-# tr_CY.UTF-8 UTF-8
-# tr_TR.UTF-8 UTF-8
-# ts_ZA UTF-8
-# tt_RU UTF-8
-# tt_RU@iqtelif UTF-8
-# ug_CN UTF-8
-# uk_UA.UTF-8 UTF-8
-# unm_US UTF-8
-# ur_IN UTF-8
-# ur_PK UTF-8
-# uz_UZ.UTF-8 UTF-8
-# uz_UZ@cyrillic UTF-8
-# ve_ZA UTF-8
-# vi_VN UTF-8
-# wa_BE.UTF-8 UTF-8
-# wae_CH UTF-8
-# wal_ET UTF-8
-# wo_SN UTF-8
-# xh_ZA.UTF-8 UTF-8
-# yi_US.UTF-8 UTF-8
-# yo_NG UTF-8
-# yue_HK UTF-8
-# yuw_PG UTF-8
-# zgh_MA UTF-8
-# zh_CN.UTF-8 UTF-8
-# zh_HK.UTF-8 UTF-8
-# zh_SG.UTF-8 UTF-8
-# zh_TW.UTF-8 UTF-8
-# zu_ZA.UTF-8 UTF-8
+# aa_DJ.UTF-8 UTF-8 # Afar (Djibouti)
+# aa_ER UTF-8 # Afar (Eritrea)
+# aa_ET UTF-8 # Afar (Ethiopia)
+# af_ZA.UTF-8 UTF-8 # Afrikaans (South Africa)
+# agr_PE UTF-8 # Aguaruna (Peru)
+# ak_GH UTF-8 # Akan (Ghana)
+# am_ET UTF-8 # Amharic (Ethiopia)
+# an_ES.UTF-8 UTF-8 # Aragonese (Spain)
+# anp_IN UTF-8 # Angika (India)
+# ar_AE.UTF-8 UTF-8 # Arabic (United Arab Emirates)
+# ar_BH.UTF-8 UTF-8 # Arabic (Bahrain)
+# ar_DZ.UTF-8 UTF-8 # Arabic (Algeria)
+# ar_EG.UTF-8 UTF-8 # Arabic (Egypt)
+# ar_IN UTF-8 # Arabic (India)
+# ar_IQ.UTF-8 UTF-8 # Arabic (Iraq)
+# ar_JO.UTF-8 UTF-8 # Arabic (Jordan)
+# ar_KW.UTF-8 UTF-8 # Arabic (Kuwait)
+# ar_LB.UTF-8 UTF-8 # Arabic (Lebanon)
+# ar_LY.UTF-8 UTF-8 # Arabic (Libya)
+# ar_MA.UTF-8 UTF-8 # Arabic (Morocco)
+# ar_OM.UTF-8 UTF-8 # Arabic (Oman)
+# ar_QA.UTF-8 UTF-8 # Arabic (Qatar)
+# ar_SA.UTF-8 UTF-8 # Arabic (Saudi Arabia)
+# ar_SD.UTF-8 UTF-8 # Arabic (Sudan)
+# ar_SS UTF-8 # Arabic (South Sudan)
+# ar_SY.UTF-8 UTF-8 # Arabic (Syria)
+# ar_TN.UTF-8 UTF-8 # Arabic (Tunisia)
+# ar_YE.UTF-8 UTF-8 # Arabic (Yemen)
+# ayc_PE UTF-8 # Aymara (Peru)
+# az_AZ UTF-8 # Azerbaijani (Azerbaijan)
+# az_IR UTF-8 # South Azerbaijani (Iran)
+# as_IN UTF-8 # Assamese (India)
+# ast_ES.UTF-8 UTF-8 # Asturian (Spain)
+# be_BY.UTF-8 UTF-8 # Belarusian (Belarus)
+# be_BY@latin UTF-8 # Belarusian (Belarus)
+# bem_ZM UTF-8 # Bemba (Zambia)
+# ber_DZ UTF-8 # Berber (Algeria)
+# ber_MA UTF-8 # Berber (Morocco)
+# bg_BG.UTF-8 UTF-8 # Bulgarian (Bulgaria)
+# bhb_IN.UTF-8 UTF-8 # Bhili (India)
+# bho_IN UTF-8 # Bhojpuri (India)
+# bho_NP UTF-8 # Bhojpuri (Nepal)
+# bi_VU UTF-8 # Bislama (Vanuatu)
+# bn_BD UTF-8 # Bangla (Bangladesh)
+# bn_IN UTF-8 # Bangla (India)
+# bo_CN UTF-8 # Tibetan (China)
+# bo_IN UTF-8 # Tibetan (India)
+# br_FR.UTF-8 UTF-8 # Breton (France)
+# brx_IN UTF-8 # Bodo (India)
+# bs_BA.UTF-8 UTF-8 # Bosnian (Bosnia & Herzegovina)
+# byn_ER UTF-8 # Blin (Eritrea)
+# ca_AD.UTF-8 UTF-8 # Catalan (Andorra)
+# ca_ES.UTF-8 UTF-8 # Catalan (Spain)
+# ca_ES@valencia UTF-8 # Catalan (Spain)
+# ca_FR.UTF-8 UTF-8 # Catalan (France)
+# ca_IT.UTF-8 UTF-8 # Catalan (Italy)
+# ce_RU UTF-8 # Chechen (Russia)
+# chr_US UTF-8 # Cherokee (United States)
+# ckb_IQ UTF-8 # Central Kurdish (Iraq)
+# cmn_TW UTF-8 # Mandarin Chinese (Taiwan)
+# crh_RU UTF-8 # Crimean Tatar (Russian Federation)
+# crh_UA UTF-8 # Crimean Tatar (Ukraine)
+# cs_CZ.UTF-8 UTF-8 # Czech (Czech Republic)
+# csb_PL UTF-8 # Kashubian (Poland)
+# cv_RU UTF-8 # Chuvash (Russia)
+# cy_GB.UTF-8 UTF-8 # Welsh (United Kingdom)
+# da_DK.UTF-8 UTF-8 # Danish (Denmark)
+# de_AT.UTF-8 UTF-8 # Austrian German (Austria)
+# de_BE.UTF-8 UTF-8 # German (Belgium)
+# de_CH.UTF-8 UTF-8 # Swiss High German (Switzerland)
+# de_DE.UTF-8 UTF-8 # German (Germany)
+# de_IT.UTF-8 UTF-8 # German (Italy)
+# de_LI.UTF-8 UTF-8 # German (Liechtenstein)
+# de_LU.UTF-8 UTF-8 # German (Luxembourg)
+# doi_IN UTF-8 # Dogri (India)
+# dsb_DE UTF-8 # Lower Sorbian (Germany)
+# dv_MV UTF-8 # Divehi (Maldives)
+# dz_BT UTF-8 # Dzongkha (Bhutan)
+# el_GR.UTF-8 UTF-8 # Greek (Greece)
+# el_CY.UTF-8 UTF-8 # Greek (Cyprus)
+# en_AG UTF-8 # English (Antigua & Barbuda)
+# en_AU.UTF-8 UTF-8 # Australian English (Australia)
+# en_BW.UTF-8 UTF-8 # English (Botswana)
+# en_CA.UTF-8 UTF-8 # Canadian English (Canada)
+# en_DK.UTF-8 UTF-8 # English (Denmark)
+# en_GB.UTF-8 UTF-8 # British English (United Kingdom)
+# en_HK.UTF-8 UTF-8 # English (Hong Kong SAR China)
+# en_IE.UTF-8 UTF-8 # English (Ireland)
+# en_IL UTF-8 # English (Israel)
+# en_IN UTF-8 # English (India)
+# en_NG UTF-8 # English (Nigeria)
+# en_NZ.UTF-8 UTF-8 # English (New Zealand)
+# en_PH.UTF-8 UTF-8 # English (Philippines)
+# en_SC.UTF-8 UTF-8 # English (Seychelles)
+# en_SG.UTF-8 UTF-8 # English (Singapore)
+# en_US.UTF-8 UTF-8 # American English (United States)
+# en_ZA.UTF-8 UTF-8 # English (South Africa)
+# en_ZM UTF-8 # English (Zambia)
+# en_ZW.UTF-8 UTF-8 # English (Zimbabwe)
+# eo UTF-8 # Esperanto
+# es_AR.UTF-8 UTF-8 # Spanish (Argentina)
+# es_BO.UTF-8 UTF-8 # Spanish (Bolivia)
+# es_CL.UTF-8 UTF-8 # Spanish (Chile)
+# es_CO.UTF-8 UTF-8 # Spanish (Colombia)
+# es_CR.UTF-8 UTF-8 # Spanish (Costa Rica)
+# es_CU UTF-8 # Spanish (Cuba)
+# es_DO.UTF-8 UTF-8 # Spanish (Dominican Republic)
+# es_EC.UTF-8 UTF-8 # Spanish (Ecuador)
+# es_ES.UTF-8 UTF-8 # European Spanish (Spain)
+# es_GT.UTF-8 UTF-8 # Spanish (Guatemala)
+# es_HN.UTF-8 UTF-8 # Spanish (Honduras)
+# es_MX.UTF-8 UTF-8 # Mexican Spanish (Mexico)
+# es_NI.UTF-8 UTF-8 # Spanish (Nicaragua)
+# es_PA.UTF-8 UTF-8 # Spanish (Panama)
+# es_PE.UTF-8 UTF-8 # Spanish (Peru)
+# es_PR.UTF-8 UTF-8 # Spanish (Puerto Rico)
+# es_PY.UTF-8 UTF-8 # Spanish (Paraguay)
+# es_SV.UTF-8 UTF-8 # Spanish (El Salvador)
+# es_US.UTF-8 UTF-8 # Spanish (United States)
+# es_UY.UTF-8 UTF-8 # Spanish (Uruguay)
+# es_VE.UTF-8 UTF-8 # Spanish (Venezuela)
+# et_EE.UTF-8 UTF-8 # Estonian (Estonia)
+# eu_ES.UTF-8 UTF-8 # Basque (Spain)
+# fa_IR UTF-8 # Persian (Iran)
+# ff_SN UTF-8 # Fulah (Senegal)
+# fi_FI.UTF-8 UTF-8 # Finnish (Finland)
+# fil_PH UTF-8 # Filipino (Philippines)
+# fo_FO.UTF-8 UTF-8 # Faroese (Faroe Islands)
+# fr_BE.UTF-8 UTF-8 # French (Belgium)
+# fr_CA.UTF-8 UTF-8 # Canadian French (Canada)
+# fr_CH.UTF-8 UTF-8 # Swiss French (Switzerland)
+# fr_FR.UTF-8 UTF-8 # French (France)
+# fr_LU.UTF-8 UTF-8 # French (Luxembourg)
+# fur_IT UTF-8 # Friulian (Italy)
+# fy_NL UTF-8 # Western Frisian (Netherlands)
+# fy_DE UTF-8 # Western Frisian (Germany)
+# ga_IE.UTF-8 UTF-8 # Irish (Ireland)
+# gbm_IN UTF-8 # Garhwali (India)
+# gd_GB.UTF-8 UTF-8 # Scottish Gaelic (United Kingdom)
+# gez_ER UTF-8 # Geez (Eritrea)
+# gez_ER@abegede UTF-8 # Geez (Eritrea)
+# gez_ET UTF-8 # Geez (Ethiopia)
+# gez_ET@abegede UTF-8 # Geez (Ethiopia)
+# gl_ES.UTF-8 UTF-8 # Galician (Spain)
+# gu_IN UTF-8 # Gujarati (India)
+# gv_GB.UTF-8 UTF-8 # Manx (United Kingdom)
+# ha_NG UTF-8 # Hausa (Nigeria)
+# hak_TW UTF-8 # Hakka Chinese (Taiwan)
+# he_IL.UTF-8 UTF-8 # Hebrew (Israel)
+# hi_IN UTF-8 # Hindi (India)
+# hif_FJ UTF-8 # Fiji Hindi (Fiji)
+# hne_IN UTF-8 # Chhattisgarhi (India)
+# hr_HR.UTF-8 UTF-8 # Croatian (Croatia)
+# hsb_DE.UTF-8 UTF-8 # Upper Sorbian (Germany)
+# ht_HT UTF-8 # Haitian Creole (Haiti)
+# hu_HU.UTF-8 UTF-8 # Hungarian (Hungary)
+# hy_AM UTF-8 # Armenian (Armenia)
+# ia_FR UTF-8 # Interlingua (France)
+# id_ID.UTF-8 UTF-8 # Indonesian (Indonesia)
+# ig_NG UTF-8 # Igbo (Nigeria)
+# ik_CA UTF-8 # Inupiaq (Canada)
+# is_IS.UTF-8 UTF-8 # Icelandic (Iceland)
+# it_CH.UTF-8 UTF-8 # Italian (Switzerland)
+# it_IT.UTF-8 UTF-8 # Italian (Italy)
+# iu_CA UTF-8 # Inuktitut (Canada)
+# ja_JP.UTF-8 UTF-8 # Japanese (Japan)
+# ka_GE.UTF-8 UTF-8 # Georgian (Georgia)
+# kab_DZ UTF-8 # Kabyle (Algeria)
+# kk_KZ.UTF-8 UTF-8 # Kazakh (Kazakhstan)
+# kl_GL.UTF-8 UTF-8 # Kalaallisut (Greenland)
+# km_KH UTF-8 # Khmer (Cambodia)
+# kn_IN UTF-8 # Kannada (India)
+# ko_KR.UTF-8 UTF-8 # Korean (South Korea)
+# kok_IN UTF-8 # Konkani (India)
+# ks_IN UTF-8 # Kashmiri (India)
+# ks_IN@devanagari UTF-8 # Kashmiri (India)
+# ku_TR.UTF-8 UTF-8 # Kurdish (Türkiye)
+# kv_RU UTF-8 # Komi (Russia)
+# kw_GB.UTF-8 UTF-8 # Cornish (United Kingdom)
+# ky_KG UTF-8 # Kyrgyz (Kyrgyzstan)
+# lb_LU UTF-8 # Luxembourgish (Luxembourg)
+# lg_UG.UTF-8 UTF-8 # Ganda (Uganda)
+# li_BE UTF-8 # Limburgish (Belgium)
+# li_NL UTF-8 # Limburgish (Netherlands)
+# lij_IT UTF-8 # Ligurian (Italy)
+# ln_CD UTF-8 # Lingala (Democratic Republic of the Congo)
+# lo_LA UTF-8 # Lao (Laos)
+# lt_LT.UTF-8 UTF-8 # Lithuanian (Lithuania)
+# ltg_LV.UTF-8 UTF-8 # Latgalian (Latvia)
+# lv_LV.UTF-8 UTF-8 # Latvian (Latvia)
+# lzh_TW UTF-8 # Literary Chinese (Taiwan)
+# mag_IN UTF-8 # Magahi (India)
+# mai_IN UTF-8 # Maithili (India)
+# mai_NP UTF-8 # Maithili (Nepal)
+# mdf_RU UTF-8 # Moksha (Russia)
+# mfe_MU UTF-8 # Morisyen (Mauritius)
+# mg_MG.UTF-8 UTF-8 # Malagasy (Madagascar)
+# mhr_RU UTF-8 # Meadow Mari (Russia)
+# mi_NZ.UTF-8 UTF-8 # Maori (New Zealand)
+# miq_NI UTF-8 # Miskito (Nicaragua)
+# mjw_IN UTF-8 # Karbi (India)
+# mk_MK.UTF-8 UTF-8 # Macedonian (Macedonia)
+# ml_IN UTF-8 # Malayalam (India)
+# mn_MN UTF-8 # Mongolian (Mongolia)
+# mni_IN UTF-8 # Manipuri (India)
+# mnw_MM UTF-8 # Mon (Myanmar)
+# mr_IN UTF-8 # Marathi (India)
+# ms_MY.UTF-8 UTF-8 # Malay (Malaysia)
+# mt_MT.UTF-8 UTF-8 # Maltese (Malta)
+# my_MM UTF-8 # Burmese (Myanmar/Burma)
+# nan_TW UTF-8 # Min Nan Chinese (Taiwan)
+# nan_TW@latin UTF-8 # Min Nan Chinese (Taiwan)
+# nb_NO.UTF-8 UTF-8 # Norwegian Bokmål (Norway)
+# nds_DE UTF-8 # Low German (Germany)
+# nds_NL UTF-8 # Low Saxon (Netherlands)
+# ne_NP UTF-8 # Nepali (Nepal)
+# nhn_MX UTF-8 # Central Nahuatl (Mexico)
+# niu_NU UTF-8 # Niuean (Niue)
+# niu_NZ UTF-8 # Niuean (New Zealand)
+# nl_AW UTF-8 # Dutch (Aruba)
+# nl_BE.UTF-8 UTF-8 # Flemish (Belgium)
+# nl_NL.UTF-8 UTF-8 # Dutch (Netherlands)
+# nn_NO.UTF-8 UTF-8 # Norwegian Nynorsk (Norway)
+# nr_ZA UTF-8 # South Ndebele (South Africa)
+# nso_ZA UTF-8 # Northern Sotho (South Africa)
+# oc_FR.UTF-8 UTF-8 # Occitan (France)
+# om_ET UTF-8 # Oromo (Ethiopia)
+# om_KE.UTF-8 UTF-8 # Oromo (Kenya)
+# or_IN UTF-8 # Odia (India)
+# os_RU UTF-8 # Ossetic (Russia)
+# pa_IN UTF-8 # Punjabi (India)
+# pa_PK UTF-8 # Punjabi (Pakistan)
+# pap_AW UTF-8 # Papiamento (Aruba)
+# pap_CW UTF-8 # Papiamento (Curaçao)
+# pl_PL.UTF-8 UTF-8 # Polish (Poland)
+# ps_AF UTF-8 # Pashto (Afghanistan)
+# pt_BR.UTF-8 UTF-8 # Brazilian Portuguese (Brazil)
+# pt_PT.UTF-8 UTF-8 # European Portuguese (Portugal)
+# quz_PE UTF-8 # Cusco Quechua (Peru)
+# raj_IN UTF-8 # Rajasthani (India)
+# rif_MA UTF-8 # Tarifit (Morocco)
+# ro_RO.UTF-8 UTF-8 # Romanian (Romania)
+# ru_RU.UTF-8 UTF-8 # Russian (Russia)
+# ru_UA.UTF-8 UTF-8 # Russian (Ukraine)
+# rw_RW UTF-8 # Kinyarwanda (Rwanda)
+# sa_IN UTF-8 # Sanskrit (India)
+# sah_RU UTF-8 # Sakha (Russian Federation)
+# sat_IN UTF-8 # Santali (India)
+# sc_IT UTF-8 # Sardinian (Italy)
+# scn_IT UTF-8 # Sicilian (Italy)
+# sd_IN UTF-8 # Sindhi (India)
+# sd_IN@devanagari UTF-8 # Sindhi (India)
+# se_NO UTF-8 # Northern Sami (Norway)
+# sgs_LT UTF-8 # Samogitian (Lithuania)
+# shn_MM UTF-8 # Shan (Myanmar)
+# shs_CA UTF-8 # Shuswap (Canada)
+# si_LK UTF-8 # Sinhala (Sri Lanka)
+# sid_ET UTF-8 # Sidamo (Ethiopia)
+# sk_SK.UTF-8 UTF-8 # Slovak (Slovakia)
+# sl_SI.UTF-8 UTF-8 # Slovenian (Slovenia)
+# sm_WS UTF-8 # Samoan (Samoa)
+# so_DJ.UTF-8 UTF-8 # Somali (Djibouti)
+# so_ET UTF-8 # Somali (Ethiopia)
+# so_KE.UTF-8 UTF-8 # Somali (Kenya)
+# so_SO.UTF-8 UTF-8 # Somali (Somalia)
+# sq_AL.UTF-8 UTF-8 # Albanian (Albania)
+# sq_MK UTF-8 # Albanian (Macedonia)
+# sr_ME UTF-8 # Serbian (Montenegro)
+# sr_RS UTF-8 # Serbian (Serbia)
+# sr_RS@latin UTF-8 # Serbian (Serbia)
+# ss_ZA UTF-8 # Swati (South Africa)
+# ssy_ER UTF-8 # Saho (Eritrea)
+# st_ZA.UTF-8 UTF-8 # Southern Sotho (South Africa)
+# su_ID UTF-8 # Sundanese (Indonesia)
+# sv_FI.UTF-8 UTF-8 # Swedish (Finland)
+# sv_SE.UTF-8 UTF-8 # Swedish (Sweden)
+# sw_KE UTF-8 # Swahili (Kenya)
+# sw_TZ UTF-8 # Swahili (Tanzania)
+# syr UTF-8 # Syriac
+# szl_PL UTF-8 # Silesian (Poland)
+# ta_IN UTF-8 # Tamil (India)
+# ta_LK UTF-8 # Tamil (Sri Lanka)
+# tcy_IN.UTF-8 UTF-8 # Tulu (India)
+# te_IN UTF-8 # Telugu (India)
+# tg_TJ.UTF-8 UTF-8 # Tajik (Tajikistan)
+# th_TH.UTF-8 UTF-8 # Thai (Thailand)
+# the_NP UTF-8 # Chitwania Tharu (Nepal)
+# ti_ER UTF-8 # Tigrinya (Eritrea)
+# ti_ET UTF-8 # Tigrinya (Ethiopia)
+# tig_ER UTF-8 # Tigre (Eritrea)
+# tk_TM UTF-8 # Turkmen (Turkmenistan)
+# tl_PH.UTF-8 UTF-8 # Tagalog (Philippines)
+# tn_ZA UTF-8 # Tswana (South Africa)
+# to_TO UTF-8 # Tongan (Tonga)
+# tok UTF-8 # Toki Pona
+# tpi_PG UTF-8 # Tok Pisin (Papua New Guinea)
+# tr_CY.UTF-8 UTF-8 # Turkish (Cyprus)
+# tr_TR.UTF-8 UTF-8 # Turkish (Türkiye)
+# ts_ZA UTF-8 # Tsonga (South Africa)
+# tt_RU UTF-8 # Tatar (Russia)
+# tt_RU@iqtelif UTF-8 # Tatar (Russia)
+# ug_CN UTF-8 # Uyghur (China)
+# uk_UA.UTF-8 UTF-8 # Ukrainian (Ukraine)
+# unm_US UTF-8 # Unami Delaware (United States)
+# ur_IN UTF-8 # Urdu (India)
+# ur_PK UTF-8 # Urdu (Pakistan)
+# uz_UZ.UTF-8 UTF-8 # Uzbek (Uzbekistan)
+# uz_UZ@cyrillic UTF-8 # Uzbek (Uzbekistan)
+# ve_ZA UTF-8 # Venda (South Africa)
+# vi_VN UTF-8 # Vietnamese (Vietnam)
+# wa_BE.UTF-8 UTF-8 # Walloon (Belgium)
+# wae_CH UTF-8 # Walser (Switzerland)
+# wal_ET UTF-8 # Wolaytta (Ethiopia)
+# wo_SN UTF-8 # Wolof (Senegal)
+# xh_ZA.UTF-8 UTF-8 # Xhosa (South Africa)
+# yi_US.UTF-8 UTF-8 # Yiddish (United States)
+# yo_NG UTF-8 # Yoruba (Nigeria)
+# yue_HK UTF-8 # Cantonese (Hong Kong SAR China)
+# yuw_PG UTF-8 # Yau (Papua New Guinea)
+# zgh_MA UTF-8 # Moroccan Tamazight (Morocco)
+# zh_CN.UTF-8 UTF-8 # Chinese (China)
+# zh_HK.UTF-8 UTF-8 # Chinese (Hong Kong SAR China)
+# zh_SG.UTF-8 UTF-8 # Chinese (Singapore)
+# zh_TW.UTF-8 UTF-8 # Chinese (Taiwan)
+# zu_ZA.UTF-8 UTF-8 # Zulu (South Africa)
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-10 17:05 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-10 17:05 UTC (permalink / raw
To: gentoo-commits
commit: 2d2ee989b05556a6ba109458f2fdb605eeb596e1
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 10 16:57:23 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Aug 10 17:04:42 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=2d2ee989
Delegate config file selection wholly to a new subroutine
This commit introduces the select_config_file() subroutine, which
relieves both the main block and the parse_opts() subroutine of their
joint responsibility in determining which config files are to be passed
to the read_config() subroutine.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/locale-gen b/locale-gen
index d1d66d7..948ee59 100755
--- a/locale-gen
+++ b/locale-gen
@@ -74,15 +74,7 @@ umask 0022;
my @locales = ([ 'C', 'UTF-8', 'C.UTF-8' ]);
# Compose a list of up to two configuration files to be read.
- my @config_files;
- if (exists $opt{'config'}) {
- push @config_files, $opt{'config'};
- } else {
- push @config_files, (
- catfile($prefix, '/etc', 'locale.gen'),
- catfile($prefix, '/usr/share/i18n', 'SUPPORTED')
- );
- }
+ my @config_files = select_config_files($prefix, %opt);
# Collect the locales that are being requested for installation.
push @locales, read_config($prefix, @config_files);
@@ -196,15 +188,29 @@ sub parse_opts ($known_prefix, @args) {
if (! exists $opt{'jobs'} || $opt{'jobs'} < 1) {
$opt{'jobs'} = get_nprocs() || 1;
}
- if ($opt{'all'}) {
- $opt{'config'} = catfile($opt{'prefix'} // $known_prefix, '/usr/share/i18n', 'SUPPORTED');
- } elsif (exists $opt{'config'} && $opt{'config'} eq '-') {
+
+ # Replace the special <hyphen-minus> operand with "/dev/stdin".
+ if (exists $opt{'config'} && $opt{'config'} eq '-') {
$opt{'config'} = '/dev/stdin';
}
return %opt;
}
+sub select_config_files ($prefix, %opt) {
+ my $path1 = catfile($prefix, '/etc', 'locale.gen');
+ my $path2 = catfile($prefix, '/usr/share/i18n', 'SUPPORTED');
+ return do {
+ if (exists $opt{'config'}) {
+ $opt{'config'};
+ } elsif (! $opt{'all'}) {
+ $path1, $path2;
+ } else {
+ $path2;
+ }
+ };
+}
+
sub show_usage (@options) {
print "Usage: locale-gen [OPTION]...\n\n";
my $pipe;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-10 8:15 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-10 8:15 UTC (permalink / raw
To: gentoo-commits
commit: 7eba2ce43d220fd4a2ff471202387b62934b6345
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 10 08:04:38 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Aug 10 08:12:13 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=7eba2ce4
Ensure that get_valid_locales() restores the current working directory
The get_valid_locales() subroutine should not change the current working
directory as a side effect of being called. Though the current working
directory is eventually changed again by calling enter_tempdir(), this
effect is enough to break the use of the -c option with relative paths.
# cd /usr/share/i18n
# locale-gen -c SUPPORTED
locale-gen: Can't open 'SUPPORTED': No such file or directory
Address this regression by ensuring that the prior current working
directory is restored before get_valid_locales() returns.
Fixes: a009d7c7ab382065555d60250752f11ef40c1c1c
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index 998df2c..d1d66d7 100755
--- a/locale-gen
+++ b/locale-gen
@@ -7,6 +7,7 @@
use v5.36;
+use Cwd qw(getcwd);
use Errno qw(ENOENT);
use Fcntl qw(SEEK_SET);
use File::Spec::Functions qw(canonpath catfile catdir splitpath);
@@ -283,12 +284,15 @@ sub read_config ($prefix, @paths) {
}
sub get_valid_locales ($prefix) {
- my $top = catdir($prefix, '/usr/share/i18n/locales');
my $cmd = qq{ find . ! -path . -prune ! -path '*\n*' -type f -exec grep -lxF LC_IDENTIFICATION {} + };
+ my $top = catdir($prefix, '/usr/share/i18n/locales');
+ my $pwd = getcwd();
if (! chdir $top) {
die "$PROGRAM: Can't chdir to '$top': $!\n";
} elsif (! (my @paths = readpipe $cmd) || $? != 0) {
die "$PROGRAM: Failed to compose a list of valid locale names from '$top'\n";
+ } elsif (defined $pwd && ! chdir $pwd) {
+ die "$PROGRAM: Can't chdir to '$pwd': $!\n";
} else {
chomp @paths;
return map +( (splitpath($_))[-1] ), @paths;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-10 1:22 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-10 1:22 UTC (permalink / raw
To: gentoo-commits
commit: 273767168b5c82472e534c5d7ca2f37da3906d0a
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 10 01:18:07 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sun Aug 10 01:20:20 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=27376716
Report the username if $locale_dir cannot be modified
Presently, if the user is unable to modify the directory that is
supposed to contain the locale archive, an exception shall be thrown
that mentions the effective UID.
Aborting because UID 1234 can't modify '/usr/lib/locale': Permission denied
Instead, mention the username.
Aborting because 'kerin' can't modify '/usr/lib/locale': Permission denied
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index fb1a9bf..998df2c 100755
--- a/locale-gen
+++ b/locale-gen
@@ -370,7 +370,8 @@ sub check_archive_dir ($prefix, $locale_dir) {
# Check whether the directory exists and can be modified by the EUID.
if (! utime undef, undef, $archive_dir) {
- die "$PROGRAM: Aborting because UID $> can't modify '$archive_dir': $!\n";
+ my $username = get_username();
+ die "$PROGRAM: Aborting because '$username' can't modify '$archive_dir': $!\n";
}
}
@@ -588,6 +589,11 @@ sub trim_line ($line) {
return $line;
}
+sub get_username () {
+ local $!;
+ return getpwuid($>) // $ENV{'LOGNAME'};
+}
+
END {
if ($$ == $PID) {
if (length $TEMPDIR) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-09 20:18 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-09 20:18 UTC (permalink / raw
To: gentoo-commits
commit: fe58127cc3b561edfaa547dd4d20d8330ffc7c5c
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 9 20:06:32 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Aug 9 20:15:57 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=fe58127c
locale.gen.5: Correct the locale name synopsis per XPG Issue 4
Currently, Section 7.6 of the glibc manual states that "most locale
names follow XPG syntax". In characteristic GNU fashion, it fails to
explain what XPG is or precisely which issue of the specification it is
referring to. It goes on to present the following locale name synopsis.
language[_territory[.codeset]][@modifier]
Such is a valid synopsis for XPG3. But glibc does not observe the
conventions of XPG3. Instead, it observes the conventions of XPG4. That
is, the X/Open Common Applications Environment (CAE) Portability Guide
Issue 4 (XPG4) specification. As such, the synopsis should actually be
written as follows.
language[_territory][.codeset][@modifier]
The difference is that all but the language portion of a locale name are
rendered optional by Issue 4. Indeed, the glibc manual goes on to
literally state that, "besides the first part, all of them are allowed
to be missing."
Though I cannot correct the glibc manual directly, I can correct the
locale.gen(5) man page. Do so by having it show the XPG4 synopsis.
Link: https://sourceware.org/glibc/manual/latest/html_node/Locale-Names.html
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/locale.gen.5 b/locale.gen.5
index 339d812..5a56e60 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -21,12 +21,12 @@ The definition of a <blank> character is that it is either the <tab> or <space>
character.
.SH "LOCALE NAMES"
The GNU C Library employs a locale naming scheme that is based upon the X/Open
-Portability Guide (XPG). A \fIlocalename\fR is composed of between one and four
-parts.
+Common Applications Environment (CAE) Portability Guide Issue 4 (XPG4)
+specification. A \fIlocalename\fR is composed of between one and four parts.
.P
.RS
.EX
-language[_territory[.codeset]][@modifier]
+language[_territory][.codeset][@modifier]
.EE
.RE
.P
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-09 19:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-09 19:42 UTC (permalink / raw
To: gentoo-commits
commit: aa815847970cffbe7c5c825e8f7dcc401ca82035
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 9 19:18:59 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Aug 9 19:18:59 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=aa815847
locale-gen.8: Add an EXIT STATUS section
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 64c89d8..51e573a 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -32,10 +32,10 @@ required locales. By default, locale\-gen shall read this file and compile only
the locales that are specified, saving both time and space in the longer term.
.P
If the configuration file is missing, empty, or consists only of comments,
-locale\-gen shall act in one of two ways, depending on whether the
-\fB\-\-config\fR option was specified. If specified then locale\-gen shall abort
-with a suitable diagnostic message. Otherwise, locale\-gen shall act as if the
-\fB\-\-all\fR option had been specified.
+locale\-gen shall act in one of two ways, depending on whether the \fB\-c\fR
+option was specified. If specified then locale\-gen shall abort with a suitable
+diagnostic message. Otherwise, locale\-gen shall act as if the \fB\-A\fR option
+had been specified.
.SH "OPTIONS"
.TP
\fB\-A\fR, \fB\-\-all\fR
@@ -71,6 +71,16 @@ A list of officially supported locales.
.TP
.I /usr/lib/locale/locale\-archive
Contains the currently installed locales.
+.SH "EXIT STATUS"
+The exit status shall be 0 under any of these conditions:
+.IP \[bu] 2
+the \fB\-h\fR and/or \fB\-V\fR options were specified
+.IP \[bu] 2
+the \fB\-u\fR option was specified but no locales need compiling
+.IP \[bu] 2
+the options and \fIconfig\fR were validated, the specified locales compiled and the resulting archive installed, without error
+.P
+Otherwise, the exit status shall be greater than 0.
.SH "AUTHORS"
Version 3.0 is the work of
.MT kfm@\:plushkava\:.net
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-09 19:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-09 19:42 UTC (permalink / raw
To: gentoo-commits
commit: b54f286110c85c5808594b0ced0cb8a5f08994b5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 9 19:37:41 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Aug 9 19:37:41 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=b54f2861
Disambiguate a mismatching codeset/charmap as a class of error
Consider the following two locale definitions, both of which are
erroneous.
# Invalid because the codeset part mismatches the charmap
zh_CN.GB18030 UTF-8
# Invalid because the charmap does not exist
zh_CN GB2319
Presently, locale-gen(8) will raise the same diagnostic for both cases,
complaining of an "invalid/mismatching charmap". Render the
parse_config() subroutine able to distinguish between both cases so that
the diagnostics can be improved.
Mismatching codeset/charmap at /etc/locale.gen[2]: "zh_CN.GB18030 UTF-8"
Invalid charmap at /etc/locale.gen[5]: "zh_CN GB2319"
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/locale-gen b/locale-gen
index cb54ed5..fb1a9bf 100755
--- a/locale-gen
+++ b/locale-gen
@@ -328,13 +328,15 @@ sub parse_config ($fh, $path, $locale_by, $charmap_by) {
# Extract the specified locale and character map. Upon success,
# a canonicalised representation of the locale is also returned.
- my ($locale, $charmap, $canonical) = parse_entry(@fields);
+ my ($locale, $codeset, $charmap, $canonical) = parse_entry(@fields);
# Validate both locale and character map before accepting.
if (! $locale_by->{$locale}) {
$thrower->('Invalid locale', $line);
+ } elsif (defined $codeset && $codeset ne $charmap) {
+ $thrower->('Mismatching codeset/charmap', $line);
} elsif (! $charmap_by->{$charmap}) {
- $thrower->('Invalid/mismatching charmap', $line);
+ $thrower->('Invalid charmap', $line);
} else {
push @locales, [ $locale, $charmap, $canonical ];
}
@@ -345,21 +347,19 @@ sub parse_config ($fh, $path, $locale_by, $charmap_by) {
sub parse_entry ($locale, $charmap) {
my $canonical;
+ my $codeset;
if (2 == (my @fields = split /@/, $locale, 3)) {
# de_DE@euro ISO-8859-15 => de_DE.ISO-8859-15@euro
$canonical = sprintf '%s.%s@%s', $fields[0], $charmap, $fields[1];
} elsif (2 == (@fields = split /\./, $locale, 3)) {
# en_US.UTF-8 UTF-8 => en_US.UTF-8
- $locale = $fields[0];
- $canonical = "$locale.$charmap";
- if ($fields[1] ne $charmap) {
- $charmap = '';
- }
+ ($locale, $codeset) = @fields;
+ $canonical = "$locale.$codeset";
} elsif (1 == @fields) {
# en_US ISO-8859-1 => en_US.ISO-8859-1
$canonical = "$locale.$charmap";
}
- return $locale, $charmap, $canonical;
+ return $locale, $codeset, $charmap, $canonical;
}
sub check_archive_dir ($prefix, $locale_dir) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-09 19:42 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-09 19:42 UTC (permalink / raw
To: gentoo-commits
commit: 1088be9dab012bc56fd3686a96f3cea1fa3fb45f
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Aug 9 14:43:51 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Aug 9 14:43:51 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=1088be9d
Have the --help option reference the man pages
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 2 ++
1 file changed, 2 insertions(+)
diff --git a/locale-gen b/locale-gen
index 96e1060..cb54ed5 100755
--- a/locale-gen
+++ b/locale-gen
@@ -215,6 +215,8 @@ sub show_usage (@options) {
my ($long, $short) = split /[|=]/, $spec;
printf {$pipe} "-%s, --%s\037%s\n", $short, $long, $description;
}
+ close $pipe;
+ print "\nSee also: locale-gen(8), locale.gen(5)\n";
}
sub show_version () {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-08 17:44 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-08 17:44 UTC (permalink / raw
To: gentoo-commits
commit: 40842471ee469d5fd6f0673074a57c359531df72
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 8 17:37:32 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 8 17:41:03 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=40842471
Bump $VERSION to 3.2
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 2809055..96e1060 100755
--- a/locale-gen
+++ b/locale-gen
@@ -22,7 +22,7 @@ use experimental qw(try);
my $PROGRAM;
BEGIN { $PROGRAM = (splitpath(__FILE__))[-1]; }
-my $VERSION = '3.1';
+my $VERSION = '3.2';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-08 17:44 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-08 17:44 UTC (permalink / raw
To: gentoo-commits
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) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-08 17:44 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-08 17:44 UTC (permalink / raw
To: gentoo-commits
commit: 73b9dbd0b07ad4930631c05ebdb3e3d647d86bb4
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 8 16:28:15 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 8 16:28:15 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=73b9dbd0
locale-gen.8: position the FILES section before AUTHORS
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 8637ef0..64c89d8 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -61,6 +61,16 @@ Suppress the compilation of locales that are already installed (not recommended)
.TP
\fB\-V\fR, \fB\-\-version\fR
Write out some details regarding the program then exit.
+.SH "FILES"
+.TP
+.I /etc/locale.gen
+Specifies the locales to be compiled.
+.TP
+.I /usr/share/i18n/SUPPORTED
+A list of officially supported locales.
+.TP
+.I /usr/lib/locale/locale\-archive
+Contains the currently installed locales.
.SH "AUTHORS"
Version 3.0 is the work of
.MT kfm@\:plushkava\:.net
@@ -75,16 +85,6 @@ Mike Frysinger
Please report bugs via
.UR https://\:bugs\:.gentoo\:.org/
.UE .
-.SH "FILES"
-.TP
-.I /etc/locale.gen
-Specifies the locales to be compiled.
-.TP
-.I /usr/share/i18n/SUPPORTED
-A list of officially supported locales.
-.TP
-.I /usr/lib/locale/locale\-archive
-Contains the currently installed locales.
.SH "SEE ALSO"
.BR locale (1),
.BR localedef (1),
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-08 17:44 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-08 17:44 UTC (permalink / raw
To: gentoo-commits
commit: 147982c51d46e9c6203b5a87119c6ceff9493411
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 8 17:29:37 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 8 17:37:11 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=147982c5
locale.gen.5: correct a Japanese locale typo in the EXAMPLES section
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale.gen.5 b/locale.gen.5
index 0d144fa..339d812 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -53,7 +53,7 @@ en_US.UTF\-8 UTF\-8
zh_CN.UTF\-8 UTF\-8
de_DE.UTF\-8 UTF\-8
hi_IN.UTF\-8 UTF\-8
-jp_JP.UTF\-8 UTF\-8
+ja_JP.UTF\-8 UTF\-8
.sp
# This is invalid because the charmap field is missing.
en_US.UTF\-8
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 23:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 23:20 UTC (permalink / raw
To: gentoo-commits
commit: b64812c4a3361978c6ebcf6c129fbbff4d9df52e
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 23:18:53 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 23:20:04 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=b64812c4
Bump $VERSION to 3.1
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 7c87e79..142af0e 100755
--- a/locale-gen
+++ b/locale-gen
@@ -22,7 +22,7 @@ use experimental qw(try);
my $PROGRAM;
BEGIN { $PROGRAM = (splitpath(__FILE__))[-1]; }
-my $VERSION = '3.0';
+my $VERSION = '3.1';
my $DEFERRED_SIGNAL = '';
my $PID = $$;
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 23:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 23:20 UTC (permalink / raw
To: gentoo-commits
commit: 203663d37bec377cfe49fe45abc05cfd520af3a1
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 23:15:47 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 23:16:39 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=203663d3
Allow for options to be parsed before aborting for a foreign libc
It should always be possible for the -h and -V options to be honoured,
irrespective of whether the platform is compatible with locale-gen(8).
Make it so.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/locale-gen b/locale-gen
index 6dc7ad3..7c87e79 100755
--- a/locale-gen
+++ b/locale-gen
@@ -47,15 +47,23 @@ umask 0022;
my $locale_dir = get_locale_dir();
# Infer the path of a Gentoo Prefix environment, if any.
- my $gentoo_prefix = detect_gentoo_prefix($locale_dir);
- if (length $gentoo_prefix) {
- $locale_dir =~ s/^\Q$gentoo_prefix//;
+ my $gentoo_prefix = '';
+ if (defined $locale_dir) {
+ $gentoo_prefix = detect_gentoo_prefix($locale_dir);
+ if (length $gentoo_prefix) {
+ $locale_dir =~ s/^\Q$gentoo_prefix//;
+ }
}
# Collect any supported options and option-arguments.
my %opt = parse_opts($gentoo_prefix, @ARGV);
my $prefix = $opt{'prefix'} // $gentoo_prefix;
+ # For the directory to be unknown strongly implies the absence of glibc.
+ if (! defined $locale_dir) {
+ die "$PROGRAM: Aborting because the OS does not appear to use GNU libc\n";
+ }
+
# Honour the --quiet option.
if ($opt{'quiet'} && ! open *STDOUT, '>/dev/null') {
die "Can't direct STDOUT to /dev/null: $!";
@@ -128,7 +136,7 @@ sub get_locale_dir () {
return canonpath($1);
} elsif (($? & 0xFF) == 0) {
# The child terminated normally (in the sense of WIFEXITED).
- die "$PROGRAM: Aborting because the OS does not appear to use GNU libc\n";
+ return undef;
} else {
throw_child_error('localedef');
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 22:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 22:59 UTC (permalink / raw
To: gentoo-commits
commit: ed754eb5b9f98ae915349dcf994b631f7eefa6f7
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 22:56:33 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 22:58:23 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=ed754eb5
locale.gen: remove the comments masquerading as documentation
It is not worth the effort to revise them in accordance with the current
state of the locale.gen(5) man page. Besides which, it is hardly
untoward to expect a user to enter a simple command in order to read the
documentation.
See-also: fe5bd5fa7bb7a9aa231f5fdd424f221884f505a0
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/locale.gen b/locale.gen
index ff0025a..fe72e5f 100644
--- a/locale.gen
+++ b/locale.gen
@@ -1,24 +1,5 @@
-# /etc/locale.gen: list all of the locales you want to have on your system.
-# See the locale.gen(5) man page for more details.
-#
-# The format of each line:
-# <locale name> <charset>
-#
-# Where <locale name> starts with a name as found in /usr/share/i18n/locales/.
-# It must be unique in the file as it is used as the key to locale variables.
-# For non-default encodings, the <charset> is typically appended.
-#
-# Where <charset> is a charset located in /usr/share/i18n/charmaps/ (sans any
-# suffix like ".gz").
-#
-# All blank lines and lines starting with # are ignored.
-#
-# For the default list of supported combinations, see the file:
-# /usr/share/i18n/SUPPORTED
-#
-# Whenever glibc is emerged, the locales listed here will be automatically
-# rebuilt for you. After updating this file, you can simply run `locale-gen`
-# yourself instead of re-emerging glibc.
+# This file defines which locales to incorporate into the glibc locale archive.
+# See the locale.gen(5) and locale-gen(8) man pages for more details.
# aa_DJ.UTF-8 UTF-8
# aa_ER UTF-8
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 22:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 22:59 UTC (permalink / raw
To: gentoo-commits
commit: 445ee5752f9265223f98c68fe4d433db90ed9099
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 20:42:15 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 20:42:15 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=445ee575
locale-gen.8: use the .UR and .UE macros to format hyperlinks
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/locale-gen.8 b/locale-gen.8
index e10367b..b1d3fbd 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -72,7 +72,9 @@ Prior versions are chiefly the work of
Mike Frysinger
.ME .
.SH "REPORTING BUGS"
-Please report bugs via http://bugs.gentoo.org/.
+Please report bugs via
+.UR https://\:bugs\:.gentoo\:.org/
+.UE .
.SH "FILES"
.TP
.I /etc/locale.gen
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 22:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 22:59 UTC (permalink / raw
To: gentoo-commits
commit: 3fa5a36271b192042b617d400ce6e1f7564cf502
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 21:33:55 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 22:25:28 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=3fa5a362
locale-gen.8: spell out /etc/locale.gen directly under DESCRIPTION
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale-gen.8 b/locale-gen.8
index b1d3fbd..8637ef0 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -27,7 +27,7 @@ integrate them into a central archive.
A default installation of Gentoo Linux provides an archive that contains all
supported locales, numbering 500 or more. However, it is typical for an
administrator to require only one or two of these. In that case, the
-\fBlocale.gen\fR(5) configuration file may be populated with a list of the
+\fI/etc/locale.gen\fR configuration file may be populated with a list of the
required locales. By default, locale\-gen shall read this file and compile only
the locales that are specified, saving both time and space in the longer term.
.P
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 22:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 22:59 UTC (permalink / raw
To: gentoo-commits
commit: fe5bd5fa7bb7a9aa231f5fdd424f221884f505a0
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 22:50:28 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 22:50:28 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=fe5bd5fa
locale.gen.5: rewrite entirely
This commit incorporates a rewrite of the locale.gen(5) man page, almost
in its entirety. The intent in rewriting was to achieve these goals:
- to write in a fashion that is comparable to a technical writer
- to describe the supported syntax in unambiguous terms
- to explain what a locale name is and how it is formed
- to explain what a charmap is
- to refrain from encouraging users to use any charmap other than UTF-8
To that end, it introduces the "LOCALE NAMES", "CHARACTER MAPS" and
"FILES" sections, and revises the "EXAMPLES" section. Further, the
"SEE ALSO" section now references the locale.conf(5) man page.
See-also: 2ca0c57bc448e1e1a3fc17b952f805f7c9b4bdc9
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 120 ++++++++++++++++++++++++++++++++++-------------------------
1 file changed, 69 insertions(+), 51 deletions(-)
diff --git a/locale.gen.5 b/locale.gen.5
index 4c7c59c..0d144fa 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -1,63 +1,81 @@
-.\" -*- nroff -*-
-.\" Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-.\"
-.\" This program is free software; you can redistribute it and/or modify
-.\" it under the terms of the GNU General Public License as published by
-.\" the Free Software Foundation; either version 2, or (at your option)
-.\" any later version.
-.\"
-.\" This program is distributed in the hope that it will be useful,
-.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
-.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.\" GNU General Public License for more details.
-.\"
-.\" You should have received a copy of the GNU General Public License
-.\" along with this program; if not, write to the Free Software Foundation,
-.\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.TH locale.gen 5 "August 2025" "Gentoo"
.SH "NAME"
-locale.gen \- Configuration file for locale-gen
+locale.gen - configuration file for locale\-gen
.SH "DESCRIPTION"
-The file \fB/etc/locale.gen\fP lists the locales that are to be generated
-by the \fBlocale-gen\fP command.
-
-Each line is of the form:
-
-<locale name> <charset>
-
-Where <locale name> starts with a name as found in
-.BR /usr/share/i18n/locales/ .
-It must be unique in the file as it is used as the key to locale variables
-(e.g. when you do `export LANG="<locale name>"`). For default encodings,
-the <charset> is typically omitted, else it is appended with a "." separator.
-
-Where <charset> is one of the character sets listed in
-.B /usr/share/i18n/charmaps
-(sans any suffix like ".gz"). It should use the same naming conventions too --
-all caps, and dashes/underscores included. e.g. Use "UTF-8", not "utf8".
-
-The
-.B locale-gen
-command will generate all the locales, placing them in
-\fB/usr/lib/locale\fP.
-
-Comments start with the hash mark # and may only be on new lines.
+The \fBlocale\-gen\fR(8) utility compiles the locales specified by the
+\fI/etc/locale.gen\fR file and integrates them into a locale archive.
+.P
+If present, the file must be comprised by zero or more lines, each of which
+must be comprised by two fields, separated by one or more <blank> characters.
+Leading and trailing <blank> characters are permitted. The first field shall be
+considered as a \fIlocalename\fR and the second field as a \fIcharmap\fR. The
+\fI/usr/share/i18n/SUPPORTED\fR file contains a complete list of the supported
+combinations.
+.P
+Lines that are empty, or which contain only <blank> characters, shall be
+disregarded. Also, lines that begin with zero or more <blank> characters,
+followed by a <number\-sign> character, shall be considered as comments and
+disregarded.
+.P
+The definition of a <blank> character is that it is either the <tab> or <space>
+character.
+.SH "LOCALE NAMES"
+The GNU C Library employs a locale naming scheme that is based upon the X/Open
+Portability Guide (XPG). A \fIlocalename\fR is composed of between one and four
+parts.
+.P
+.RS
+.EX
+language[_territory[.codeset]][@modifier]
+.EE
+.RE
+.P
+A complete list of supported \fIlocalename\fR values can be obtained by reading
+the first column of the \fI/usr/share/i18n/SUPPORTED\fR file.
+.P
+Assuming that a given locale is available, it can be effected by assigning its
+\fIlocalename\fR to the LANG environment variable.
+.SH "CHARACTER MAPS"
+A \fIcharmap\fR, also known as a character set or codeset, is a mapping of
+character symbols and collating element symbols to actual character encodings,
+allowing for computers to encode and decode text in a standard way.
+.P
+A complete list of supported \fIcharmap\fR values can be obtained by reading
+the second column of the \fI/usr/share/i18n/SUPPORTED\fR file.
+.P
+Given that not all values of \fIlocalename\fR incorporate a codeset, the
+configuration file requires for the second field of each line to define a
+\fIcharmap\fR.
.SH "EXAMPLES"
-.nf
-# Create a "en_US" locale using ISO-8859-1 encoding.
-# When you set LANG=en_US or LANG=en_US.ISO-8859-1, this is used.
-.B en_US ISO-8859-1
-
-# Create a "en_US" locale using UTF-8 encoding.
-# When you set LANG=en_US.UTF-8, this is used.
-.B en_US.UTF-8 UTF-8
-.fi
+.EX
+# This is a comment, followed by some valid locale declarations.
+en_US.UTF\-8 UTF\-8
+zh_CN.UTF\-8 UTF\-8
+de_DE.UTF\-8 UTF\-8
+hi_IN.UTF\-8 UTF\-8
+jp_JP.UTF\-8 UTF\-8
+.sp
+# This is invalid because the charmap field is missing.
+en_US.UTF\-8
+.sp
+# This is invalid because the charmap does not match the codeset.
+en_US.UTF\-8 ISO\-8859\-1
+.EE
+.SH "FILES"
+.TP
+.I /etc/locale.gen
+The default location of the configuration file.
+.TP
+.I /usr/share/i18n/SUPPORTED
+A list of supported \fIlocalename\fR and \fIcharmap\fR combinations.
.SH "SEE ALSO"
.BR locale (1),
.BR localedef (1),
-.BR locale-gen (8)
+.BR locale.conf (5),
+.BR locale\-gen (8)
.SH "AUTHORS"
.nf
Alastair McKinstry <mckinstry@computer.org>
Mike Frysinger <vapier@gentoo.org>
+Kerin Millar <kfm@plushkava.net>
.fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 22:59 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 22:59 UTC (permalink / raw
To: gentoo-commits
commit: f34f30604c845587c62a57d9cd725da6eabe8230
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 20:27:09 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 20:27:09 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=f34f3060
locale-gen.8: use the .MT and .ME macros to format email addresses
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 02e9e69..e10367b 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -62,11 +62,15 @@ Suppress the compilation of locales that are already installed (not recommended)
\fB\-V\fR, \fB\-\-version\fR
Write out some details regarding the program then exit.
.SH "AUTHORS"
-.fi
-Version 3.0 is the work of Kerin Millar <kfm@plushkava.net>.
+Version 3.0 is the work of
+.MT kfm@\:plushkava\:.net
+Kerin Millar
+.ME .
.br
-Prior versions are chiefly the work of Mike Frysinger <vapier@google.com>.
-.nf
+Prior versions are chiefly the work of
+.MT vapier@\:google\:.com
+Mike Frysinger
+.ME .
.SH "REPORTING BUGS"
Please report bugs via http://bugs.gentoo.org/.
.SH "FILES"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 19:43 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 19:43 UTC (permalink / raw
To: gentoo-commits
commit: 57ea366ffa6d5ed5d6348ca08ed361b9bba21856
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 19:43:08 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 19:43:08 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=57ea366f
locale-gen.8: remove an unnecessary use of the word, shall
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 73b47bc..02e9e69 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -24,8 +24,8 @@ Library. It accomplishes this by acting as a user-friendly frontend for the
standard \fBlocaledef\fR(1) utility, which is used to compile locales and
integrate them into a central archive.
.P
-A default installation of Gentoo Linux shall provide an archive that contains
-all supported locales, numbering 500 or more. However, it is typical for an
+A default installation of Gentoo Linux provides an archive that contains all
+supported locales, numbering 500 or more. However, it is typical for an
administrator to require only one or two of these. In that case, the
\fBlocale.gen\fR(5) configuration file may be populated with a list of the
required locales. By default, locale\-gen shall read this file and compile only
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 19:41 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 19:41 UTC (permalink / raw
To: gentoo-commits
commit: e3c9ba62faddae3c9a649e2ceffee588716de21c
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 19:12:40 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 19:12:40 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=e3c9ba62
locale-gen.8: write "central archive" instead of "single archive"
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale-gen.8 b/locale-gen.8
index a568a62..ff9347d 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -22,7 +22,7 @@ The locale\-gen utility provides a means by which a system administrator may
conveniently manage the set of locales that are made available to the GNU C
Library. It accomplishes this by acting as a user-friendly frontend for the
standard \fBlocaledef\fR(1) utility, which is used to compile locales and
-integrate them into a single archive.
+integrate them into a central archive.
.P
A default installation of Gentoo Linux shall provide an archive that contains
all supported locales, numbering 500 or more. However, it is typical for an
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 19:41 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 19:41 UTC (permalink / raw
To: gentoo-commits
commit: 2ca0c57bc448e1e1a3fc17b952f805f7c9b4bdc9
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 19:38:53 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 19:38:53 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=2ca0c57b
locale-gen.8: reference locale.conf(5) in SEE ALSO
Also, refrain from referencing locale(5) and locale(7). The rationale is
to present only the man pages that are most likely to be of immediate
interest to someone using the locale-gen(8) utility. Besides which, both
are referenced by locale(1) and localedef(1).
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index ff9347d..73b47bc 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -82,6 +82,5 @@ Contains the currently installed locales.
.SH "SEE ALSO"
.BR locale (1),
.BR localedef (1),
-.BR locale (5),
.BR locale.gen (5),
-.BR locale (7)
+.BR locale.conf (5)
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 16:35 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 16:35 UTC (permalink / raw
To: gentoo-commits
commit: 838930803fc268c2dfc850bf719a5f001b70c499
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 16:34:12 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 16:34:12 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=83893080
locale-gen.8: add a SYNOPSIS section
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 1a4955f..a568a62 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -1,6 +1,22 @@
.TH "locale-gen" "8" "Aug 2025" "Gentoo"
.SH "NAME"
locale\-gen - safely compile and install a glibc locale archive
+.SH "SYNOPSIS"
+.SY locale-gen
+.RB [ \-Aqu ]
+.RB [ \-c\~\c
+.IR config ]
+.RB [ \-j\~\c
+.IR jobs ]
+.RB [ \-p\~\c
+.IR prefix ]
+.YS
+.SY locale-gen
+.B \-h
+.YS
+.SY locale-gen
+.B \-V
+.YS
.SH "DESCRIPTION"
The locale\-gen utility provides a means by which a system administrator may
conveniently manage the set of locales that are made available to the GNU C
@@ -28,14 +44,14 @@ Compile all locales that are officially supported by glibc.
\fB\-c\fR, \fB\-\-config\fR \fIconfig\fR
Read the given \fIconfig\fR file (defaults to /etc/locale.gen).
.TP
-\fB\-d\fR, \fB\-\-prefix\fR \fIdirectory\fR
-Treat most filesystem paths as being relative to the given \fIdirectory\fR (defaults to / if not a Gentoo Prefix system).
+\fB\-d\fR, \fB\-\-prefix\fR \fIprefix\fR
+Treat most filesystem paths as being relative to the specified \fIprefix\fR (defaults to / if not a Gentoo Prefix system).
.TP
\fB\-h\fR, \fB\-\-help\fR
Write out a synopsis and summary of the supported options then exit.
.TP
-\fB\-j\fR, \fB\-\-jobs\fR \fIinteger\fR
-Spawn up to \fIinteger\fR workers to compile locales in parallel (defaults to the number of logical processors).
+\fB\-j\fR, \fB\-\-jobs\fR \fIjobs\fR
+Spawn up to the specified number of \fIjobs\fR to compile locales in parallel (defaults to the number of logical processors).
.TP
\fB\-q\fR, \fB\-\-quiet\fR
Suppress the writing of informational messages to standard output.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 16:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 16:20 UTC (permalink / raw
To: gentoo-commits
commit: 6c372156b85d0ccb452c68fc24602d7c7978bb38
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 6 17:30:05 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 6 17:30:05 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=6c372156
locale.gen.5: remove the OPTIONS section
The OPTIONS section claims that the locale.gen(5) configuration file may
contain a line with a value of "no-locale-archive", whereupon it shall
be treated as an option by locale-gen(8). This is no longer the case.
Remove this section.
See-also: 1baa3626b0bfa269b8c195caddb4629195c89371
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen.5 | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
diff --git a/locale.gen.5 b/locale.gen.5
index dbcc8c6..4c7c59c 100644
--- a/locale.gen.5
+++ b/locale.gen.5
@@ -14,7 +14,7 @@
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software Foundation,
.\" Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-.TH locale.gen 5 "July 2005" "Debian GNU/Linux"
+.TH locale.gen 5 "August 2025" "Gentoo"
.SH "NAME"
locale.gen \- Configuration file for locale-gen
.SH "DESCRIPTION"
@@ -42,20 +42,6 @@ command will generate all the locales, placing them in
\fB/usr/lib/locale\fP.
Comments start with the hash mark # and may only be on new lines.
-.SH "OPTIONS"
-Options start with #% (to preserve backwards compatibility).
-
-# This enables the "foo" option.
-.br
-#%foo
-.TP
-.B no-locale-archive
-Disable generation of the locale archive file and instead generate multiple
-files/directories for each locale. This slows down runtime greatly (by having
-multiple files spread out in the filesystem instead of a single binary file),
-but it does mean build time is much faster (as you can generate in parallel).
-
-You should not use this option.
.SH "EXAMPLES"
.nf
# Create a "en_US" locale using ISO-8859-1 encoding.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 16:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 16:20 UTC (permalink / raw
To: gentoo-commits
commit: accce6052421747e44cc3b01bbd7472aa8ca8682
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 16:07:21 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 16:18:52 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=accce605
locale-gen.8: add full stops (periods) where appropriate
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 3ab1cd9..1a4955f 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -23,28 +23,28 @@ with a suitable diagnostic message. Otherwise, locale\-gen shall act as if the
.SH "OPTIONS"
.TP
\fB\-A\fR, \fB\-\-all\fR
-Compile all locales that are officially supported by glibc
+Compile all locales that are officially supported by glibc.
.TP
\fB\-c\fR, \fB\-\-config\fR \fIconfig\fR
-Read the given \fIconfig\fR file (defaults to /etc/locale.gen)
+Read the given \fIconfig\fR file (defaults to /etc/locale.gen).
.TP
\fB\-d\fR, \fB\-\-prefix\fR \fIdirectory\fR
-Treat most filesystem paths as being relative to the given \fIdirectory\fR (defaults to / if not a Gentoo Prefix system)
+Treat most filesystem paths as being relative to the given \fIdirectory\fR (defaults to / if not a Gentoo Prefix system).
.TP
\fB\-h\fR, \fB\-\-help\fR
-Write out a synopsis and summary of the supported options then exit
+Write out a synopsis and summary of the supported options then exit.
.TP
\fB\-j\fR, \fB\-\-jobs\fR \fIinteger\fR
-Spawn up to \fIinteger\fR workers to compile locales in parallel (defaults to the number of logical processors)
+Spawn up to \fIinteger\fR workers to compile locales in parallel (defaults to the number of logical processors).
.TP
\fB\-q\fR, \fB\-\-quiet\fR
-Suppress the writing of informational messages to standard output
+Suppress the writing of informational messages to standard output.
.TP
\fB\-u\fR, \fB\-\-update\fR
-Suppress the compilation of locales that are already installed (not recommended)
+Suppress the compilation of locales that are already installed (not recommended).
.TP
\fB\-V\fR, \fB\-\-version\fR
-Write out some details regarding the program then exit
+Write out some details regarding the program then exit.
.SH "AUTHORS"
.fi
Version 3.0 is the work of Kerin Millar <kfm@plushkava.net>.
@@ -52,7 +52,7 @@ Version 3.0 is the work of Kerin Millar <kfm@plushkava.net>.
Prior versions are chiefly the work of Mike Frysinger <vapier@google.com>.
.nf
.SH "REPORTING BUGS"
-Please report bugs via http://bugs.gentoo.org/
+Please report bugs via http://bugs.gentoo.org/.
.SH "FILES"
.TP
.I /etc/locale.gen
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 16:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 16:20 UTC (permalink / raw
To: gentoo-commits
commit: 36d81ee2593eb13ca4d68b7fa202fbe37989ea7a
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 16:01:00 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 16:18:50 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=36d81ee2
locale-gen.8: remove "<" and ">" from option-args
Remove the <less-than-sign> and <greater-than-sign> characters from the
option-arguments, for their presence is unconventional.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 114d44f..3ab1cd9 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -25,16 +25,16 @@ with a suitable diagnostic message. Otherwise, locale\-gen shall act as if the
\fB\-A\fR, \fB\-\-all\fR
Compile all locales that are officially supported by glibc
.TP
-\fB\-c\fR, \fB\-\-config\fR \fI<config>\fR
+\fB\-c\fR, \fB\-\-config\fR \fIconfig\fR
Read the given \fIconfig\fR file (defaults to /etc/locale.gen)
.TP
-\fB\-d\fR, \fB\-\-prefix\fR \fI<directory>\fR
+\fB\-d\fR, \fB\-\-prefix\fR \fIdirectory\fR
Treat most filesystem paths as being relative to the given \fIdirectory\fR (defaults to / if not a Gentoo Prefix system)
.TP
\fB\-h\fR, \fB\-\-help\fR
Write out a synopsis and summary of the supported options then exit
.TP
-\fB\-j\fR, \fB\-\-jobs\fR \fI<integer>\fR
+\fB\-j\fR, \fB\-\-jobs\fR \fIinteger\fR
Spawn up to \fIinteger\fR workers to compile locales in parallel (defaults to the number of logical processors)
.TP
\fB\-q\fR, \fB\-\-quiet\fR
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 16:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 16:20 UTC (permalink / raw
To: gentoo-commits
commit: 680e2f7fff543192d04b97ed8a84c7dee821c52f
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 15:24:43 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 16:10:37 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=680e2f7f
locale-gen.8: eliminate blank lines
It is explained by groff_man_style(7) that man page source documents
should not contain blank lines.
Fixes: eca042ce3d28e05ddb0d5823ce3b8063ff0e6c5f
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 2a25ba0..e8e8df9 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -7,20 +7,19 @@ conveniently manage the set of locales that are made available to the GNU C
Library. It accomplishes this by acting as a user-friendly frontend for the
standard \fBlocaledef\fR(1) utility, which is used to compile locales and
integrate them into a single archive.
-
+.P
A default installation of Gentoo Linux shall provide an archive that contains
all supported locales, numbering 500 or more. However, it is typical for an
administrator to require only one or two of these. In that case, the
\fBlocale.gen\fR(5) configuration file may be populated with a list of the
required locales. By default, locale\-gen shall read this file and compile only
the locales that are specified, saving both time and space in the longer term.
-
+.P
If the configuration file is missing, empty, or consists only of comments,
locale\-gen shall act in one of two ways, depending on whether the
\fB\-\-config\fR option was specified. If specified then locale\-gen shall abort
with a suitable diagnostic message. Otherwise, locale\-gen shall act as if the
\fB\-\-all\fR option had been specified.
-
.SH "OPTIONS"
.TP
\fB\-A\fR, \fB\-\-all\fR
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 16:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 16:20 UTC (permalink / raw
To: gentoo-commits
commit: 15bc9376e3e540925a636e3c44d11e3355d07ca1
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 15:19:45 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 16:10:19 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=15bc9376
locale-gen.8: escape the hyphen character where appropriate
The <hyphen-minus> character should be escaped if to break at its
position would be considered undesirable, such as for --option or
command-name. Revise the locale-gen(8) manual accordingly.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index c6a4735..2a25ba0 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -1,6 +1,6 @@
.TH "locale-gen" "8" "Aug 2025" "Gentoo"
.SH "NAME"
-locale\-gen \- safely compile and install a glibc locale archive
+locale\-gen - safely compile and install a glibc locale archive
.SH "DESCRIPTION"
The locale\-gen utility provides a means by which a system administrator may
conveniently manage the set of locales that are made available to the GNU C
@@ -12,14 +12,14 @@ A default installation of Gentoo Linux shall provide an archive that contains
all supported locales, numbering 500 or more. However, it is typical for an
administrator to require only one or two of these. In that case, the
\fBlocale.gen\fR(5) configuration file may be populated with a list of the
-required locales. By default, locale-gen shall read this file and compile only
+required locales. By default, locale\-gen shall read this file and compile only
the locales that are specified, saving both time and space in the longer term.
If the configuration file is missing, empty, or consists only of comments,
-locale-gen shall act in one of two ways, depending on whether the
-\fB--config\fR option was specified. If specified then locale-gen shall abort
-with a suitable diagnostic message. Otherwise, locale-gen shall act as if the
-\fB--all\fR option had been specified.
+locale\-gen shall act in one of two ways, depending on whether the
+\fB\-\-config\fR option was specified. If specified then locale\-gen shall abort
+with a suitable diagnostic message. Otherwise, locale\-gen shall act as if the
+\fB\-\-all\fR option had been specified.
.SH "OPTIONS"
.TP
@@ -55,11 +55,11 @@ Prior versions are chiefly the work of Mike Frysinger <vapier@google.com>.
.SH "REPORTING BUGS"
Please report bugs via http://bugs.gentoo.org/
.SH "FILES"
-\fB/etc/locale.gen\fR \- specifies the locales to be compiled
+\fB/etc/locale.gen\fR - specifies the locales to be compiled
.br
-\fB/usr/share/i18n/SUPPORTED\fR \- a list of officially supported locales
+\fB/usr/share/i18n/SUPPORTED\fR - a list of officially supported locales
.br
-\fB/usr/lib/locale/locale-archive\fR \- contains the currently installed locales
+\fB/usr/lib/locale/locale\-archive\fR - contains the currently installed locales
.SH "SEE ALSO"
.BR locale (1),
.BR localedef (1),
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-07 16:20 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-07 16:20 UTC (permalink / raw
To: gentoo-commits
commit: ed0ced3effdd737b79ebda39accf5ff23a5f899a
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Aug 7 15:30:29 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Thu Aug 7 16:18:47 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=ed0ced3e
locale-gen.8: use the TP macro to structure the FILES section
Use the TP (tagged paragraph) and I (italic) macros to format the FILES
section in a way that seems idiomatic.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index e8e8df9..114d44f 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -54,11 +54,15 @@ Prior versions are chiefly the work of Mike Frysinger <vapier@google.com>.
.SH "REPORTING BUGS"
Please report bugs via http://bugs.gentoo.org/
.SH "FILES"
-\fB/etc/locale.gen\fR - specifies the locales to be compiled
-.br
-\fB/usr/share/i18n/SUPPORTED\fR - a list of officially supported locales
-.br
-\fB/usr/lib/locale/locale\-archive\fR - contains the currently installed locales
+.TP
+.I /etc/locale.gen
+Specifies the locales to be compiled.
+.TP
+.I /usr/share/i18n/SUPPORTED
+A list of officially supported locales.
+.TP
+.I /usr/lib/locale/locale\-archive
+Contains the currently installed locales.
.SH "SEE ALSO"
.BR locale (1),
.BR localedef (1),
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-06 17:02 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-06 17:02 UTC (permalink / raw
To: gentoo-commits
commit: acf17c1f417f4c6e14a79c24e234181fb22d8cfb
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 6 16:11:20 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 6 16:56:37 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=acf17c1f
Claim that glibc is absent where localedef(1) output cannot be parsed
Presently, the get_locale_dir() subroutine executes localedef(1) with
the --help option in order to capture the locale path. Should it be
unable to do so, it throws an exception that's intended for developers
rather than end-users. The experience can thus be an ugly one in the
case that locale-gen(8) is run on a foreign platform.
# locale-gen
localedef: illegal option -- -
Usage: localedef [options] localename
[options] are:
-D : BSD-style output
-b : big-endian output
-c : ignore warnings
-l : little-endian output
-v : verbose output
-U : ignore undefined symbols
-f charmap : use given charmap file
-u encoding : assume encoding
-w widths : use screen widths file
-i locsrc : source file for locale
-V version : version string for locale
Can't parse locale directory from localedef(1) output: at ./locale-gen line 130.
Address this minor issue in a twofold manner. Firstly, suppress the
standard error of localedef(1). Secondly, claim that the operating
system does not use glibc in either of the following cases.
a) localedef(1) exits with a status of 0 and its output cannot be parsed
b) localedef(1) or sh(1) otherwise exits normally, with any status
The new diagnostic is depicted beneath.
# locale-gen
locale-gen: Aborting because the OS does not appear to use GNU libc
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index c4887c4..6dc7ad3 100755
--- a/locale-gen
+++ b/locale-gen
@@ -123,11 +123,14 @@ umask 0022;
}
sub get_locale_dir () {
- my $stdout = qx{ localedef --help };
+ my $stdout = qx{ localedef --help 2>/dev/null };
if ($? == 0 && $stdout =~ m/\hlocale path\h*:\s+(\/[^:]+)/) {
return canonpath($1);
+ } elsif (($? & 0xFF) == 0) {
+ # The child terminated normally (in the sense of WIFEXITED).
+ die "$PROGRAM: Aborting because the OS does not appear to use GNU libc\n";
} else {
- die "Can't parse locale directory from localedef(1) output: $!";
+ throw_child_error('localedef');
}
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-06 7:44 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-06 7:44 UTC (permalink / raw
To: gentoo-commits
commit: 943ddb0c02896f2d507593971b04c24f52acb7d1
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 6 07:05:46 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 6 07:05:46 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=943ddb0c
Require either a null string or an absolute path for --prefix
The --prefix option is only intended for use by the sys-libs/glibc
ebuild, which is expected to pass either the value of ED or EROOT. For
the --prefix option-argument to specify something other than either a
null string or an absolute path would imply that something has gone
catastrophically wrong. Reject the option-argument in that case.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 2 ++
1 file changed, 2 insertions(+)
diff --git a/locale-gen b/locale-gen
index 8ee16e9..c4887c4 100755
--- a/locale-gen
+++ b/locale-gen
@@ -176,6 +176,8 @@ sub parse_opts ($known_prefix, @args) {
# Validate the options and option-arguments.
if ($opt{'all'} && exists $opt{'config'}) {
die "$PROGRAM: The --all and --config options are mutually exclusive\n";
+ } elsif (length $opt{'prefix'} && $opt{'prefix'} !~ m/^\//) {
+ die "$PROGRAM: The --prefix option must specify either a null string or an absolute path\n";
}
# Assign values for unspecified options that need them.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-06 6:48 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-06 6:48 UTC (permalink / raw
To: gentoo-commits
commit: a009d7c7ab382065555d60250752f11ef40c1c1c
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Wed Aug 6 06:34:38 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Wed Aug 6 06:46:10 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=a009d7c7
Improve the diagnostic where /usr/share/i18n/locales cannot be entered
Consider a scenario in which locale-gen(8) is unable to switch to the
directory containing the glibc locale definition files.
# locale-gen --prefix /var/empty
sh: 1: cd: can't cd to /var/empty/usr/share/i18n/locales
locale-gen: Failed to compose a list of valid locale names from '/var/e
pty/usr/share/i18n/locales'
In this case, the implementation of sh(1) is provided by dash. I find
its diagnostic message to be lacking because it does not explain why it
cannot switch to the requested directory. That is, it could have
reported the chdir(2) error.
Address this minor issue by having the Perl interpreter attempt to
switch to the directory before executing sh(1) and find(1) and throwing
a tailored exception if it cannot.
# locale-gen --prefix /var/empty
locale-gen: Can't chdir to '/var/empty/usr/share/i18n/locales': No such
file or directory
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index 25204ca..8ee16e9 100755
--- a/locale-gen
+++ b/locale-gen
@@ -268,13 +268,16 @@ sub read_config ($prefix, @paths) {
}
sub get_valid_locales ($prefix) {
- my $top = local $ENV{'TOP'} = catdir($prefix, '/usr/share/i18n/locales');
- my @paths = qx{ cd -- "\$TOP" && find . ! -path . -prune ! -path '*\n*' -type f -exec grep -lxF LC_IDENTIFICATION {} + };
- if ($? != 0 || ! @paths) {
+ my $top = catdir($prefix, '/usr/share/i18n/locales');
+ my $cmd = qq{ find . ! -path . -prune ! -path '*\n*' -type f -exec grep -lxF LC_IDENTIFICATION {} + };
+ if (! chdir $top) {
+ die "$PROGRAM: Can't chdir to '$top': $!\n";
+ } elsif (! (my @paths = readpipe $cmd) || $? != 0) {
die "$PROGRAM: Failed to compose a list of valid locale names from '$top'\n";
+ } else {
+ chomp @paths;
+ return map +( (splitpath($_))[-1] ), @paths;
}
- chomp @paths;
- return map +( (splitpath($_))[-1] ), @paths;
}
sub get_valid_charmaps ($prefix) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-05 23:00 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-05 23:00 UTC (permalink / raw
To: gentoo-commits
commit: 6f4bc807f37690bc4a2574d22a337eae575fdec0
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 5 22:53:21 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 5 22:59:09 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=6f4bc807
locale.gen: show only UTF-8 based locales as commented examples
Presently, the default locale.gen file contains only 14 (commented)
locale definitions. Of the 9 countries covered, 6 are lacking any
definitions that incorporate the UTF-8 character map. This makes no
sense. As of 2025, the overwhelming majority of users ought to be using
the UTF-8 character map, along with the Unicode Collation Algorithm. In
no way should Gentoo be encouraging new users not to do so, especially
given that some of them would be hard pressed to tell a locale apart
from a latrine.
Address this matter by replacing the aforementioned definitions with all
325 of the locales from the /usr/share/i18n/SUPPORTED file that specify
the UTF-8 character map (not counting C.UTF-8). Also, present them as a
columnated list, rendering it considerably more pleasant to read.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale.gen | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 325 insertions(+), 14 deletions(-)
diff --git a/locale.gen b/locale.gen
index 0786f17..ff0025a 100644
--- a/locale.gen
+++ b/locale.gen
@@ -20,17 +20,328 @@
# rebuilt for you. After updating this file, you can simply run `locale-gen`
# yourself instead of re-emerging glibc.
-#en_US ISO-8859-1
-#en_US.UTF-8 UTF-8
-#ja_JP.EUC-JP EUC-JP
-#ja_JP.UTF-8 UTF-8
-#ja_JP EUC-JP
-#en_HK ISO-8859-1
-#en_PH ISO-8859-1
-#de_DE ISO-8859-1
-#de_DE@euro ISO-8859-15
-#es_MX ISO-8859-1
-#fa_IR UTF-8
-#fr_FR ISO-8859-1
-#fr_FR@euro ISO-8859-15
-#it_IT ISO-8859-1
+# aa_DJ.UTF-8 UTF-8
+# aa_ER UTF-8
+# aa_ET UTF-8
+# af_ZA.UTF-8 UTF-8
+# agr_PE UTF-8
+# ak_GH UTF-8
+# am_ET UTF-8
+# an_ES.UTF-8 UTF-8
+# anp_IN UTF-8
+# ar_AE.UTF-8 UTF-8
+# ar_BH.UTF-8 UTF-8
+# ar_DZ.UTF-8 UTF-8
+# ar_EG.UTF-8 UTF-8
+# ar_IN UTF-8
+# ar_IQ.UTF-8 UTF-8
+# ar_JO.UTF-8 UTF-8
+# ar_KW.UTF-8 UTF-8
+# ar_LB.UTF-8 UTF-8
+# ar_LY.UTF-8 UTF-8
+# ar_MA.UTF-8 UTF-8
+# ar_OM.UTF-8 UTF-8
+# ar_QA.UTF-8 UTF-8
+# ar_SA.UTF-8 UTF-8
+# ar_SD.UTF-8 UTF-8
+# ar_SS UTF-8
+# ar_SY.UTF-8 UTF-8
+# ar_TN.UTF-8 UTF-8
+# ar_YE.UTF-8 UTF-8
+# ayc_PE UTF-8
+# az_AZ UTF-8
+# az_IR UTF-8
+# as_IN UTF-8
+# ast_ES.UTF-8 UTF-8
+# be_BY.UTF-8 UTF-8
+# be_BY@latin UTF-8
+# bem_ZM UTF-8
+# ber_DZ UTF-8
+# ber_MA UTF-8
+# bg_BG.UTF-8 UTF-8
+# bhb_IN.UTF-8 UTF-8
+# bho_IN UTF-8
+# bho_NP UTF-8
+# bi_VU UTF-8
+# bn_BD UTF-8
+# bn_IN UTF-8
+# bo_CN UTF-8
+# bo_IN UTF-8
+# br_FR.UTF-8 UTF-8
+# brx_IN UTF-8
+# bs_BA.UTF-8 UTF-8
+# byn_ER UTF-8
+# ca_AD.UTF-8 UTF-8
+# ca_ES.UTF-8 UTF-8
+# ca_ES@valencia UTF-8
+# ca_FR.UTF-8 UTF-8
+# ca_IT.UTF-8 UTF-8
+# ce_RU UTF-8
+# chr_US UTF-8
+# ckb_IQ UTF-8
+# cmn_TW UTF-8
+# crh_RU UTF-8
+# crh_UA UTF-8
+# cs_CZ.UTF-8 UTF-8
+# csb_PL UTF-8
+# cv_RU UTF-8
+# cy_GB.UTF-8 UTF-8
+# da_DK.UTF-8 UTF-8
+# de_AT.UTF-8 UTF-8
+# de_BE.UTF-8 UTF-8
+# de_CH.UTF-8 UTF-8
+# de_DE.UTF-8 UTF-8
+# de_IT.UTF-8 UTF-8
+# de_LI.UTF-8 UTF-8
+# de_LU.UTF-8 UTF-8
+# doi_IN UTF-8
+# dsb_DE UTF-8
+# dv_MV UTF-8
+# dz_BT UTF-8
+# el_GR.UTF-8 UTF-8
+# el_CY.UTF-8 UTF-8
+# en_AG UTF-8
+# en_AU.UTF-8 UTF-8
+# en_BW.UTF-8 UTF-8
+# en_CA.UTF-8 UTF-8
+# en_DK.UTF-8 UTF-8
+# en_GB.UTF-8 UTF-8
+# en_HK.UTF-8 UTF-8
+# en_IE.UTF-8 UTF-8
+# en_IL UTF-8
+# en_IN UTF-8
+# en_NG UTF-8
+# en_NZ.UTF-8 UTF-8
+# en_PH.UTF-8 UTF-8
+# en_SC.UTF-8 UTF-8
+# en_SG.UTF-8 UTF-8
+# en_US.UTF-8 UTF-8
+# en_ZA.UTF-8 UTF-8
+# en_ZM UTF-8
+# en_ZW.UTF-8 UTF-8
+# eo UTF-8
+# es_AR.UTF-8 UTF-8
+# es_BO.UTF-8 UTF-8
+# es_CL.UTF-8 UTF-8
+# es_CO.UTF-8 UTF-8
+# es_CR.UTF-8 UTF-8
+# es_CU UTF-8
+# es_DO.UTF-8 UTF-8
+# es_EC.UTF-8 UTF-8
+# es_ES.UTF-8 UTF-8
+# es_GT.UTF-8 UTF-8
+# es_HN.UTF-8 UTF-8
+# es_MX.UTF-8 UTF-8
+# es_NI.UTF-8 UTF-8
+# es_PA.UTF-8 UTF-8
+# es_PE.UTF-8 UTF-8
+# es_PR.UTF-8 UTF-8
+# es_PY.UTF-8 UTF-8
+# es_SV.UTF-8 UTF-8
+# es_US.UTF-8 UTF-8
+# es_UY.UTF-8 UTF-8
+# es_VE.UTF-8 UTF-8
+# et_EE.UTF-8 UTF-8
+# eu_ES.UTF-8 UTF-8
+# fa_IR UTF-8
+# ff_SN UTF-8
+# fi_FI.UTF-8 UTF-8
+# fil_PH UTF-8
+# fo_FO.UTF-8 UTF-8
+# fr_BE.UTF-8 UTF-8
+# fr_CA.UTF-8 UTF-8
+# fr_CH.UTF-8 UTF-8
+# fr_FR.UTF-8 UTF-8
+# fr_LU.UTF-8 UTF-8
+# fur_IT UTF-8
+# fy_NL UTF-8
+# fy_DE UTF-8
+# ga_IE.UTF-8 UTF-8
+# gbm_IN UTF-8
+# gd_GB.UTF-8 UTF-8
+# gez_ER UTF-8
+# gez_ER@abegede UTF-8
+# gez_ET UTF-8
+# gez_ET@abegede UTF-8
+# gl_ES.UTF-8 UTF-8
+# gu_IN UTF-8
+# gv_GB.UTF-8 UTF-8
+# ha_NG UTF-8
+# hak_TW UTF-8
+# he_IL.UTF-8 UTF-8
+# hi_IN UTF-8
+# hif_FJ UTF-8
+# hne_IN UTF-8
+# hr_HR.UTF-8 UTF-8
+# hsb_DE.UTF-8 UTF-8
+# ht_HT UTF-8
+# hu_HU.UTF-8 UTF-8
+# hy_AM UTF-8
+# ia_FR UTF-8
+# id_ID.UTF-8 UTF-8
+# ig_NG UTF-8
+# ik_CA UTF-8
+# is_IS.UTF-8 UTF-8
+# it_CH.UTF-8 UTF-8
+# it_IT.UTF-8 UTF-8
+# iu_CA UTF-8
+# ja_JP.UTF-8 UTF-8
+# ka_GE.UTF-8 UTF-8
+# kab_DZ UTF-8
+# kk_KZ.UTF-8 UTF-8
+# kl_GL.UTF-8 UTF-8
+# km_KH UTF-8
+# kn_IN UTF-8
+# ko_KR.UTF-8 UTF-8
+# kok_IN UTF-8
+# ks_IN UTF-8
+# ks_IN@devanagari UTF-8
+# ku_TR.UTF-8 UTF-8
+# kv_RU UTF-8
+# kw_GB.UTF-8 UTF-8
+# ky_KG UTF-8
+# lb_LU UTF-8
+# lg_UG.UTF-8 UTF-8
+# li_BE UTF-8
+# li_NL UTF-8
+# lij_IT UTF-8
+# ln_CD UTF-8
+# lo_LA UTF-8
+# lt_LT.UTF-8 UTF-8
+# ltg_LV.UTF-8 UTF-8
+# lv_LV.UTF-8 UTF-8
+# lzh_TW UTF-8
+# mag_IN UTF-8
+# mai_IN UTF-8
+# mai_NP UTF-8
+# mdf_RU UTF-8
+# mfe_MU UTF-8
+# mg_MG.UTF-8 UTF-8
+# mhr_RU UTF-8
+# mi_NZ.UTF-8 UTF-8
+# miq_NI UTF-8
+# mjw_IN UTF-8
+# mk_MK.UTF-8 UTF-8
+# ml_IN UTF-8
+# mn_MN UTF-8
+# mni_IN UTF-8
+# mnw_MM UTF-8
+# mr_IN UTF-8
+# ms_MY.UTF-8 UTF-8
+# mt_MT.UTF-8 UTF-8
+# my_MM UTF-8
+# nan_TW UTF-8
+# nan_TW@latin UTF-8
+# nb_NO.UTF-8 UTF-8
+# nds_DE UTF-8
+# nds_NL UTF-8
+# ne_NP UTF-8
+# nhn_MX UTF-8
+# niu_NU UTF-8
+# niu_NZ UTF-8
+# nl_AW UTF-8
+# nl_BE.UTF-8 UTF-8
+# nl_NL.UTF-8 UTF-8
+# nn_NO.UTF-8 UTF-8
+# nr_ZA UTF-8
+# nso_ZA UTF-8
+# oc_FR.UTF-8 UTF-8
+# om_ET UTF-8
+# om_KE.UTF-8 UTF-8
+# or_IN UTF-8
+# os_RU UTF-8
+# pa_IN UTF-8
+# pa_PK UTF-8
+# pap_AW UTF-8
+# pap_CW UTF-8
+# pl_PL.UTF-8 UTF-8
+# ps_AF UTF-8
+# pt_BR.UTF-8 UTF-8
+# pt_PT.UTF-8 UTF-8
+# quz_PE UTF-8
+# raj_IN UTF-8
+# rif_MA UTF-8
+# ro_RO.UTF-8 UTF-8
+# ru_RU.UTF-8 UTF-8
+# ru_UA.UTF-8 UTF-8
+# rw_RW UTF-8
+# sa_IN UTF-8
+# sah_RU UTF-8
+# sat_IN UTF-8
+# sc_IT UTF-8
+# scn_IT UTF-8
+# sd_IN UTF-8
+# sd_IN@devanagari UTF-8
+# se_NO UTF-8
+# sgs_LT UTF-8
+# shn_MM UTF-8
+# shs_CA UTF-8
+# si_LK UTF-8
+# sid_ET UTF-8
+# sk_SK.UTF-8 UTF-8
+# sl_SI.UTF-8 UTF-8
+# sm_WS UTF-8
+# so_DJ.UTF-8 UTF-8
+# so_ET UTF-8
+# so_KE.UTF-8 UTF-8
+# so_SO.UTF-8 UTF-8
+# sq_AL.UTF-8 UTF-8
+# sq_MK UTF-8
+# sr_ME UTF-8
+# sr_RS UTF-8
+# sr_RS@latin UTF-8
+# ss_ZA UTF-8
+# ssy_ER UTF-8
+# st_ZA.UTF-8 UTF-8
+# su_ID UTF-8
+# sv_FI.UTF-8 UTF-8
+# sv_SE.UTF-8 UTF-8
+# sw_KE UTF-8
+# sw_TZ UTF-8
+# syr UTF-8
+# szl_PL UTF-8
+# ta_IN UTF-8
+# ta_LK UTF-8
+# tcy_IN.UTF-8 UTF-8
+# te_IN UTF-8
+# tg_TJ.UTF-8 UTF-8
+# th_TH.UTF-8 UTF-8
+# the_NP UTF-8
+# ti_ER UTF-8
+# ti_ET UTF-8
+# tig_ER UTF-8
+# tk_TM UTF-8
+# tl_PH.UTF-8 UTF-8
+# tn_ZA UTF-8
+# to_TO UTF-8
+# tok UTF-8
+# tpi_PG UTF-8
+# tr_CY.UTF-8 UTF-8
+# tr_TR.UTF-8 UTF-8
+# ts_ZA UTF-8
+# tt_RU UTF-8
+# tt_RU@iqtelif UTF-8
+# ug_CN UTF-8
+# uk_UA.UTF-8 UTF-8
+# unm_US UTF-8
+# ur_IN UTF-8
+# ur_PK UTF-8
+# uz_UZ.UTF-8 UTF-8
+# uz_UZ@cyrillic UTF-8
+# ve_ZA UTF-8
+# vi_VN UTF-8
+# wa_BE.UTF-8 UTF-8
+# wae_CH UTF-8
+# wal_ET UTF-8
+# wo_SN UTF-8
+# xh_ZA.UTF-8 UTF-8
+# yi_US.UTF-8 UTF-8
+# yo_NG UTF-8
+# yue_HK UTF-8
+# yuw_PG UTF-8
+# zgh_MA UTF-8
+# zh_CN.UTF-8 UTF-8
+# zh_HK.UTF-8 UTF-8
+# zh_SG.UTF-8 UTF-8
+# zh_TW.UTF-8 UTF-8
+# zu_ZA.UTF-8 UTF-8
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-05 21:53 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-05 21:53 UTC (permalink / raw
To: gentoo-commits
commit: 9d6d44c0f3aa44ebee45f8c5bea794b3c693edd4
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 5 14:57:23 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 5 14:57:23 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=9d6d44c0
locale-gen.8: remove references to options that have been dropped
The --ask, --debug, --generate, --inplace-glibc, --list and --keep
options have been dropped. Jettison them from the locale-gen(8) manual.
Note that I got the manual section right this time; appending "(1)" has
become a difficult habit to shake.
Further, remove the paragraph claiming that options can be forwarded to
localedef(1), for that is no longer the case.
See-also: 1baa3626b0bfa269b8c195caddb4629195c89371
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index a194be7..88bb361 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -1,4 +1,4 @@
-.TH "locale-gen" "8" "Aug 2007" "Gentoo"
+.TH "locale-gen" "8" "Aug 2025" "Gentoo"
.SH "NAME"
locale\-gen \- generate locales on the fly
.SH "DESCRIPTION"
@@ -10,36 +10,22 @@ Normally all locales would be generated at build time, but this leads to waste
of disk and time as many users really just want a handful on their system.
.SH "OPTIONS"
.TP
-\fB\-a\fR, \fB\-\-ask\fR
-Ask before generating each locale
-.TP
\fB\-A\fR, \fB\-\-all\fR
Generate all possible locales
.TP
\fB\-c\fR, \fB\-\-config\fR \fI<config>\fR
Use specified \fIconfig\fR file rather than default /etc/locale.gen
.TP
-\fB\-d\fR, \fB\-\-destdir\fR \fI<dir>\fR
+\fB\-d\fR, \fB\-\-prefix\fR \fI<dir>\fR
Look for locale definitions and store generated locale data in the specified
\fIdirectory\fR
.TP
-\fB\-G\fR, \fB\-\-generate\fR \fI<locale>\fR
-Only generate the specified \fIlocale\fR (implies \-\-keep \-\-update);
-format of \fIlocale\fR matches a single line in the \fBlocale.gen\fR(5)
-config file
-.TP
\fB\-h\fR, \fB\-\-help\fR
Show the help output (imagine that)
.TP
\fB\-j\fR, \fB\-\-jobs\fR \fI<num>\fR
Generate the specified \fInumber\fR of locales in parallel
.TP
-\fB\-k\fR, \fB\-\-keep\fR
-Keep all existing locales even if they are not in the config file
-.TP
-\fB\-l\fR, \fB\-\-list\fR
-List all the locales that we think should exist according to the config
-.TP
\fB\-q\fR, \fB\-\-quiet\fR
Only spit out errors
.TP
@@ -48,11 +34,6 @@ Only generate locales that do not already exist (normally existing locales are r
.TP
\fB\-V\fR, \fB\-\-version\fR
Report the program version
-.TP
-\fB\-\-\fR
-To pass custom options directly to the \fBlocaledef\fR utility, end the
-\fBlocale\-gen\fR option list with \-\- and then everything after that will be
-passed on through unmolested (the options \-c are passed by default)
.SH "AUTHORS"
.fi
Mike Frysinger <vapier@gentoo.org>
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-05 21:53 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-05 21:53 UTC (permalink / raw
To: gentoo-commits
commit: eca042ce3d28e05ddb0d5823ce3b8063ff0e6c5f
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 5 21:43:19 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 5 21:49:29 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=eca042ce
locale-gen.8: rewrite in the style that a technical writer might
This commit improves the locale-gen(8) manual by exacting a style of
English that is characteristic of technical documentation, by which I
mean documentation that has been written by a technical writer. The
DESCRIPTION section has undergone the most notable changes, better
describing the purpose and behaviour of the program. The OPTIONS section
has also been revised, and the FILES section now contains entries for
the "SUPPORTED" and "locale-archive" files.
Bug: https://bugs.gentoo.org/945269
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 52 ++++++++++++++++++++++++++++++++++------------------
1 file changed, 34 insertions(+), 18 deletions(-)
diff --git a/locale-gen.8 b/locale-gen.8
index d7aadaa..c6a4735 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -1,39 +1,51 @@
.TH "locale-gen" "8" "Aug 2025" "Gentoo"
.SH "NAME"
-locale\-gen \- generate locales on the fly
+locale\-gen \- safely compile and install a glibc locale archive
.SH "DESCRIPTION"
-The locale\-gen utility is used to manage locales on your system. Often times
-it merely generates a user configurable list of locales, but it can be used to
-generate a few locales on the fly as needed.
+The locale\-gen utility provides a means by which a system administrator may
+conveniently manage the set of locales that are made available to the GNU C
+Library. It accomplishes this by acting as a user-friendly frontend for the
+standard \fBlocaledef\fR(1) utility, which is used to compile locales and
+integrate them into a single archive.
+
+A default installation of Gentoo Linux shall provide an archive that contains
+all supported locales, numbering 500 or more. However, it is typical for an
+administrator to require only one or two of these. In that case, the
+\fBlocale.gen\fR(5) configuration file may be populated with a list of the
+required locales. By default, locale-gen shall read this file and compile only
+the locales that are specified, saving both time and space in the longer term.
+
+If the configuration file is missing, empty, or consists only of comments,
+locale-gen shall act in one of two ways, depending on whether the
+\fB--config\fR option was specified. If specified then locale-gen shall abort
+with a suitable diagnostic message. Otherwise, locale-gen shall act as if the
+\fB--all\fR option had been specified.
-Normally all locales would be generated at build time, but this leads to waste
-of disk and time as many users really just want a handful on their system.
.SH "OPTIONS"
.TP
\fB\-A\fR, \fB\-\-all\fR
-Generate all possible locales
+Compile all locales that are officially supported by glibc
.TP
\fB\-c\fR, \fB\-\-config\fR \fI<config>\fR
-Use specified \fIconfig\fR file rather than default /etc/locale.gen
+Read the given \fIconfig\fR file (defaults to /etc/locale.gen)
.TP
-\fB\-d\fR, \fB\-\-prefix\fR \fI<dir>\fR
-Look for locale definitions and store generated locale data in the specified
-\fIdirectory\fR
+\fB\-d\fR, \fB\-\-prefix\fR \fI<directory>\fR
+Treat most filesystem paths as being relative to the given \fIdirectory\fR (defaults to / if not a Gentoo Prefix system)
.TP
\fB\-h\fR, \fB\-\-help\fR
-Show the help output (imagine that)
+Write out a synopsis and summary of the supported options then exit
.TP
-\fB\-j\fR, \fB\-\-jobs\fR \fI<num>\fR
-Generate the specified \fInumber\fR of locales in parallel
+\fB\-j\fR, \fB\-\-jobs\fR \fI<integer>\fR
+Spawn up to \fIinteger\fR workers to compile locales in parallel (defaults to the number of logical processors)
.TP
\fB\-q\fR, \fB\-\-quiet\fR
-Only spit out errors
+Suppress the writing of informational messages to standard output
.TP
\fB\-u\fR, \fB\-\-update\fR
-Only generate locales that do not already exist (normally existing locales are regenerated)
+Suppress the compilation of locales that are already installed (not recommended)
.TP
\fB\-V\fR, \fB\-\-version\fR
-Report the program version
+Write out some details regarding the program then exit
.SH "AUTHORS"
.fi
Version 3.0 is the work of Kerin Millar <kfm@plushkava.net>.
@@ -43,7 +55,11 @@ Prior versions are chiefly the work of Mike Frysinger <vapier@google.com>.
.SH "REPORTING BUGS"
Please report bugs via http://bugs.gentoo.org/
.SH "FILES"
-\fB/etc/locale.gen\fR \- locale list
+\fB/etc/locale.gen\fR \- specifies the locales to be compiled
+.br
+\fB/usr/share/i18n/SUPPORTED\fR \- a list of officially supported locales
+.br
+\fB/usr/lib/locale/locale-archive\fR \- contains the currently installed locales
.SH "SEE ALSO"
.BR locale (1),
.BR localedef (1),
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-05 21:53 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-05 21:53 UTC (permalink / raw
To: gentoo-commits
commit: 7e6183396d0af514fed8a5c3f7dd51cb85d85a51
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 5 14:59:10 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 5 14:59:10 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=7e618339
locale-gen.8: update the AUTHORS section
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen.8 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/locale-gen.8 b/locale-gen.8
index 88bb361..d7aadaa 100644
--- a/locale-gen.8
+++ b/locale-gen.8
@@ -36,7 +36,9 @@ Only generate locales that do not already exist (normally existing locales are r
Report the program version
.SH "AUTHORS"
.fi
-Mike Frysinger <vapier@gentoo.org>
+Version 3.0 is the work of Kerin Millar <kfm@plushkava.net>.
+.br
+Prior versions are chiefly the work of Mike Frysinger <vapier@google.com>.
.nf
.SH "REPORTING BUGS"
Please report bugs via http://bugs.gentoo.org/
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-05 10:55 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-05 10:55 UTC (permalink / raw
To: gentoo-commits
commit: 321ade92abcb242fb4ef131c121acd06492723dd
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 5 10:49:51 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 5 10:49:51 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=321ade92
Attempt to create the archive directory, if missing
Have the check_archive_dir() subroutine quietly attempt to create the
directory that is supposed to contain the locale archive, provided that
it is missing. Versions prior to 3.0 would also attempt to create the
directory and this seems to me to be a reasonable thing to do, for it
relieves the sys-libs/glibc ebuild of the burden of guaranteeing that
the directory exists for all its modes of operation.
See-also: 02b2ac6ee591e4ee65eb131fa8038dc473678527
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index 5e2c2c9..25204ca 100755
--- a/locale-gen
+++ b/locale-gen
@@ -39,6 +39,9 @@ if (setlocale(LC_ALL) eq 'C') {
# CDPATH also, for it is nothing but a liability in a non-interactive context.
delete @ENV{'BASH_ENV', 'CDPATH'};
+# Protect against the inheritance of an unduly restrictive umask.
+umask 0022;
+
{
# Determine the locale directory, as reported by localedef(1).
my $locale_dir = get_locale_dir();
@@ -342,7 +345,10 @@ sub parse_entry ($locale, $charmap) {
}
sub check_archive_dir ($prefix, $locale_dir) {
- my $archive_dir = catdir($prefix, $locale_dir);
+ my $archive_dir = local $ENV{'DIR'} = catdir($prefix, $locale_dir);
+
+ # Quietly attempt to create the directory if it does not already exist.
+ system q{ mkdir -p -- "$DIR" 2>/dev/null };
# Check whether the directory exists and can be modified by the EUID.
if (! utime undef, undef, $archive_dir) {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-05 10:32 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-05 10:32 UTC (permalink / raw
To: gentoo-commits
commit: 21ae7e5f4825f082191a5adcabccb7c642b81c86
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 5 10:30:19 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 5 10:31:58 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=21ae7e5f
Drop the is_eq_file subroutine
The is_eq_file() subroutine is no longer used.
See-also: 4177dab14cfee01f5b9b29f3cbbb38635bba41c5
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 6 ------
1 file changed, 6 deletions(-)
diff --git a/locale-gen b/locale-gen
index 45026ab..5e2c2c9 100755
--- a/locale-gen
+++ b/locale-gen
@@ -520,12 +520,6 @@ sub get_nprocs () {
return $nproc;
}
-sub is_eq_file ($path1, $path2) {
- # The -ef primary is standard as of POSIX.1-2024.
- local @ENV{'PATH1', 'PATH2'} = ($path1, $path2);
- return 0 == system q{ test "$PATH1" -ef "$PATH2" };
-}
-
sub plural ($int) {
return $int == 1 ? '' : 's';
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-05 10:29 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-05 10:29 UTC (permalink / raw
To: gentoo-commits
commit: 4177dab14cfee01f5b9b29f3cbbb38635bba41c5
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Aug 5 00:45:31 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Aug 5 10:24:46 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=4177dab1
Render compatible with the compile-locales USE flag of sys-libs/glibc
Version 3.0 of locale-gen(1) fails in the case that it is invoked by the
sys-libs/glibc ebuild, provided that the "compile-locales" USE flag is
in effect. It was developed under the understanding that the flag might
eventually be removed and unexpectedly committed to the repo before any
meaningful testing had been performed with the flag enabled.
The particulars of the two modes of failure are described herewith.
Firstly, the ebuild executes locale-gen(1) with "${ED}" as a prefix.
locale-gen --prefix /var/tmp/portage/sys-libs/glibc-2.41-r4/image
Secondly, the program declares the $prefix, $locale_dir and
$gentoo_prefix variables. Given the above value of the --prefix option,
the values of these variables shall be as follows.
$prefix = "var/tmp/portage/sys-libs/glibc-2.41-r4/image"
$locale_dir = "/usr/lib/locale"
$gentoo_prefix = ""
Thirdly, having compiled the requested locales, the program calls the
generate_archive() subroutine, passing the values of the $prefix and
$locale_dir variables (but not the $gentoo_prefix variable).
Fourthly, the generate_archive() subroutine declares the $output_dir
variable.
# Assigns "./var/tmp/portage/sys-libs/glibc-2.41-r4/image/usr/lib/locale"
my $output_dir = catdir('.', $prefix, $locale_dir)
Fifthly, the generate_archive subroutine executes mkdir(1), so as to
create the directory specified by $output_dir.
mkdir -p ./var/tmp/portage/sys-libs/glibc-2.41-r4/image/usr/lib/locale
Sixthly, the localedef(1) utility is executed with "." as its first
argument. Internally, it joins "." to "/usr/lib/locale" and attempts to
write a new archive there. This is the point at which a failure occurs,
for the "./usr/lib/locale" directory doesn't exist. In turn, that is
because the wrong value was assigned to the $output_dir variable.
Address this issue by also passing the value of the $gentoo_prefix
variable to the generate_archive() subroutine, and using that to form
the value of $output_dir, like so.
# Correctly assigns "./usr/lib/locale"
my $output_dir = catdir('.', $gentoo_prefix, $locale_dir)
This works as intended in Gentoo Prefix environments. Imagine that such
an environment is situated at "/home/gentoo/gentoo". The values of the
$prefix, $locale_dir and $gentoo_prefix variables shall be as follows.
$prefix = "/home/gentoo/gentoo/var/tmp/portage/sys-libs/glibc-2.41-r4/image/home/gentoo/gentoo"
$locale_dir = "/usr/lib/locale"
$gentoo_prefix = "/home/gentoo/gentoo"
Consequently, $output_dir shall be formed in the following way.
# Correctly assigns "./home/gentoo/gentoo/usr/lib/locale"
my $output_dir = catdir('.', $gentoo_prefix, $locale_dir)
Such is correct because the location of the Gentoo Prefix environment is
integrated into the localedef(1) binary. That is, one cannot simply
specify the desired output directory to localedef(1) in full.
Additionally, the parse_opts() subroutine checks whether the value of
the --prefix option is equal to the path of the automatically detected
Gentoo Prefix, if any. This causes a failure in its own right since the
value of $prefix cannot possibly be equal to $gentoo_prefix in the case
that the "compile-locales" flag is in effect. Jettison this check.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index 7df6be1..45026ab 100755
--- a/locale-gen
+++ b/locale-gen
@@ -113,7 +113,7 @@ delete @ENV{'BASH_ENV', 'CDPATH'};
generate_locales($opt{'jobs'}, @locales);
# Integrate the newly compiled locales into the system's locale archive.
- generate_archive($prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
+ generate_archive($prefix, $gentoo_prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
my $total = scalar @locales;
printf "Successfully installed %d locale%s.\n", $total, plural($total);
@@ -173,8 +173,6 @@ sub parse_opts ($known_prefix, @args) {
# Validate the options and option-arguments.
if ($opt{'all'} && exists $opt{'config'}) {
die "$PROGRAM: The --all and --config options are mutually exclusive\n";
- } elsif (exists $opt{'prefix'} && length $known_prefix && ! is_eq_file($known_prefix, $opt{'prefix'})) {
- die "$PROGRAM: The --prefix option specifies a path contrary to a detected Gentoo Prefix\n";
}
# Assign values for unspecified options that need them.
@@ -429,9 +427,9 @@ sub compile_locale ($locale, $charmap, $canonical) {
run_localedef(undef, @args);
}
-sub generate_archive ($prefix, $locale_dir, $do_update, @canonicals) {
+sub generate_archive ($prefix, $gentoo_prefix, $locale_dir, $do_update, @canonicals) {
# Create the temporary subdir that will contain the new locale archive.
- my $output_dir = catdir('.', $prefix, $locale_dir);
+ my $output_dir = catdir('.', $gentoo_prefix, $locale_dir);
run('mkdir', '-p', '--', $output_dir);
# Determine the eventual destination path of the archive.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-05 10:29 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-05 10:29 UTC (permalink / raw
To: gentoo-commits
commit: 02b2ac6ee591e4ee65eb131fa8038dc473678527
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 4 23:10:54 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 4 23:15:09 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=02b2ac6e
Only check the prospective archive dir once there is work to be done
The locale-gen(1) utility combines the values of the 'prefix' and
'locale_dir' variables to form the directory that is expected to contain
the locale archive, then checks whether said directory exists and can be
modified by the effective UID. Presently, this check is performed
immediately after the command line options are validated.
Instead, perform the check at the point that locale generation is about
to commence. Further, move the code responsible for performing the check
into a new subroutine by the name of check_archive_dir.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/locale-gen b/locale-gen
index 18e4fa6..7df6be1 100755
--- a/locale-gen
+++ b/locale-gen
@@ -53,12 +53,6 @@ delete @ENV{'BASH_ENV', 'CDPATH'};
my %opt = parse_opts($gentoo_prefix, @ARGV);
my $prefix = $opt{'prefix'} // $gentoo_prefix;
- # A proxy check is justified because compilation may take a long time.
- my $archive_dir = catdir($prefix, $locale_dir);
- if (! utime undef, undef, $archive_dir) {
- die "$PROGRAM: Aborting because UID $> can't modify '$archive_dir': $!\n";
- }
-
# Honour the --quiet option.
if ($opt{'quiet'} && ! open *STDOUT, '>/dev/null') {
die "Can't direct STDOUT to /dev/null: $!";
@@ -109,6 +103,9 @@ delete @ENV{'BASH_ENV', 'CDPATH'};
exit 0;
}
+ # A proxy check is justified because compilation may take a long time.
+ check_archive_dir($prefix, $locale_dir);
+
# Create a temporary directory and switch to it.
enter_tempdir($prefix);
@@ -346,6 +343,15 @@ sub parse_entry ($locale, $charmap) {
return $locale, $charmap, $canonical;
}
+sub check_archive_dir ($prefix, $locale_dir) {
+ my $archive_dir = catdir($prefix, $locale_dir);
+
+ # Check whether the directory exists and can be modified by the EUID.
+ if (! utime undef, undef, $archive_dir) {
+ die "$PROGRAM: Aborting because UID $> can't modify '$archive_dir': $!\n";
+ }
+}
+
sub enter_tempdir ($prefix) {
# Given that /tmp might be a tmpfs, prefer /var/tmp so as to avoid
# undue memory pressure.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-04 16:02 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-04 16:02 UTC (permalink / raw
To: gentoo-commits
commit: 40b5fb9e12bcb6b5fe1fa9538ebaa62ac7a0bf2c
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 4 15:53:52 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 4 15:56:27 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=40b5fb9e
Speed up the trim_line sub by approximately 25%
As regards the trim_line subroutine, it is faster to perform two
destructive substitutions in succession. Have it do so.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index b74d8d9..18e4fa6 100755
--- a/locale-gen
+++ b/locale-gen
@@ -561,7 +561,9 @@ sub throw_child_error ($cmd, $status = $?) {
}
sub trim_line ($line) {
- return $line =~ s/^\h+|\h+$//gr;
+ $line =~ s/^\h+//;
+ $line =~ s/\h+$//;
+ return $line;
}
END {
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-04 12:13 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-04 12:13 UTC (permalink / raw
To: gentoo-commits
commit: 5a08042d08eed2fa576f92388be97209e30bf8cf
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 4 12:12:34 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 4 12:12:34 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=5a08042d
Rewrap a comment in the parse_config sub
The comment in question is now constrained to 80 columns, given a tab
width of 8.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 7a6a0a1..b74d8d9 100755
--- a/locale-gen
+++ b/locale-gen
@@ -299,8 +299,8 @@ sub parse_config ($fh, $path, $locale_by, $charmap_by) {
my @locales;
while (my $line = readline $fh) {
- # Skip comments and blank lines. Note that \h will match only " " and
- # "\t", since the input stream is not being subjected to any decoding.
+ # Skip comments and blank lines. Note that \h will match only
+ # " " and "\t", since the input stream is not being decoded.
next if $line =~ m/^\h*($|#)/;
# Expect for two fields, separated by horizontal whitespace.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-04 12:13 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-04 12:13 UTC (permalink / raw
To: gentoo-commits
commit: 678899ba99b6cb69a0495699bf2026cb0a211416
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 4 12:05:39 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 4 12:05:39 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=678899ba
Refrain from passing $prefix to the generate_locales sub
Presently, the generate_locales subroutine is given the value of $prefix
as a parameter but makes no use of it. Refrain from specifying it as a
parameter.
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index b7b37d4..7a6a0a1 100755
--- a/locale-gen
+++ b/locale-gen
@@ -113,7 +113,7 @@ delete @ENV{'BASH_ENV', 'CDPATH'};
enter_tempdir($prefix);
# Compile the selected locales.
- generate_locales($prefix, $opt{'jobs'}, @locales);
+ generate_locales($opt{'jobs'}, @locales);
# Integrate the newly compiled locales into the system's locale archive.
generate_archive($prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
@@ -359,7 +359,7 @@ sub enter_tempdir ($prefix) {
}
}
-sub generate_locales ($prefix, $workers, @locales) {
+sub generate_locales ($workers, @locales) {
# Trap SIGINT and SIGTERM so that they may be handled gracefully.
my $handler = sub ($signal) { $DEFERRED_SIGNAL ||= $signal };
local @SIG{'INT', 'TERM'} = ($handler, $handler);
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-04 11:56 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-04 11:56 UTC (permalink / raw
To: gentoo-commits
commit: 95bc4448aeb117b81687dc854e66e3dd6ed98673
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Mon Aug 4 11:56:04 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 4 11:56:04 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=95bc4448
Remove a stray leading tab from an otherwise empty line
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 c2e622a..b7b37d4 100755
--- a/locale-gen
+++ b/locale-gen
@@ -422,7 +422,7 @@ sub compile_locale ($locale, $charmap, $canonical) {
my @args = ('--no-archive', '-i', $locale, '-f', $charmap, '--', $output_dir);
run_localedef(undef, @args);
}
-
+
sub generate_archive ($prefix, $locale_dir, $do_update, @canonicals) {
# Create the temporary subdir that will contain the new locale archive.
my $output_dir = catdir('.', $prefix, $locale_dir);
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-04 11:25 Kerin Millar
0 siblings, 0 replies; 148+ messages in thread
From: Kerin Millar @ 2025-08-04 11:25 UTC (permalink / raw
To: gentoo-commits
commit: 1baa3626b0bfa269b8c195caddb4629195c89371
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Aug 3 18:38:11 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Mon Aug 4 11:23:53 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=1baa3626
Initial commit of locale-gen 3.0, rewritten in Perl
Somewhere around June of 2024, I became aware of a minor issue
concerning how the locale-gen(1) utility employs gentoo-functions.
Initially, my plan was to directly address the issue and apply some
much-needed improvements. However, it became clear to me that the
utility suffered from a surprising number of issues pertaining to
reliability and safety. Further, notwithstanding my experience in
reading and writing in bash, I found the code unpleasant to read and
work with. Hence, the decision was made to reimplement the utility.
As such, this commit introduces locale-gen version 3.0, which is a
complete rewrite of the prior script in Perl. It aims to operate as
safely and correctly as is practically possible. It does not aim to be
fully backwards-compatible, though its interface is largely similar. In
order to fully understand how it improves upon the prior implementation,
one might consider some of the defects of the latter:-
- Where given invalid inputs, it will install an archive that instantly
renders all previously available locales unavailable, leaving only the
C and POSIX locales available.
- Where the locale.gen configuration file is empty, it will refrain from
generating an archive, sometimes causing issues in the wake of a glibc
upgrade (bug 945269).
- Where there is no locale.gen configuration file, it will refrain from
generating an archive. It is unreasonable to require that it exist.
- It places undue faith in the exit status of the GNU localedef(1)
utility. In particular, localedef(1) does not necessarily yield a
meaningful exit status in the case that the --add-to-archive option is
specified. In turn, that means that errors can go unchecked, yet the
old archive - if any - will still end up being replaced.
- Its method of assessing which locales are already installed is
incorrect. In the case that all 500 supported locales of glibc 2.41
are installed, it will be under the impression that it must rebuild
340 locales, if given both the -A and -u options.
- It does not react well to being interrupted. As a case in point, run
"locale-gen -A" then interrupt it with ^C. Since it does not wait for
its children, it may continue spewing output for some time thereafter.
It will also replace the old archive - if any - with a partially
completed one, rendering previously available locales unavailable.
- It requires a post-install modification in order to be able to
correctly handle Gentoo Prefix environments.
There is more, but I would trust that the reader has gotten the point.
The new implementation of the utility addresses each and every one of
the aforementioned issues, and more besides. Below is a list of its most
notable changes, relative to the prior release.
- If the locale.gen configuration file is blank or does not exist, an
archive shall be generated that incorporates all supported locales.
- If the configuration file exists and cannot be opened, the utility
shall abort with a diagnostic message that explains why.
- The available locales and character maps are determined before
attempting to compile any locales, and before attempting to generate
the archive. If any of the specified locales be invalid, the utility
shall abort with a diagnostic message that explains why, referring the
user to the line containing the invalid data.
- During the locale compilation phase, the main process catches both the
INT and TERM signals and responds by reaping any remaining child
processes, displaying a useful diagnostic message, then terminating
itself with the signal that was caught.
- During the locale compilation phase, should a localedef(1) subprocess
exit unsuccessfully or die to a signal, the main process responds by
reaping any remaining child processes, displaying a useful diagnostic
message, then exiting with a non-zero status.
- During the archive generation phase, it is assumed that localedef(1)
has failed if it prints anything whatsoever to STDERR. Empirical
testing has shown that its exit status cannot be relied upon in the
case that the --add-to-archive option is specified.
- During the archive generation phase, localedef(1) is made to generate
its archive in a temporary directory. Only if it succeeds shall any
existing archive be replaced, with locale-gen(1) now assuming that
responsibility. The existing archive is guaranteed to be replaced
atomically or not at all.
- During the critical sections of the archive generation phase, both the
INT and TERM signals are blocked.
- The utility shall no longer attempt to forcibly destroy all that is
contained by the /usr/lib/locale directory. Depending on the options
given, the old version would do precisely that. Further, it would do
so even before having attempted to compile any locales.
- The --ask, --debug, --generate, --inplace-glibc, --list and --keep
options were deemed insufficiently useful and have been removed. Note
that the behaviour of the --generate option can be achieved like so:
# echo 'en_US.UTF-8 UTF-8' | locale-gen --config -
- The --destdir option has been removed. The --prefix option serves as
its replacement and behaves similarly. As of the time of writing, the
present round of glibc ebuilds demonstrate how much simpler it can be
to invoke the utility.
- The utility no longer forwards operands to localedef(1).
- Support for "no-locale-archive" in locale.gen has been dropped. Locale
archives shall always be generated.
- Gentoo Prefix environments are now detected automatically, with no
code patching being required. Otherwise, it is less beholden to the
particulars of the Gentoo Linux distribution.
Bug: https://bugs.gentoo.org/940103
Bug: https://bugs.gentoo.org/945269
Bug: https://bugs.gentoo.org/946289
Link: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e133de5ee597a
Link: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=031ac62b1e984
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
locale-gen | 984 ++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 557 insertions(+), 427 deletions(-)
diff --git a/locale-gen b/locale-gen
index d0e109e..c2e622a 100755
--- a/locale-gen
+++ b/locale-gen
@@ -1,451 +1,581 @@
-#!/bin/bash
+#!/usr/bin/perl
+# locale-gen
#
-# Based upon Debian's locale-gen, fetched from glibc_2.3.6-7.diff.gz, but completely rewritten.
-#
+# Generates a glibc locale archive from templates, potentially limiting itself
+# to a set of locales defined by the admin, typically within /etc/locale.gen.
+
+use v5.36;
+
+use Errno qw(ENOENT);
+use Fcntl qw(SEEK_SET);
+use File::Spec::Functions qw(canonpath catfile catdir splitpath);
+use File::Temp qw(tempdir);
+use Getopt::Long ();
+use JSON::PP ();
+use POSIX qw(LC_ALL setlocale);
-# NB: Bash-4.0+ required. We use += and ${var,,} features.
+# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
+use experimental qw(try);
-unset POSIXLY_CORRECT IFS
-umask 0022
+# Determine the basename of the presently compiling script.
+my $PROGRAM;
+BEGIN { $PROGRAM = (splitpath(__FILE__))[-1]; }
-argv0=${0##*/}
+my $VERSION = '3.0';
-EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
- EPREFIX=""
-fi
+my $DEFERRED_SIGNAL = '';
+my $PID = $$;
+my $TEMPDIR;
-FUNCTIONS_SH="/lib/gentoo/functions.sh"
-source "${EPREFIX}"${FUNCTIONS_SH} || {
- echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
- exit 1
+# For the C locale to be in effect can be a consequence of the user's chosen
+# locale not yet being available. That being the case, unset all environment
+# variables pertaining to locale handling for the benefit of any subprocesses.
+if (setlocale(LC_ALL) eq 'C') {
+ delete @ENV{ grep +( m/^(LANG\z|LC_)/ ), keys %ENV };
}
-COMPILED_LOCALES=""
+# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it. Unset
+# CDPATH also, for it is nothing but a liability in a non-interactive context.
+delete @ENV{'BASH_ENV', 'CDPATH'};
+
+{
+ # Determine the locale directory, as reported by localedef(1).
+ my $locale_dir = get_locale_dir();
+
+ # Infer the path of a Gentoo Prefix environment, if any.
+ my $gentoo_prefix = detect_gentoo_prefix($locale_dir);
+ if (length $gentoo_prefix) {
+ $locale_dir =~ s/^\Q$gentoo_prefix//;
+ }
+
+ # Collect any supported options and option-arguments.
+ my %opt = parse_opts($gentoo_prefix, @ARGV);
+ my $prefix = $opt{'prefix'} // $gentoo_prefix;
+
+ # A proxy check is justified because compilation may take a long time.
+ my $archive_dir = catdir($prefix, $locale_dir);
+ if (! utime undef, undef, $archive_dir) {
+ die "$PROGRAM: Aborting because UID $> can't modify '$archive_dir': $!\n";
+ }
+
+ # Honour the --quiet option.
+ if ($opt{'quiet'} && ! open *STDOUT, '>/dev/null') {
+ die "Can't direct STDOUT to /dev/null: $!";
+ }
+
+ # Ensure that the C.UTF-8 locale is made available.
+ my @locales = ([ 'C', 'UTF-8', 'C.UTF-8' ]);
+
+ # Compose a list of up to two configuration files to be read.
+ my @config_files;
+ if (exists $opt{'config'}) {
+ push @config_files, $opt{'config'};
+ } else {
+ push @config_files, (
+ catfile($prefix, '/etc', 'locale.gen'),
+ catfile($prefix, '/usr/share/i18n', 'SUPPORTED')
+ );
+ }
+
+ # Collect the locales that are being requested for installation.
+ push @locales, read_config($prefix, @config_files);
+
+ # Compose a dictionary of installed locales for the --update option.
+ my %installed_by;
+ if ($opt{'update'}) {
+ # If localedef(1) originates from a Gentoo Prefix environment,
+ # the prefix will already have been hard-coded by the utility.
+ my $explicit_prefix = length $gentoo_prefix ? undef : $prefix;
+ %installed_by = map +( $_ => 1 ), list_locales($explicit_prefix);
+ }
+
+ # Filter out locales that are duplicates or that are already installed.
+ my %requested_by;
+ my $i = 0;
+ while ($i <= $#locales) {
+ my $canonical = $locales[$i][2];
+ my $normal = normalize($canonical);
+ if ($requested_by{$normal}++ || $installed_by{$normal}) {
+ splice @locales, $i, 1;
+ } else {
+ ++$i;
+ }
+ }
+
+ # If a non-actionable update was requested, proceed no further.
+ if (! @locales) {
+ print "All of the requested locales are presently installed.\n";
+ exit 0;
+ }
+
+ # Create a temporary directory and switch to it.
+ enter_tempdir($prefix);
+
+ # Compile the selected locales.
+ generate_locales($prefix, $opt{'jobs'}, @locales);
+
+ # Integrate the newly compiled locales into the system's locale archive.
+ generate_archive($prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
+
+ my $total = scalar @locales;
+ printf "Successfully installed %d locale%s.\n", $total, plural($total);
+}
-show_usage() {
- cat <<-EOF
- Usage: ${HILITE}${argv0}${NORMAL} ${GOOD}[options]${NORMAL} -- ${GOOD}[localedef options]${NORMAL}
+sub get_locale_dir () {
+ my $stdout = qx{ localedef --help };
+ if ($? == 0 && $stdout =~ m/\hlocale path\h*:\s+(\/[^:]+)/) {
+ return canonpath($1);
+ } else {
+ die "Can't parse locale directory from localedef(1) output: $!";
+ }
+}
- Generate locales based upon the config file /etc/locale.gen.
+sub detect_gentoo_prefix ($path) {
+ if ($path !~ s/\/usr\/lib\/locale\z//) {
+ die "Can't handle unexpected locale directory of '$path'";
+ } elsif (length $path && -e "$path/etc/gentoo-release") {
+ return $path;
+ } else {
+ return '';
+ }
+}
- ${HILITE}Options:${NORMAL}
- ${GOOD}-k, --keep${NORMAL} Don't nuke existing locales
- ${GOOD}-d, --destdir <dir>${NORMAL} Use locale data in specified DESTDIR tree
- ${GOOD}-c, --config <config>${NORMAL} Use specified config instead of default locale.gen
- ${GOOD}-l, --list${NORMAL} List all the locales to be generated
- ${GOOD}-a, --ask${NORMAL} Ask before generating each locale
- ${GOOD}-A, --all${NORMAL} Pretend the locale list contains all locales
- ${GOOD}-u, --update${NORMAL} Only generate locales that are missing
- ${GOOD}-G, --generate <locale>${NORMAL} Generate specified locale (one shot; implies -k -u)
- ${GOOD}-j, --jobs <num>${NORMAL} Number of locales to generate at a time (parallel)
- ${GOOD}-q, --quiet${NORMAL} Only show errors
- ${GOOD}-V, --version${NORMAL} Meaningless version information
- ${GOOD}-h, --help${NORMAL} Show this help cruft
+sub parse_opts ($known_prefix, @args) {
+ my @options = (
+ [ 'config|c=s' => "The file containing the chosen locales (default: $known_prefix/etc/locale.gen)" ],
+ [ 'all|A' => 'Select all locales, ignoring the config file' ],
+ [ 'update|u' => 'Skip any chosen locales that are already installed', ],
+ [ 'jobs|j=i' => 'Maximum number of localedef(1) instances to run in parallel' ],
+ [ 'prefix|p=s' => 'The prefix of the root filesystem' ],
+ [ 'quiet|q' => 'Only show errors' ],
+ [ 'version|V' => 'Output version information and exit' ],
+ [ 'help|h' => 'Display this help and exit' ]
+ );
+
+ # Parse the provided arguments.
+ my $parser = Getopt::Long::Parser->new;
+ $parser->configure(qw(posix_default bundling_values no_ignore_case));
+ my %opt;
+ {
+ # Decorate option validation errors while also not permitting
+ # for more than one to be reported.
+ local $SIG{'__WARN__'} = sub ($error) { die "$PROGRAM: $error" };
+ $parser->getoptionsfromarray(\@args, \%opt, map +( $_->[0] ), @options);
+ }
+
+ # If either --help or --version was specified, exclusively attend to it.
+ if ($opt{'help'}) {
+ show_usage(@options);
+ exit;
+ } elsif ($opt{'version'}) {
+ show_version();
+ exit;
+ }
+
+ # Validate the options and option-arguments.
+ if ($opt{'all'} && exists $opt{'config'}) {
+ die "$PROGRAM: The --all and --config options are mutually exclusive\n";
+ } elsif (exists $opt{'prefix'} && length $known_prefix && ! is_eq_file($known_prefix, $opt{'prefix'})) {
+ die "$PROGRAM: The --prefix option specifies a path contrary to a detected Gentoo Prefix\n";
+ }
+
+ # Assign values for unspecified options that need them.
+ if (! exists $opt{'jobs'} || $opt{'jobs'} < 1) {
+ $opt{'jobs'} = get_nprocs() || 1;
+ }
+ if ($opt{'all'}) {
+ $opt{'config'} = catfile($opt{'prefix'} // $known_prefix, '/usr/share/i18n', 'SUPPORTED');
+ } elsif (exists $opt{'config'} && $opt{'config'} eq '-') {
+ $opt{'config'} = '/dev/stdin';
+ }
+
+ return %opt;
+}
- ${HILITE}Localedef Options:${NORMAL}
- By default, ${GOOD}${LOCALEDEF_OPTS}${NORMAL} is passed to localedef.
+sub show_usage (@options) {
+ print "Usage: locale-gen [OPTION]...\n\n";
+ my $pipe;
+ if (! open $pipe, "| column -t -s \037") {
+ exit 1;
+ }
+ for my $row (@options) {
+ my ($spec, $description) = $row->@*;
+ my ($long, $short) = split /[|=]/, $spec;
+ printf {$pipe} "-%s, --%s\037%s\n", $short, $long, $description;
+ }
+}
- For more info, see the ${HILITE}locale-gen${NORMAL}(1) and ${HILITE}locale.gen${NORMAL}(8) manpages.
+sub show_version () {
+ print <<~EOF;
+ locale-gen $VERSION
+ Copyright 2024 Kerin Millar <kfm\@plushkava.net>
+ License GPL-2.0-only <https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html>
EOF
- [[ $# -eq 0 ]] && exit 0
- echo ""
- eerror "Unknown option '$1'"
- exit 1
}
-show_version() {
- echo "locale-gen-2.xxx"
- exit 0
+sub list_locales ($prefix) {
+ if (! defined(my $pid = open my $pipe, '-|')) {
+ die "Can't fork: $!";
+ } elsif ($pid == 0) {
+ run_localedef($prefix, '--list-archive');
+ } else {
+ chomp(my @locales = readline $pipe);
+ if (-1 == waitpid($pid, 0) || $? != 0) {
+ die "$PROGRAM: Can't obtain a list of the presently installed locales\n";
+ }
+ return @locales;
+ }
}
-LOCALEDEF_OPTS=""
-KEEP=""
-DESTDIR=""
-CONFIG=""
-JUST_LIST=""
-ASK=""
-ALL=""
-UPDATE=""
-GENERATE=""
-JOBS_MAX=""
-QUIET=0
-SET_X=""
-LOCALE_ARCHIVE=true
-INPLACE_GLIBC=""
-while [[ $# -gt 0 ]] ; do
- case $1 in
- --inplace-glibc) INPLACE_GLIBC=$1;;
- -k|--keep|--keep-existing) KEEP=$1;;
- -d|--destdir) shift; DESTDIR=$1; unset ROOT;;
- -c|--config) shift; CONFIG=$1;;
- -l|--list) JUST_LIST=$1;;
- -a|--ask) ASK=$1;;
- -A|--all) ALL=$1;;
- -u|--update) UPDATE=$1;;
- -G|--generate) shift; GENERATE=$1;;
- -j|--jobs) shift; JOBS_MAX=$(( $1 ));;
- -j*) : $(( JOBS_MAX = ${1#-j} ));;
- -q|--quiet) : $(( ++QUIET ));;
- -x|--debug) SET_X="true";;
- -V|--version) show_version;;
- -h|--help) show_usage;;
- --) shift; LOCALEDEF_OPTS=$*; break;;
- *) show_usage $1;;
- esac
- shift
-done
-
-if [[ -n ${COMPILED_LOCALES} ]] ; then
- ewarn "All locales have been installed and registered by the package manager. If you"
- ewarn "rebuild the locale archive now, file integrity tools may show it as corrupted."
- ewarn "This is not really a big problem, but a better solution is to disable"
- ewarn "USE=compile-locales and re-install glibc if you dont need all locales."
- echo
-fi
-
-if [[ -z ${JOBS_MAX} ]] ; then
- JOBS_MAX=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
- : "${JOBS_MAX:=1}"
-fi
-[[ ${JOBS_MAX} -lt 1 ]] && JOBS_MAX=1
-[[ -n ${SET_X} ]] && set -x
-: "${KEEP:=${JUST_LIST}}"
-[[ -n ${GENERATE} ]] && UPDATE="true" && KEEP="true"
-
-: "${ROOT:=/}"
-ROOT="${ROOT%/}/"
-
-if [[ ${ROOT} != "/" ]] ; then
- eerror "Sorry, but ROOT is not supported."
- exit 0
-fi
-
-: "${EROOT:=${EPREFIX}/}"
-if [[ ${EROOT} != "/" ]] ; then
- einfo "Using locale.gen from ${EROOT%/}/etc/"
-fi
-
-if [[ -n ${DESTDIR} ]] ; then
- DESTDIR="${DESTDIR%/}/"
- einfo "Building locales in DESTDIR '${DESTDIR}'"
-else
- DESTDIR="${EROOT%/}/"
-fi
-
-: "${CONFIG:=${EROOT%/}/etc/locale.gen}"
-LOCALES=${DESTDIR}usr/share/i18n/locales
-CHARMAPS=${DESTDIR}usr/share/i18n/charmaps
-SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED
-ALIAS=${DESTDIR}usr/share/locale/locale.alias
+sub normalize ($canonical) {
+ if (2 == (my ($locale, $charmap) = split /\./, $canonical, 3)) {
+ # en_US.UTF-8 => en_US.utf8; en_US.ISO-8859-1 => en_US.iso88591
+ return join '.', $locale, lc($charmap =~ s/-//gr);
+ } else {
+ die "Can't normalize " . render_printable($canonical);
+ }
+}
-#
-# Grab any user options in their config file
-options=$(sed -n \
- -e '/^[[:space:]]*#%/s:^[[:space:]]*#%[[:space:]]*::p'\
- "${CONFIG}" 2>/dev/null
-)
-IFS=$'\n'
-for option in ${options} ; do
- case ${option} in
- no-locale-archive)
- LOCALE_ARCHIVE=false
- ;;
- *)
- ewarn "Unrecognized option '${option}'"
- ;;
- esac
-done
-unset IFS
-
-[[ -n ${ALL} ]] && CONFIG=${SUPPORTED}
-
-# Extract the location of the locale dir on the fly as `localedef --help` has:
-# locale path : /usr/lib64/locale:/usr/share/i18n
-# For long paths, the line may get wrapped into two, in which case space (' ') is replaced
-# by newline (\n).
-LOCALEDIR=$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -r '/locale path/{N;s|.*:[ \n](.*):/.*|\1|;p}')
-LOCALEDIR="${DESTDIR}${LOCALEDIR#${EPREFIX}}"
-if [[ $? -ne 0 ]] || [[ -z ${LOCALEDIR} ]] || [[ ${LOCALEDIR} != ${DESTDIR}/usr/lib*/locale ]] ; then
- eerror "Unable to parse the output of your localedef utility." 1>&2
- eerror "File a bug about this issue and include the output of 'localedef --help'." 1>&2
- exit 1
-fi
-
-# Only generate locales the user specified before falling back to the config.
-locales_to_generate=${GENERATE}
-
-if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
- locales_to_generate=$(sed \
- -e 's:#.*::' \
- -e '/^[[:space:]]*$/d' \
- "${CONFIG}" | sort)
- # Sanity check to make sure people did not duplicate entries. #550884
- # The first column must be unique specifically. #235555
- dup_locales_to_generate=$(
- echo "${locales_to_generate}" | \
- awk '{ if ($1 == last) { print lastline; print; } else { lastline = $0; last = $1; } }')
- if [[ -n ${dup_locales_to_generate} ]] ; then
- ewarn "These locales have been duplicated in your config:\n${dup_locales_to_generate}"
- ewarn "Some might be filtered, but you must fix it."
- locales_to_generate=$(echo "${locales_to_generate}" | uniq)
- fi
-fi
-
-# Transform the name in locales.gen to the name used when storing the locale data in
-# /usr/lib/locale/. This normalize algo is taken out of the glibc localedef source:
-# https://sourceware.org/git/?p=glibc.git;a=blob;f=locale/programs/localedef.c;hb=glibc-2.34#l562
-normalize() {
- if [[ $1 == *.* ]] ; then
- local ret=${1##*.}
- ret=${ret,,}
- echo "${1%%.*}.${ret//-}"
- else
- echo "$1"
- fi
+sub read_config ($prefix, @paths) {
+ # Compose a dictionary of locale names known to be valid.
+ my %locale_by = map +( $_ => 1 ), get_valid_locales($prefix);
+
+ # Compose a dictionary of character maps known to be valid.
+ my %charmap_by = map +( $_ => 1 ), get_valid_charmaps($prefix);
+
+ # Iterate over the given paths and return the first non-empty list of
+ # valid locale declarations that can be found among them, if any.
+ for my $i (keys @paths) {
+ my $path = $paths[$i];
+ try {
+ my $fh = fopen($path);
+ $! = 0;
+ if (my @locales = parse_config($fh, $path, \%locale_by, \%charmap_by)) {
+ return @locales;
+ }
+ } catch ($e) {
+ # Disregard open errors concerning non-existent files
+ # unless there are no more paths to be tried. Validation
+ # errors shall also be propagated here.
+ if ($! != ENOENT || $i == $#paths) {
+ die $e;
+ }
+ }
+ }
+
+ # For no locales to have been discovered at this point is exceptional.
+ my $path_list = render_printable(scalar @paths == 1 ? $paths[0] : \@paths);
+ die "$PROGRAM: No locale declarations were found within $path_list\n";
+}
+
+sub get_valid_locales ($prefix) {
+ my $top = local $ENV{'TOP'} = catdir($prefix, '/usr/share/i18n/locales');
+ my @paths = qx{ cd -- "\$TOP" && find . ! -path . -prune ! -path '*\n*' -type f -exec grep -lxF LC_IDENTIFICATION {} + };
+ if ($? != 0 || ! @paths) {
+ die "$PROGRAM: Failed to compose a list of valid locale names from '$top'\n";
+ }
+ chomp @paths;
+ return map +( (splitpath($_))[-1] ), @paths;
+}
+
+sub get_valid_charmaps ($prefix) {
+ my $top = catdir($prefix, '/usr/share/i18n/charmaps');
+ if (! opendir my $dh, $top) {
+ die "$PROGRAM: Can't open '$top' for reading: $!\n";
+ } elsif (! (my @names = map +( -f "$top/$_" ? s/\.gz\z//r : () ), readdir $dh)) {
+ die "$PROGRAM: Failed to compose a list of valid character maps from '$top'\n";
+ } else {
+ return @names;
+ }
+}
+
+sub parse_config ($fh, $path, $locale_by, $charmap_by) {
+ # Set up a helper routine to throw for validation errors.
+ my $thrower = sub ($error, $line) {
+ die sprintf "%s: %s at %s[%d]: %s\n",
+ $PROGRAM, $error, $path, $., render_printable($line);
+ };
+
+ my @locales;
+ while (my $line = readline $fh) {
+ # Skip comments and blank lines. Note that \h will match only " " and
+ # "\t", since the input stream is not being subjected to any decoding.
+ next if $line =~ m/^\h*($|#)/;
+
+ # Expect for two fields, separated by horizontal whitespace.
+ my @fields;
+ chomp $line;
+ if (2 != (@fields = split /\h+/, trim_line($line), 3)) {
+ $thrower->('Malformed locale declaration', $line);
+ }
+
+ # Extract the specified locale and character map. Upon success,
+ # a canonicalised representation of the locale is also returned.
+ my ($locale, $charmap, $canonical) = parse_entry(@fields);
+
+ # Validate both locale and character map before accepting.
+ if (! $locale_by->{$locale}) {
+ $thrower->('Invalid locale', $line);
+ } elsif (! $charmap_by->{$charmap}) {
+ $thrower->('Invalid/mismatching charmap', $line);
+ } else {
+ push @locales, [ $locale, $charmap, $canonical ];
+ }
+ }
+
+ return @locales;
+}
+
+sub parse_entry ($locale, $charmap) {
+ my $canonical;
+ if (2 == (my @fields = split /@/, $locale, 3)) {
+ # de_DE@euro ISO-8859-15 => de_DE.ISO-8859-15@euro
+ $canonical = sprintf '%s.%s@%s', $fields[0], $charmap, $fields[1];
+ } elsif (2 == (@fields = split /\./, $locale, 3)) {
+ # en_US.UTF-8 UTF-8 => en_US.UTF-8
+ $locale = $fields[0];
+ $canonical = "$locale.$charmap";
+ if ($fields[1] ne $charmap) {
+ $charmap = '';
+ }
+ } elsif (1 == @fields) {
+ # en_US ISO-8859-1 => en_US.ISO-8859-1
+ $canonical = "$locale.$charmap";
+ }
+ return $locale, $charmap, $canonical;
+}
+
+sub enter_tempdir ($prefix) {
+ # Given that /tmp might be a tmpfs, prefer /var/tmp so as to avoid
+ # undue memory pressure.
+ my $dir = catdir($prefix, '/var/tmp');
+ if (! -d $dir) {
+ $dir = File::Spec->tmpdir;
+ }
+ $TEMPDIR = tempdir('locale-gen.XXXXXXXXXX', 'DIR' => $dir);
+ if (! chdir $TEMPDIR) {
+ die "$PROGRAM: Can't chdir to '$TEMPDIR': $!\n";
+ }
+}
+
+sub generate_locales ($prefix, $workers, @locales) {
+ # Trap SIGINT and SIGTERM so that they may be handled gracefully.
+ my $handler = sub ($signal) { $DEFERRED_SIGNAL ||= $signal };
+ local @SIG{'INT', 'TERM'} = ($handler, $handler);
+
+ my $total = scalar @locales;
+ printf "Compiling %d locale definition file%s with %d worker%s ...\n",
+ $total, plural($total), $workers, plural($workers);
+
+ my $num_width = length $total;
+ my %status_by;
+ for my $i (keys @locales) {
+ # Ensure that the number of concurrent workers is bounded.
+ if ($i >= $workers) {
+ my $pid = wait;
+ last if 0 != ($status_by{$pid} = $?);
+ }
+
+ my ($locale, $charmap, $canonical) = $locales[$i]->@*;
+ printf "[%*d/%d] Compiling locale: %s\n",
+ $num_width, $i + 1, $total, $canonical;
+
+ # Fork and execute localedef(1) for locale compilation.
+ if (! defined(my $pid = fork)) {
+ warn "Can't fork: $!";
+ last;
+ } elsif ($pid == 0) {
+ @SIG{'INT', 'TERM'} = ('DEFAULT', 'DEFAULT');
+ compile_locale($locale, $charmap, $canonical);
+ }
+ } continue {
+ last if $DEFERRED_SIGNAL;
+ }
+
+ # Reap any subprocesses that remain.
+ if ($workers > 1) {
+ print "Waiting for active workers to finish their jobs ...\n";
+ }
+ while (-1 != (my $pid = wait)) {
+ $status_by{$pid} = $?;
+ }
+
+ # Abort if any of the collected status codes are found to be non-zero.
+ # In the case that one subprocess was interrupted by a signal while
+ # another exited non-zero, the resulting diagnostic shall allude to the
+ # signal. Such determinism is achieved by sorting the values.
+ for my $status (sort { $a <=> $b } values %status_by) {
+ throw_child_error('localedef', $status);
+ }
+
+ if ($DEFERRED_SIGNAL) {
+ # The signal shall be propagated by the END block.
+ exit;
+ } elsif (scalar %status_by != $total) {
+ die "$PROGRAM: Aborting because not all of the selected locales were compiled\n";
+ }
}
-# These funky sed's are based on the stuff in glibc's localedata/Makefile
-# Basically we want to rewrite the display like so:
-# <locale without a . or @>.<charmap>[@extra stuff after the @ in the locale]
-# en_US ISO-8859-1 -> en_US.ISO-8859-1
-# en_US.UTF-8 UTF-8 -> en_US.UTF-8
-# de_DE@euro ISO-8859-15 -> de_DE.ISO-8859-15@euro
-locales_disp=$(echo "${locales_to_generate}" | sed \
- -e ' /@/ s:[[:space:]]*\([^@[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3\2:' \
- -e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
-
-# Now check the normalized version for C.UTF-8, and add it if not present
-if [[ -z ${locales_to_generate} ]] ; then
- if [[ -z ${JUST_LIST} ]] ; then
- [[ ${QUIET} -eq 0 ]] && \
- ewarn "No locales to generate found, keeping archive but ensuring C.UTF-8 is present"
- KEEP=1
- UPDATE=1
- locales_disp='C.UTF-8'
- locales_to_generate='C.UTF-8 UTF-8'
- fi
-else
- if echo ${locales_disp} | grep -vqi 'C.UTF-8' ; then
- locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
- locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
- fi
-fi
-
-mkdir -p "${LOCALEDIR}"
-if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
- # Remove all old locale dir and locale-archive before generating new
- # locale data. Scrubbing via update is done elsewhere.
- rm -rf "${LOCALEDIR}"/* &> /dev/null || true
-fi
-
-eval declare -a locales_disp=(${locales_disp})
-eval declare -a locales_to_generate=(${locales_to_generate})
-total=$(( ${#locales_to_generate[*]} / 2 ))
-
-[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
-einfo "Generating ${total} locales (this might take a while) with ${JOBS_MAX} jobs"
-
-if [[ -n ${UPDATE} ]] ; then
- # normalize newlines into spaces
- existing_locales=" $(echo $(locale -a 2>/dev/null)) "
-fi
-
-generate_locale() {
- local output=""
-
- if [[ -z ${ASK} ]] && [[ ${QUIET} -eq 0 ]] ; then
- output=" (${cnt_fmt}/${total}) Generating ${disp}"
- fi
-
- if [[ $(( JOB_IDX_E - JOB_IDX_S )) == ${JOBS_MAX} ]] ; then
- wait ${JOB_PIDS[$(( JOB_IDX_S++ ))]}
- JOB_RETS+=( $? )
- fi
- (
- # Accumulate all the output in one go so the parallel
- # jobs don't tromp on each other
- x=$(
- [[ -n ${output} ]] && ebegin "${output}"
- # In most cases, localedef can just use the system glibc.
- # However, if we are within a major glibc upgrade, this may fail
- # in src_* phases since the new localedef links against the new
- # glibc, but the new glibc is not installed yet...
- if [[ -z ${INPLACE_GLIBC} ]] ; then
- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
- --no-archive \
- -i "${input}" \
- -f "${charmap}" \
- -A "${ALIAS}" \
- --prefix "${DESTDIR%${EPREFIX}/}/" \
- "${locale}" 2>&1
- else
- # We assume that the current directory is "${ED}"/$(get_libdir),
- # see the glibc ebuild, function glibc_sanity_check(), for why.
- LC_ALL=C ./ld-*.so --library-path . \
- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
- --no-archive \
- -i "${input}" \
- -f "${charmap}" \
- -A "${ALIAS}" \
- --prefix "${DESTDIR%${EPREFIX}/}/" \
- "${locale}" 2>&1
- fi
- ret=$?
- [[ -n ${output} ]] && eend ${ret}
- exit ${ret}
- )
- ret=$?
- if [[ -n ${output} ]] ; then
- echo "${x}"
- elif [[ ${ret} -ne 0 ]] ; then
- eerror "${disp}: ${x}"
- fi
-
- if [[ ${ret} -ne 0 && ${locale} == */* ]] ; then
- ewarn "Perhaps you meant to use a space instead of a / in your config file ?"
- fi
- exit ${ret}
- ) &
- JOB_PIDS+=( $! )
- : $(( ++JOB_IDX_E ))
+sub compile_locale ($locale, $charmap, $canonical) {
+ my $output_dir = "./$canonical";
+ my @args = ('--no-archive', '-i', $locale, '-f', $charmap, '--', $output_dir);
+ run_localedef(undef, @args);
+}
+
+sub generate_archive ($prefix, $locale_dir, $do_update, @canonicals) {
+ # Create the temporary subdir that will contain the new locale archive.
+ my $output_dir = catdir('.', $prefix, $locale_dir);
+ run('mkdir', '-p', '--', $output_dir);
+
+ # Determine the eventual destination path of the archive.
+ my $final_path = catfile($prefix, $locale_dir, 'locale-archive');
+ printf "The location of the archive shall be %s.\n", render_printable($final_path);
+
+ # If --update was specified, make a copy of the existing archive.
+ if ($do_update && -e $final_path) {
+ run('cp', '--', $final_path, "$output_dir/");
+ }
+
+ # Integrate all of the compiled locales into the new locale archive.
+ my $total = scalar @canonicals;
+ printf "Adding %d locale%s to the locale archive ...\n", $total, plural($total);
+ my $stderr = fopen('stderr.log', '+>');
+ redirect_stderr($stderr, sub {
+ my @args = ('--quiet', '--add-to-archive', '--replace', '--', @canonicals);
+ run_localedef('.', @args);
+ });
+
+ # Propagate the diagnostics and errors raised by localedef(1), if any.
+ seek $stderr, 0, SEEK_SET;
+ my $i = 0;
+ while (my $line = readline $stderr) {
+ warn $line;
+ ++$i;
+ }
+ close $stderr;
+
+ # Check the status code first.
+ throw_child_error('localedef');
+
+ # Sadly, the exit status of GNU localedef(1) is nigh on useless in the
+ # case that the --add-to-archive option is provided. If anything was
+ # printed to STDERR at all, act as if the utility had exited 1.
+ if ($i > 0) {
+ throw_child_error('localedef', 1 << 8);
+ }
+
+ # The process of replacing the old archive must not be interrupted.
+ local @SIG{'INT', 'TERM'} = ('IGNORE', 'IGNORE');
+
+ # Move the newly minted archive into the appropriate filesystem. Use
+ # mv(1), since there is a chance of crossing a filesystem boundary.
+ my $interim_path = "$final_path.$$";
+ run('mv', '--', catfile($output_dir, 'locale-archive'), $interim_path);
+
+ # Atomically replace the old archive.
+ if (! rename $interim_path, $final_path) {
+ {
+ local $!;
+ unlink $interim_path;
+ }
+ die "$PROGRAM: Can't rename '$interim_path' to '$final_path': $!\n";
+ }
+}
+
+sub run_localedef ($prefix, @args) {
+ # Incorporate the --prefix option, if requested.
+ if (length $prefix) {
+ unshift @args, '--prefix', $prefix;
+ }
+
+ # Prevent the --verbose option from being potentially implied.
+ delete local $ENV{'POSIXLY_CORRECT'};
+
+ # Execute localedef(1). Don't fork if doing so from a child process.
+ my @cmd = ('localedef', @args);
+ if ($$ == $PID) {
+ system @cmd;
+ } elsif (! exec @cmd) {
+ exit 1;
+ }
+}
+
+sub fopen ($path, $mode = '<') {
+ if (! open my $fh, $mode, $path) {
+ die "$PROGRAM: Can't open '$path': $!\n";
+ } elsif (! -f $fh && canonpath($path) !~ m/^\/dev\/(null|stdin)\z/) {
+ die "$PROGRAM: Won't open '$path' because it is not a regular file\n";
+ } else {
+ return $fh;
+ }
+}
+
+sub get_nprocs () {
+ chomp(my $nproc = qx{ { nproc || getconf _NPROCESSORS_CONF; } 2>/dev/null });
+ return $nproc;
+}
+
+sub is_eq_file ($path1, $path2) {
+ # The -ef primary is standard as of POSIX.1-2024.
+ local @ENV{'PATH1', 'PATH2'} = ($path1, $path2);
+ return 0 == system q{ test "$PATH1" -ef "$PATH2" };
+}
+
+sub plural ($int) {
+ return $int == 1 ? '' : 's';
}
-JOB_PIDS=()
-JOB_RETS=()
-JOB_IDX_S=0
-JOB_IDX_E=0
-cnt=0
-lidx=0
-# Keep track of (normalized) locales generated in case the request has different inputs that
-# normalize down to the same value. We trim $existing_locales as we go for later use which
-# prevents its direct use.
-generated_locales=" "
-while [[ -n ${locales_to_generate[${lidx}]} ]] ; do
- : $(( ++cnt ))
- locale=${locales_to_generate[$((lidx++))]}
- charmap=${locales_to_generate[$((lidx++))]}
-
- # XXX: if we wanted to, we could check existence of
- # ${LOCALES}/${locale} and ${CHARMAPS}/${charmap}
- # this would fail for things like "en_US.UTF8", but
- # in that case we could fall back to checking the
- # SUPPORTED file ... then again, the localedef
- # below will abort nicely for us ...
- if [[ -z ${locale} || -z ${charmap} ]] ; then
- eerror "Bad entry in locale.gen: '${locale} ${charmap}'; skipping"
- continue
- fi
-
- disp=${locales_disp[$(( cnt - 1 ))]}
-
- normalized_locale=$(normalize ${locale})
- if [[ ${generated_locales} == *" ${normalized_locale} "* ]] ; then
- already_generated="true"
- else
- already_generated="false"
- fi
- generated_locales+="${normalized_locale} "
- if ${already_generated} || \
- [[ -n ${UPDATE} && ${existing_locales} == *" ${normalized_locale} "* ]] ; then
- existing_locales=${existing_locales/ ${normalized_locale} / }
- if [[ ${QUIET} -eq 0 ]] ; then
- cnt_fmt=$(printf "%${#total}i" ${cnt})
- einfo " (${cnt_fmt}/${total}) Skipping ${disp}"
- fi
- continue
- fi
-
- # If the locale is like 'en_US.UTF8', then we really want 'en_US'
- if [[ -f ${LOCALES}/${locale} ]] ; then
- input=${locale}
- else
- input=${locale%%.*}
- fi
-
- if [[ -z ${JUST_LIST} ]] ; then
- # Format the output for the question/status
- cnt_fmt=$(printf "%${#total}i" ${cnt})
- if [[ -n ${ASK} ]] ; then
- einfon " (${cnt_fmt}/${total}) Generate ${disp} ? (Y/n) "
- read user_answer
- [[ ${user_answer} == [nN]* ]] && continue
- fi
- generate_locale
- else
- echo "${disp}"
- fi
-done
-
-for (( i = JOB_IDX_S; i < JOB_IDX_E; ++i )) ; do
- wait ${JOB_PIDS[i]}
- JOB_RETS+=( $? )
-done
-ret=$(( 0 ${JOB_RETS[@]/#/+} ))
-
-[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
-einfo "Generation complete"
-
-if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
- # need to check that at least one locale has to be added
- if [[ $(echo "${LOCALEDIR}"/*/) != "${LOCALEDIR}"'/*/' ]] ; then
- [[ ${QUIET} -eq 0 ]] && ebegin "Adding locales to archive"
- # The pattern ends with / on purpose: we don't care about files (like
- # locale-archive) in the locale subdir, and we definitely don't want to
- # delete them!
- for LOC in "${LOCALEDIR}"/*/; do
- LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
- x=$(
- # In most cases, localedef can just use the system glibc.
- # However, if we are within a major glibc upgrade, this may fail
- # in src_* phases since the new localedef links against the new
- # glibc, but the new glibc is not installed yet...
- if [[ -z ${INPLACE_GLIBC} ]] ; then
- "${DESTDIR}"usr/bin/localedef \
- --add-to-archive "${LOC}" \
- --replace \
- --prefix "${DESTDIR%${EPREFIX}/}/"
- else
- # We assume that the current directory is "${ED}"/$(get_libdir),
- # see the glibc ebuild, function glibc_sanity_check(), for why.
- LC_ALL=C ./ld-*.so --library-path . \
- "${DESTDIR}"usr/bin/localedef \
- --add-to-archive "${LOC}" \
- --replace \
- --prefix "${DESTDIR%${EPREFIX}/}/"
- fi
- ret=$?
- if [[ -n ${output} ]] ; then
- echo "${x}"
- elif [[ ${ret} -ne 0 ]] ; then
- eerror "${disp}: ${x}"
- fi
- if [[ $ret -eq 0 ]]; then
- rm -r "${LOC}"
- fi
- exit ${ret}
- )
- done
- [[ ${QUIET} -eq 0 ]] && eend ${ret}
- elif [[ ${QUIET} -eq 0 ]] ; then
- einfo "No locales are to be added to the archive."
- fi
-fi
-
-# Remove locales that existed but were not requested
-if [[ -n ${UPDATE} ]] && [[ -z ${JUST_LIST} ]] ; then
- # Ignore these pseudo locales
- existing_locales=${existing_locales/ C / }
- existing_locales=${existing_locales/ POSIX / }
- if [[ -n ${existing_locales// } ]] ; then
- if [[ -z ${KEEP} ]] ; then
- [[ ${QUIET} -eq 0 ]] && einfo "Scrubbing old locales:"${existing_locales}
- cd "${LOCALEDIR}" && rm -rf ${existing_locales}
- else
- [[ ${QUIET} -eq 0 ]] && einfo "Keeping old locales:"${existing_locales}
- fi
- fi
-fi
-
-exit ${ret}
+sub redirect_stderr ($stderr, $callback) {
+ if (! open my $old_stderr, '>&', *STDERR) {
+ die "Can't dup STDERR to a new file descriptor: $!";
+ } elsif (! open *STDERR, '>&', $stderr) {
+ my $fileno = fileno $stderr;
+ die "Can't dup file descriptor #$fileno to STDERR: $!";
+ } else {
+ $callback->();
+ open *STDERR, '>&=', $old_stderr;
+ }
+}
+
+sub render_printable ($value) {
+ my $coder = JSON::PP->new->ascii->space_after;
+ return $coder->encode($value);
+}
+
+sub run ($cmd, @args) {
+ system $cmd, @args;
+ throw_child_error($cmd);
+}
+
+sub throw_child_error ($cmd, $status = $?) {
+ if ($status == -1) {
+ # The program could not be started. Since Perl will already
+ # have printed a warning, no supplemental diagnostic is needed.
+ exit 1;
+ } elsif ($status != 0) {
+ my $printable_cmd = render_printable($cmd);
+ my $fate = ($status & 0x7F) ? 'interrupted by a signal' : 'unsuccessful';
+ die "$PROGRAM: Aborting because the execution of $printable_cmd was $fate\n";
+ }
+}
+
+sub trim_line ($line) {
+ return $line =~ s/^\h+|\h+$//gr;
+}
+
+END {
+ if ($$ == $PID) {
+ if (length $TEMPDIR) {
+ local $?;
+ system 'rm', '-r', '--', $TEMPDIR;
+ }
+
+ # The default SIGINT and SIGTERM handlers are suppressed by
+ # generate_locales. The former is especially important, per
+ # http://www.cons.org/cracauer/sigint.html.
+ if ($DEFERRED_SIGNAL) {
+ kill $DEFERRED_SIGNAL, $$;
+ }
+ }
+}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-08-04 11:19 Sam James
0 siblings, 0 replies; 148+ messages in thread
From: Sam James @ 2025-08-04 11:19 UTC (permalink / raw
To: gentoo-commits
commit: 675a6b1602c6665428126b780aa2ab959c1e9f52
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 4 11:18:55 2025 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Aug 4 11:18:55 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=675a6b16
Revert "Initial commit of Perl-based locale-gen"
This reverts commit e9a590ba0804d0ade9fe842076ab66b7057b8c36.
Kerin will reapply w/ a detailed commit message shortly.
Signed-off-by: Sam James <sam <AT> gentoo.org>
locale-gen | 984 +++++++++++++++++++++++++++----------------------------------
1 file changed, 427 insertions(+), 557 deletions(-)
diff --git a/locale-gen b/locale-gen
index c2e622a..d0e109e 100755
--- a/locale-gen
+++ b/locale-gen
@@ -1,581 +1,451 @@
-#!/usr/bin/perl
+#!/bin/bash
-# locale-gen
#
-# Generates a glibc locale archive from templates, potentially limiting itself
-# to a set of locales defined by the admin, typically within /etc/locale.gen.
-
-use v5.36;
-
-use Errno qw(ENOENT);
-use Fcntl qw(SEEK_SET);
-use File::Spec::Functions qw(canonpath catfile catdir splitpath);
-use File::Temp qw(tempdir);
-use Getopt::Long ();
-use JSON::PP ();
-use POSIX qw(LC_ALL setlocale);
+# Based upon Debian's locale-gen, fetched from glibc_2.3.6-7.diff.gz, but completely rewritten.
+#
-# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
-use experimental qw(try);
+# NB: Bash-4.0+ required. We use += and ${var,,} features.
-# Determine the basename of the presently compiling script.
-my $PROGRAM;
-BEGIN { $PROGRAM = (splitpath(__FILE__))[-1]; }
+unset POSIXLY_CORRECT IFS
+umask 0022
-my $VERSION = '3.0';
+argv0=${0##*/}
-my $DEFERRED_SIGNAL = '';
-my $PID = $$;
-my $TEMPDIR;
+EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
+ EPREFIX=""
+fi
-# For the C locale to be in effect can be a consequence of the user's chosen
-# locale not yet being available. That being the case, unset all environment
-# variables pertaining to locale handling for the benefit of any subprocesses.
-if (setlocale(LC_ALL) eq 'C') {
- delete @ENV{ grep +( m/^(LANG\z|LC_)/ ), keys %ENV };
+FUNCTIONS_SH="/lib/gentoo/functions.sh"
+source "${EPREFIX}"${FUNCTIONS_SH} || {
+ echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
+ exit 1
}
-# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it. Unset
-# CDPATH also, for it is nothing but a liability in a non-interactive context.
-delete @ENV{'BASH_ENV', 'CDPATH'};
-
-{
- # Determine the locale directory, as reported by localedef(1).
- my $locale_dir = get_locale_dir();
-
- # Infer the path of a Gentoo Prefix environment, if any.
- my $gentoo_prefix = detect_gentoo_prefix($locale_dir);
- if (length $gentoo_prefix) {
- $locale_dir =~ s/^\Q$gentoo_prefix//;
- }
-
- # Collect any supported options and option-arguments.
- my %opt = parse_opts($gentoo_prefix, @ARGV);
- my $prefix = $opt{'prefix'} // $gentoo_prefix;
-
- # A proxy check is justified because compilation may take a long time.
- my $archive_dir = catdir($prefix, $locale_dir);
- if (! utime undef, undef, $archive_dir) {
- die "$PROGRAM: Aborting because UID $> can't modify '$archive_dir': $!\n";
- }
-
- # Honour the --quiet option.
- if ($opt{'quiet'} && ! open *STDOUT, '>/dev/null') {
- die "Can't direct STDOUT to /dev/null: $!";
- }
-
- # Ensure that the C.UTF-8 locale is made available.
- my @locales = ([ 'C', 'UTF-8', 'C.UTF-8' ]);
-
- # Compose a list of up to two configuration files to be read.
- my @config_files;
- if (exists $opt{'config'}) {
- push @config_files, $opt{'config'};
- } else {
- push @config_files, (
- catfile($prefix, '/etc', 'locale.gen'),
- catfile($prefix, '/usr/share/i18n', 'SUPPORTED')
- );
- }
-
- # Collect the locales that are being requested for installation.
- push @locales, read_config($prefix, @config_files);
-
- # Compose a dictionary of installed locales for the --update option.
- my %installed_by;
- if ($opt{'update'}) {
- # If localedef(1) originates from a Gentoo Prefix environment,
- # the prefix will already have been hard-coded by the utility.
- my $explicit_prefix = length $gentoo_prefix ? undef : $prefix;
- %installed_by = map +( $_ => 1 ), list_locales($explicit_prefix);
- }
-
- # Filter out locales that are duplicates or that are already installed.
- my %requested_by;
- my $i = 0;
- while ($i <= $#locales) {
- my $canonical = $locales[$i][2];
- my $normal = normalize($canonical);
- if ($requested_by{$normal}++ || $installed_by{$normal}) {
- splice @locales, $i, 1;
- } else {
- ++$i;
- }
- }
-
- # If a non-actionable update was requested, proceed no further.
- if (! @locales) {
- print "All of the requested locales are presently installed.\n";
- exit 0;
- }
-
- # Create a temporary directory and switch to it.
- enter_tempdir($prefix);
-
- # Compile the selected locales.
- generate_locales($prefix, $opt{'jobs'}, @locales);
-
- # Integrate the newly compiled locales into the system's locale archive.
- generate_archive($prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
-
- my $total = scalar @locales;
- printf "Successfully installed %d locale%s.\n", $total, plural($total);
-}
+COMPILED_LOCALES=""
-sub get_locale_dir () {
- my $stdout = qx{ localedef --help };
- if ($? == 0 && $stdout =~ m/\hlocale path\h*:\s+(\/[^:]+)/) {
- return canonpath($1);
- } else {
- die "Can't parse locale directory from localedef(1) output: $!";
- }
-}
+show_usage() {
+ cat <<-EOF
+ Usage: ${HILITE}${argv0}${NORMAL} ${GOOD}[options]${NORMAL} -- ${GOOD}[localedef options]${NORMAL}
-sub detect_gentoo_prefix ($path) {
- if ($path !~ s/\/usr\/lib\/locale\z//) {
- die "Can't handle unexpected locale directory of '$path'";
- } elsif (length $path && -e "$path/etc/gentoo-release") {
- return $path;
- } else {
- return '';
- }
-}
+ Generate locales based upon the config file /etc/locale.gen.
-sub parse_opts ($known_prefix, @args) {
- my @options = (
- [ 'config|c=s' => "The file containing the chosen locales (default: $known_prefix/etc/locale.gen)" ],
- [ 'all|A' => 'Select all locales, ignoring the config file' ],
- [ 'update|u' => 'Skip any chosen locales that are already installed', ],
- [ 'jobs|j=i' => 'Maximum number of localedef(1) instances to run in parallel' ],
- [ 'prefix|p=s' => 'The prefix of the root filesystem' ],
- [ 'quiet|q' => 'Only show errors' ],
- [ 'version|V' => 'Output version information and exit' ],
- [ 'help|h' => 'Display this help and exit' ]
- );
-
- # Parse the provided arguments.
- my $parser = Getopt::Long::Parser->new;
- $parser->configure(qw(posix_default bundling_values no_ignore_case));
- my %opt;
- {
- # Decorate option validation errors while also not permitting
- # for more than one to be reported.
- local $SIG{'__WARN__'} = sub ($error) { die "$PROGRAM: $error" };
- $parser->getoptionsfromarray(\@args, \%opt, map +( $_->[0] ), @options);
- }
-
- # If either --help or --version was specified, exclusively attend to it.
- if ($opt{'help'}) {
- show_usage(@options);
- exit;
- } elsif ($opt{'version'}) {
- show_version();
- exit;
- }
-
- # Validate the options and option-arguments.
- if ($opt{'all'} && exists $opt{'config'}) {
- die "$PROGRAM: The --all and --config options are mutually exclusive\n";
- } elsif (exists $opt{'prefix'} && length $known_prefix && ! is_eq_file($known_prefix, $opt{'prefix'})) {
- die "$PROGRAM: The --prefix option specifies a path contrary to a detected Gentoo Prefix\n";
- }
-
- # Assign values for unspecified options that need them.
- if (! exists $opt{'jobs'} || $opt{'jobs'} < 1) {
- $opt{'jobs'} = get_nprocs() || 1;
- }
- if ($opt{'all'}) {
- $opt{'config'} = catfile($opt{'prefix'} // $known_prefix, '/usr/share/i18n', 'SUPPORTED');
- } elsif (exists $opt{'config'} && $opt{'config'} eq '-') {
- $opt{'config'} = '/dev/stdin';
- }
-
- return %opt;
-}
+ ${HILITE}Options:${NORMAL}
+ ${GOOD}-k, --keep${NORMAL} Don't nuke existing locales
+ ${GOOD}-d, --destdir <dir>${NORMAL} Use locale data in specified DESTDIR tree
+ ${GOOD}-c, --config <config>${NORMAL} Use specified config instead of default locale.gen
+ ${GOOD}-l, --list${NORMAL} List all the locales to be generated
+ ${GOOD}-a, --ask${NORMAL} Ask before generating each locale
+ ${GOOD}-A, --all${NORMAL} Pretend the locale list contains all locales
+ ${GOOD}-u, --update${NORMAL} Only generate locales that are missing
+ ${GOOD}-G, --generate <locale>${NORMAL} Generate specified locale (one shot; implies -k -u)
+ ${GOOD}-j, --jobs <num>${NORMAL} Number of locales to generate at a time (parallel)
+ ${GOOD}-q, --quiet${NORMAL} Only show errors
+ ${GOOD}-V, --version${NORMAL} Meaningless version information
+ ${GOOD}-h, --help${NORMAL} Show this help cruft
-sub show_usage (@options) {
- print "Usage: locale-gen [OPTION]...\n\n";
- my $pipe;
- if (! open $pipe, "| column -t -s \037") {
- exit 1;
- }
- for my $row (@options) {
- my ($spec, $description) = $row->@*;
- my ($long, $short) = split /[|=]/, $spec;
- printf {$pipe} "-%s, --%s\037%s\n", $short, $long, $description;
- }
-}
+ ${HILITE}Localedef Options:${NORMAL}
+ By default, ${GOOD}${LOCALEDEF_OPTS}${NORMAL} is passed to localedef.
-sub show_version () {
- print <<~EOF;
- locale-gen $VERSION
- Copyright 2024 Kerin Millar <kfm\@plushkava.net>
- License GPL-2.0-only <https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html>
+ For more info, see the ${HILITE}locale-gen${NORMAL}(1) and ${HILITE}locale.gen${NORMAL}(8) manpages.
EOF
+ [[ $# -eq 0 ]] && exit 0
+ echo ""
+ eerror "Unknown option '$1'"
+ exit 1
}
-sub list_locales ($prefix) {
- if (! defined(my $pid = open my $pipe, '-|')) {
- die "Can't fork: $!";
- } elsif ($pid == 0) {
- run_localedef($prefix, '--list-archive');
- } else {
- chomp(my @locales = readline $pipe);
- if (-1 == waitpid($pid, 0) || $? != 0) {
- die "$PROGRAM: Can't obtain a list of the presently installed locales\n";
- }
- return @locales;
- }
-}
-
-sub normalize ($canonical) {
- if (2 == (my ($locale, $charmap) = split /\./, $canonical, 3)) {
- # en_US.UTF-8 => en_US.utf8; en_US.ISO-8859-1 => en_US.iso88591
- return join '.', $locale, lc($charmap =~ s/-//gr);
- } else {
- die "Can't normalize " . render_printable($canonical);
- }
-}
-
-sub read_config ($prefix, @paths) {
- # Compose a dictionary of locale names known to be valid.
- my %locale_by = map +( $_ => 1 ), get_valid_locales($prefix);
-
- # Compose a dictionary of character maps known to be valid.
- my %charmap_by = map +( $_ => 1 ), get_valid_charmaps($prefix);
-
- # Iterate over the given paths and return the first non-empty list of
- # valid locale declarations that can be found among them, if any.
- for my $i (keys @paths) {
- my $path = $paths[$i];
- try {
- my $fh = fopen($path);
- $! = 0;
- if (my @locales = parse_config($fh, $path, \%locale_by, \%charmap_by)) {
- return @locales;
- }
- } catch ($e) {
- # Disregard open errors concerning non-existent files
- # unless there are no more paths to be tried. Validation
- # errors shall also be propagated here.
- if ($! != ENOENT || $i == $#paths) {
- die $e;
- }
- }
- }
-
- # For no locales to have been discovered at this point is exceptional.
- my $path_list = render_printable(scalar @paths == 1 ? $paths[0] : \@paths);
- die "$PROGRAM: No locale declarations were found within $path_list\n";
-}
-
-sub get_valid_locales ($prefix) {
- my $top = local $ENV{'TOP'} = catdir($prefix, '/usr/share/i18n/locales');
- my @paths = qx{ cd -- "\$TOP" && find . ! -path . -prune ! -path '*\n*' -type f -exec grep -lxF LC_IDENTIFICATION {} + };
- if ($? != 0 || ! @paths) {
- die "$PROGRAM: Failed to compose a list of valid locale names from '$top'\n";
- }
- chomp @paths;
- return map +( (splitpath($_))[-1] ), @paths;
-}
-
-sub get_valid_charmaps ($prefix) {
- my $top = catdir($prefix, '/usr/share/i18n/charmaps');
- if (! opendir my $dh, $top) {
- die "$PROGRAM: Can't open '$top' for reading: $!\n";
- } elsif (! (my @names = map +( -f "$top/$_" ? s/\.gz\z//r : () ), readdir $dh)) {
- die "$PROGRAM: Failed to compose a list of valid character maps from '$top'\n";
- } else {
- return @names;
- }
-}
-
-sub parse_config ($fh, $path, $locale_by, $charmap_by) {
- # Set up a helper routine to throw for validation errors.
- my $thrower = sub ($error, $line) {
- die sprintf "%s: %s at %s[%d]: %s\n",
- $PROGRAM, $error, $path, $., render_printable($line);
- };
-
- my @locales;
- while (my $line = readline $fh) {
- # Skip comments and blank lines. Note that \h will match only " " and
- # "\t", since the input stream is not being subjected to any decoding.
- next if $line =~ m/^\h*($|#)/;
-
- # Expect for two fields, separated by horizontal whitespace.
- my @fields;
- chomp $line;
- if (2 != (@fields = split /\h+/, trim_line($line), 3)) {
- $thrower->('Malformed locale declaration', $line);
- }
-
- # Extract the specified locale and character map. Upon success,
- # a canonicalised representation of the locale is also returned.
- my ($locale, $charmap, $canonical) = parse_entry(@fields);
-
- # Validate both locale and character map before accepting.
- if (! $locale_by->{$locale}) {
- $thrower->('Invalid locale', $line);
- } elsif (! $charmap_by->{$charmap}) {
- $thrower->('Invalid/mismatching charmap', $line);
- } else {
- push @locales, [ $locale, $charmap, $canonical ];
- }
- }
-
- return @locales;
-}
-
-sub parse_entry ($locale, $charmap) {
- my $canonical;
- if (2 == (my @fields = split /@/, $locale, 3)) {
- # de_DE@euro ISO-8859-15 => de_DE.ISO-8859-15@euro
- $canonical = sprintf '%s.%s@%s', $fields[0], $charmap, $fields[1];
- } elsif (2 == (@fields = split /\./, $locale, 3)) {
- # en_US.UTF-8 UTF-8 => en_US.UTF-8
- $locale = $fields[0];
- $canonical = "$locale.$charmap";
- if ($fields[1] ne $charmap) {
- $charmap = '';
- }
- } elsif (1 == @fields) {
- # en_US ISO-8859-1 => en_US.ISO-8859-1
- $canonical = "$locale.$charmap";
- }
- return $locale, $charmap, $canonical;
-}
-
-sub enter_tempdir ($prefix) {
- # Given that /tmp might be a tmpfs, prefer /var/tmp so as to avoid
- # undue memory pressure.
- my $dir = catdir($prefix, '/var/tmp');
- if (! -d $dir) {
- $dir = File::Spec->tmpdir;
- }
- $TEMPDIR = tempdir('locale-gen.XXXXXXXXXX', 'DIR' => $dir);
- if (! chdir $TEMPDIR) {
- die "$PROGRAM: Can't chdir to '$TEMPDIR': $!\n";
- }
+show_version() {
+ echo "locale-gen-2.xxx"
+ exit 0
}
-sub generate_locales ($prefix, $workers, @locales) {
- # Trap SIGINT and SIGTERM so that they may be handled gracefully.
- my $handler = sub ($signal) { $DEFERRED_SIGNAL ||= $signal };
- local @SIG{'INT', 'TERM'} = ($handler, $handler);
-
- my $total = scalar @locales;
- printf "Compiling %d locale definition file%s with %d worker%s ...\n",
- $total, plural($total), $workers, plural($workers);
-
- my $num_width = length $total;
- my %status_by;
- for my $i (keys @locales) {
- # Ensure that the number of concurrent workers is bounded.
- if ($i >= $workers) {
- my $pid = wait;
- last if 0 != ($status_by{$pid} = $?);
- }
-
- my ($locale, $charmap, $canonical) = $locales[$i]->@*;
- printf "[%*d/%d] Compiling locale: %s\n",
- $num_width, $i + 1, $total, $canonical;
-
- # Fork and execute localedef(1) for locale compilation.
- if (! defined(my $pid = fork)) {
- warn "Can't fork: $!";
- last;
- } elsif ($pid == 0) {
- @SIG{'INT', 'TERM'} = ('DEFAULT', 'DEFAULT');
- compile_locale($locale, $charmap, $canonical);
- }
- } continue {
- last if $DEFERRED_SIGNAL;
- }
-
- # Reap any subprocesses that remain.
- if ($workers > 1) {
- print "Waiting for active workers to finish their jobs ...\n";
- }
- while (-1 != (my $pid = wait)) {
- $status_by{$pid} = $?;
- }
-
- # Abort if any of the collected status codes are found to be non-zero.
- # In the case that one subprocess was interrupted by a signal while
- # another exited non-zero, the resulting diagnostic shall allude to the
- # signal. Such determinism is achieved by sorting the values.
- for my $status (sort { $a <=> $b } values %status_by) {
- throw_child_error('localedef', $status);
- }
-
- if ($DEFERRED_SIGNAL) {
- # The signal shall be propagated by the END block.
- exit;
- } elsif (scalar %status_by != $total) {
- die "$PROGRAM: Aborting because not all of the selected locales were compiled\n";
- }
-}
-
-sub compile_locale ($locale, $charmap, $canonical) {
- my $output_dir = "./$canonical";
- my @args = ('--no-archive', '-i', $locale, '-f', $charmap, '--', $output_dir);
- run_localedef(undef, @args);
-}
-
-sub generate_archive ($prefix, $locale_dir, $do_update, @canonicals) {
- # Create the temporary subdir that will contain the new locale archive.
- my $output_dir = catdir('.', $prefix, $locale_dir);
- run('mkdir', '-p', '--', $output_dir);
-
- # Determine the eventual destination path of the archive.
- my $final_path = catfile($prefix, $locale_dir, 'locale-archive');
- printf "The location of the archive shall be %s.\n", render_printable($final_path);
-
- # If --update was specified, make a copy of the existing archive.
- if ($do_update && -e $final_path) {
- run('cp', '--', $final_path, "$output_dir/");
- }
-
- # Integrate all of the compiled locales into the new locale archive.
- my $total = scalar @canonicals;
- printf "Adding %d locale%s to the locale archive ...\n", $total, plural($total);
- my $stderr = fopen('stderr.log', '+>');
- redirect_stderr($stderr, sub {
- my @args = ('--quiet', '--add-to-archive', '--replace', '--', @canonicals);
- run_localedef('.', @args);
- });
-
- # Propagate the diagnostics and errors raised by localedef(1), if any.
- seek $stderr, 0, SEEK_SET;
- my $i = 0;
- while (my $line = readline $stderr) {
- warn $line;
- ++$i;
- }
- close $stderr;
-
- # Check the status code first.
- throw_child_error('localedef');
-
- # Sadly, the exit status of GNU localedef(1) is nigh on useless in the
- # case that the --add-to-archive option is provided. If anything was
- # printed to STDERR at all, act as if the utility had exited 1.
- if ($i > 0) {
- throw_child_error('localedef', 1 << 8);
- }
-
- # The process of replacing the old archive must not be interrupted.
- local @SIG{'INT', 'TERM'} = ('IGNORE', 'IGNORE');
-
- # Move the newly minted archive into the appropriate filesystem. Use
- # mv(1), since there is a chance of crossing a filesystem boundary.
- my $interim_path = "$final_path.$$";
- run('mv', '--', catfile($output_dir, 'locale-archive'), $interim_path);
-
- # Atomically replace the old archive.
- if (! rename $interim_path, $final_path) {
- {
- local $!;
- unlink $interim_path;
- }
- die "$PROGRAM: Can't rename '$interim_path' to '$final_path': $!\n";
- }
-}
-
-sub run_localedef ($prefix, @args) {
- # Incorporate the --prefix option, if requested.
- if (length $prefix) {
- unshift @args, '--prefix', $prefix;
- }
-
- # Prevent the --verbose option from being potentially implied.
- delete local $ENV{'POSIXLY_CORRECT'};
-
- # Execute localedef(1). Don't fork if doing so from a child process.
- my @cmd = ('localedef', @args);
- if ($$ == $PID) {
- system @cmd;
- } elsif (! exec @cmd) {
- exit 1;
- }
-}
-
-sub fopen ($path, $mode = '<') {
- if (! open my $fh, $mode, $path) {
- die "$PROGRAM: Can't open '$path': $!\n";
- } elsif (! -f $fh && canonpath($path) !~ m/^\/dev\/(null|stdin)\z/) {
- die "$PROGRAM: Won't open '$path' because it is not a regular file\n";
- } else {
- return $fh;
- }
-}
-
-sub get_nprocs () {
- chomp(my $nproc = qx{ { nproc || getconf _NPROCESSORS_CONF; } 2>/dev/null });
- return $nproc;
-}
-
-sub is_eq_file ($path1, $path2) {
- # The -ef primary is standard as of POSIX.1-2024.
- local @ENV{'PATH1', 'PATH2'} = ($path1, $path2);
- return 0 == system q{ test "$PATH1" -ef "$PATH2" };
-}
-
-sub plural ($int) {
- return $int == 1 ? '' : 's';
-}
+LOCALEDEF_OPTS=""
+KEEP=""
+DESTDIR=""
+CONFIG=""
+JUST_LIST=""
+ASK=""
+ALL=""
+UPDATE=""
+GENERATE=""
+JOBS_MAX=""
+QUIET=0
+SET_X=""
+LOCALE_ARCHIVE=true
+INPLACE_GLIBC=""
+while [[ $# -gt 0 ]] ; do
+ case $1 in
+ --inplace-glibc) INPLACE_GLIBC=$1;;
+ -k|--keep|--keep-existing) KEEP=$1;;
+ -d|--destdir) shift; DESTDIR=$1; unset ROOT;;
+ -c|--config) shift; CONFIG=$1;;
+ -l|--list) JUST_LIST=$1;;
+ -a|--ask) ASK=$1;;
+ -A|--all) ALL=$1;;
+ -u|--update) UPDATE=$1;;
+ -G|--generate) shift; GENERATE=$1;;
+ -j|--jobs) shift; JOBS_MAX=$(( $1 ));;
+ -j*) : $(( JOBS_MAX = ${1#-j} ));;
+ -q|--quiet) : $(( ++QUIET ));;
+ -x|--debug) SET_X="true";;
+ -V|--version) show_version;;
+ -h|--help) show_usage;;
+ --) shift; LOCALEDEF_OPTS=$*; break;;
+ *) show_usage $1;;
+ esac
+ shift
+done
+
+if [[ -n ${COMPILED_LOCALES} ]] ; then
+ ewarn "All locales have been installed and registered by the package manager. If you"
+ ewarn "rebuild the locale archive now, file integrity tools may show it as corrupted."
+ ewarn "This is not really a big problem, but a better solution is to disable"
+ ewarn "USE=compile-locales and re-install glibc if you dont need all locales."
+ echo
+fi
+
+if [[ -z ${JOBS_MAX} ]] ; then
+ JOBS_MAX=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
+ : "${JOBS_MAX:=1}"
+fi
+[[ ${JOBS_MAX} -lt 1 ]] && JOBS_MAX=1
+[[ -n ${SET_X} ]] && set -x
+: "${KEEP:=${JUST_LIST}}"
+[[ -n ${GENERATE} ]] && UPDATE="true" && KEEP="true"
+
+: "${ROOT:=/}"
+ROOT="${ROOT%/}/"
+
+if [[ ${ROOT} != "/" ]] ; then
+ eerror "Sorry, but ROOT is not supported."
+ exit 0
+fi
+
+: "${EROOT:=${EPREFIX}/}"
+if [[ ${EROOT} != "/" ]] ; then
+ einfo "Using locale.gen from ${EROOT%/}/etc/"
+fi
+
+if [[ -n ${DESTDIR} ]] ; then
+ DESTDIR="${DESTDIR%/}/"
+ einfo "Building locales in DESTDIR '${DESTDIR}'"
+else
+ DESTDIR="${EROOT%/}/"
+fi
+
+: "${CONFIG:=${EROOT%/}/etc/locale.gen}"
+LOCALES=${DESTDIR}usr/share/i18n/locales
+CHARMAPS=${DESTDIR}usr/share/i18n/charmaps
+SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED
+ALIAS=${DESTDIR}usr/share/locale/locale.alias
-sub redirect_stderr ($stderr, $callback) {
- if (! open my $old_stderr, '>&', *STDERR) {
- die "Can't dup STDERR to a new file descriptor: $!";
- } elsif (! open *STDERR, '>&', $stderr) {
- my $fileno = fileno $stderr;
- die "Can't dup file descriptor #$fileno to STDERR: $!";
- } else {
- $callback->();
- open *STDERR, '>&=', $old_stderr;
- }
-}
-
-sub render_printable ($value) {
- my $coder = JSON::PP->new->ascii->space_after;
- return $coder->encode($value);
-}
-
-sub run ($cmd, @args) {
- system $cmd, @args;
- throw_child_error($cmd);
-}
-
-sub throw_child_error ($cmd, $status = $?) {
- if ($status == -1) {
- # The program could not be started. Since Perl will already
- # have printed a warning, no supplemental diagnostic is needed.
- exit 1;
- } elsif ($status != 0) {
- my $printable_cmd = render_printable($cmd);
- my $fate = ($status & 0x7F) ? 'interrupted by a signal' : 'unsuccessful';
- die "$PROGRAM: Aborting because the execution of $printable_cmd was $fate\n";
- }
+#
+# Grab any user options in their config file
+options=$(sed -n \
+ -e '/^[[:space:]]*#%/s:^[[:space:]]*#%[[:space:]]*::p'\
+ "${CONFIG}" 2>/dev/null
+)
+IFS=$'\n'
+for option in ${options} ; do
+ case ${option} in
+ no-locale-archive)
+ LOCALE_ARCHIVE=false
+ ;;
+ *)
+ ewarn "Unrecognized option '${option}'"
+ ;;
+ esac
+done
+unset IFS
+
+[[ -n ${ALL} ]] && CONFIG=${SUPPORTED}
+
+# Extract the location of the locale dir on the fly as `localedef --help` has:
+# locale path : /usr/lib64/locale:/usr/share/i18n
+# For long paths, the line may get wrapped into two, in which case space (' ') is replaced
+# by newline (\n).
+LOCALEDIR=$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -r '/locale path/{N;s|.*:[ \n](.*):/.*|\1|;p}')
+LOCALEDIR="${DESTDIR}${LOCALEDIR#${EPREFIX}}"
+if [[ $? -ne 0 ]] || [[ -z ${LOCALEDIR} ]] || [[ ${LOCALEDIR} != ${DESTDIR}/usr/lib*/locale ]] ; then
+ eerror "Unable to parse the output of your localedef utility." 1>&2
+ eerror "File a bug about this issue and include the output of 'localedef --help'." 1>&2
+ exit 1
+fi
+
+# Only generate locales the user specified before falling back to the config.
+locales_to_generate=${GENERATE}
+
+if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
+ locales_to_generate=$(sed \
+ -e 's:#.*::' \
+ -e '/^[[:space:]]*$/d' \
+ "${CONFIG}" | sort)
+ # Sanity check to make sure people did not duplicate entries. #550884
+ # The first column must be unique specifically. #235555
+ dup_locales_to_generate=$(
+ echo "${locales_to_generate}" | \
+ awk '{ if ($1 == last) { print lastline; print; } else { lastline = $0; last = $1; } }')
+ if [[ -n ${dup_locales_to_generate} ]] ; then
+ ewarn "These locales have been duplicated in your config:\n${dup_locales_to_generate}"
+ ewarn "Some might be filtered, but you must fix it."
+ locales_to_generate=$(echo "${locales_to_generate}" | uniq)
+ fi
+fi
+
+# Transform the name in locales.gen to the name used when storing the locale data in
+# /usr/lib/locale/. This normalize algo is taken out of the glibc localedef source:
+# https://sourceware.org/git/?p=glibc.git;a=blob;f=locale/programs/localedef.c;hb=glibc-2.34#l562
+normalize() {
+ if [[ $1 == *.* ]] ; then
+ local ret=${1##*.}
+ ret=${ret,,}
+ echo "${1%%.*}.${ret//-}"
+ else
+ echo "$1"
+ fi
}
-sub trim_line ($line) {
- return $line =~ s/^\h+|\h+$//gr;
+# These funky sed's are based on the stuff in glibc's localedata/Makefile
+# Basically we want to rewrite the display like so:
+# <locale without a . or @>.<charmap>[@extra stuff after the @ in the locale]
+# en_US ISO-8859-1 -> en_US.ISO-8859-1
+# en_US.UTF-8 UTF-8 -> en_US.UTF-8
+# de_DE@euro ISO-8859-15 -> de_DE.ISO-8859-15@euro
+locales_disp=$(echo "${locales_to_generate}" | sed \
+ -e ' /@/ s:[[:space:]]*\([^@[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3\2:' \
+ -e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
+
+# Now check the normalized version for C.UTF-8, and add it if not present
+if [[ -z ${locales_to_generate} ]] ; then
+ if [[ -z ${JUST_LIST} ]] ; then
+ [[ ${QUIET} -eq 0 ]] && \
+ ewarn "No locales to generate found, keeping archive but ensuring C.UTF-8 is present"
+ KEEP=1
+ UPDATE=1
+ locales_disp='C.UTF-8'
+ locales_to_generate='C.UTF-8 UTF-8'
+ fi
+else
+ if echo ${locales_disp} | grep -vqi 'C.UTF-8' ; then
+ locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
+ locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
+ fi
+fi
+
+mkdir -p "${LOCALEDIR}"
+if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
+ # Remove all old locale dir and locale-archive before generating new
+ # locale data. Scrubbing via update is done elsewhere.
+ rm -rf "${LOCALEDIR}"/* &> /dev/null || true
+fi
+
+eval declare -a locales_disp=(${locales_disp})
+eval declare -a locales_to_generate=(${locales_to_generate})
+total=$(( ${#locales_to_generate[*]} / 2 ))
+
+[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
+einfo "Generating ${total} locales (this might take a while) with ${JOBS_MAX} jobs"
+
+if [[ -n ${UPDATE} ]] ; then
+ # normalize newlines into spaces
+ existing_locales=" $(echo $(locale -a 2>/dev/null)) "
+fi
+
+generate_locale() {
+ local output=""
+
+ if [[ -z ${ASK} ]] && [[ ${QUIET} -eq 0 ]] ; then
+ output=" (${cnt_fmt}/${total}) Generating ${disp}"
+ fi
+
+ if [[ $(( JOB_IDX_E - JOB_IDX_S )) == ${JOBS_MAX} ]] ; then
+ wait ${JOB_PIDS[$(( JOB_IDX_S++ ))]}
+ JOB_RETS+=( $? )
+ fi
+ (
+ # Accumulate all the output in one go so the parallel
+ # jobs don't tromp on each other
+ x=$(
+ [[ -n ${output} ]] && ebegin "${output}"
+ # In most cases, localedef can just use the system glibc.
+ # However, if we are within a major glibc upgrade, this may fail
+ # in src_* phases since the new localedef links against the new
+ # glibc, but the new glibc is not installed yet...
+ if [[ -z ${INPLACE_GLIBC} ]] ; then
+ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
+ --no-archive \
+ -i "${input}" \
+ -f "${charmap}" \
+ -A "${ALIAS}" \
+ --prefix "${DESTDIR%${EPREFIX}/}/" \
+ "${locale}" 2>&1
+ else
+ # We assume that the current directory is "${ED}"/$(get_libdir),
+ # see the glibc ebuild, function glibc_sanity_check(), for why.
+ LC_ALL=C ./ld-*.so --library-path . \
+ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
+ --no-archive \
+ -i "${input}" \
+ -f "${charmap}" \
+ -A "${ALIAS}" \
+ --prefix "${DESTDIR%${EPREFIX}/}/" \
+ "${locale}" 2>&1
+ fi
+ ret=$?
+ [[ -n ${output} ]] && eend ${ret}
+ exit ${ret}
+ )
+ ret=$?
+ if [[ -n ${output} ]] ; then
+ echo "${x}"
+ elif [[ ${ret} -ne 0 ]] ; then
+ eerror "${disp}: ${x}"
+ fi
+
+ if [[ ${ret} -ne 0 && ${locale} == */* ]] ; then
+ ewarn "Perhaps you meant to use a space instead of a / in your config file ?"
+ fi
+ exit ${ret}
+ ) &
+ JOB_PIDS+=( $! )
+ : $(( ++JOB_IDX_E ))
}
-END {
- if ($$ == $PID) {
- if (length $TEMPDIR) {
- local $?;
- system 'rm', '-r', '--', $TEMPDIR;
- }
-
- # The default SIGINT and SIGTERM handlers are suppressed by
- # generate_locales. The former is especially important, per
- # http://www.cons.org/cracauer/sigint.html.
- if ($DEFERRED_SIGNAL) {
- kill $DEFERRED_SIGNAL, $$;
- }
- }
-}
+JOB_PIDS=()
+JOB_RETS=()
+JOB_IDX_S=0
+JOB_IDX_E=0
+cnt=0
+lidx=0
+# Keep track of (normalized) locales generated in case the request has different inputs that
+# normalize down to the same value. We trim $existing_locales as we go for later use which
+# prevents its direct use.
+generated_locales=" "
+while [[ -n ${locales_to_generate[${lidx}]} ]] ; do
+ : $(( ++cnt ))
+ locale=${locales_to_generate[$((lidx++))]}
+ charmap=${locales_to_generate[$((lidx++))]}
+
+ # XXX: if we wanted to, we could check existence of
+ # ${LOCALES}/${locale} and ${CHARMAPS}/${charmap}
+ # this would fail for things like "en_US.UTF8", but
+ # in that case we could fall back to checking the
+ # SUPPORTED file ... then again, the localedef
+ # below will abort nicely for us ...
+ if [[ -z ${locale} || -z ${charmap} ]] ; then
+ eerror "Bad entry in locale.gen: '${locale} ${charmap}'; skipping"
+ continue
+ fi
+
+ disp=${locales_disp[$(( cnt - 1 ))]}
+
+ normalized_locale=$(normalize ${locale})
+ if [[ ${generated_locales} == *" ${normalized_locale} "* ]] ; then
+ already_generated="true"
+ else
+ already_generated="false"
+ fi
+ generated_locales+="${normalized_locale} "
+ if ${already_generated} || \
+ [[ -n ${UPDATE} && ${existing_locales} == *" ${normalized_locale} "* ]] ; then
+ existing_locales=${existing_locales/ ${normalized_locale} / }
+ if [[ ${QUIET} -eq 0 ]] ; then
+ cnt_fmt=$(printf "%${#total}i" ${cnt})
+ einfo " (${cnt_fmt}/${total}) Skipping ${disp}"
+ fi
+ continue
+ fi
+
+ # If the locale is like 'en_US.UTF8', then we really want 'en_US'
+ if [[ -f ${LOCALES}/${locale} ]] ; then
+ input=${locale}
+ else
+ input=${locale%%.*}
+ fi
+
+ if [[ -z ${JUST_LIST} ]] ; then
+ # Format the output for the question/status
+ cnt_fmt=$(printf "%${#total}i" ${cnt})
+ if [[ -n ${ASK} ]] ; then
+ einfon " (${cnt_fmt}/${total}) Generate ${disp} ? (Y/n) "
+ read user_answer
+ [[ ${user_answer} == [nN]* ]] && continue
+ fi
+ generate_locale
+ else
+ echo "${disp}"
+ fi
+done
+
+for (( i = JOB_IDX_S; i < JOB_IDX_E; ++i )) ; do
+ wait ${JOB_PIDS[i]}
+ JOB_RETS+=( $? )
+done
+ret=$(( 0 ${JOB_RETS[@]/#/+} ))
+
+[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
+einfo "Generation complete"
+
+if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
+ # need to check that at least one locale has to be added
+ if [[ $(echo "${LOCALEDIR}"/*/) != "${LOCALEDIR}"'/*/' ]] ; then
+ [[ ${QUIET} -eq 0 ]] && ebegin "Adding locales to archive"
+ # The pattern ends with / on purpose: we don't care about files (like
+ # locale-archive) in the locale subdir, and we definitely don't want to
+ # delete them!
+ for LOC in "${LOCALEDIR}"/*/; do
+ LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
+ x=$(
+ # In most cases, localedef can just use the system glibc.
+ # However, if we are within a major glibc upgrade, this may fail
+ # in src_* phases since the new localedef links against the new
+ # glibc, but the new glibc is not installed yet...
+ if [[ -z ${INPLACE_GLIBC} ]] ; then
+ "${DESTDIR}"usr/bin/localedef \
+ --add-to-archive "${LOC}" \
+ --replace \
+ --prefix "${DESTDIR%${EPREFIX}/}/"
+ else
+ # We assume that the current directory is "${ED}"/$(get_libdir),
+ # see the glibc ebuild, function glibc_sanity_check(), for why.
+ LC_ALL=C ./ld-*.so --library-path . \
+ "${DESTDIR}"usr/bin/localedef \
+ --add-to-archive "${LOC}" \
+ --replace \
+ --prefix "${DESTDIR%${EPREFIX}/}/"
+ fi
+ ret=$?
+ if [[ -n ${output} ]] ; then
+ echo "${x}"
+ elif [[ ${ret} -ne 0 ]] ; then
+ eerror "${disp}: ${x}"
+ fi
+ if [[ $ret -eq 0 ]]; then
+ rm -r "${LOC}"
+ fi
+ exit ${ret}
+ )
+ done
+ [[ ${QUIET} -eq 0 ]] && eend ${ret}
+ elif [[ ${QUIET} -eq 0 ]] ; then
+ einfo "No locales are to be added to the archive."
+ fi
+fi
+
+# Remove locales that existed but were not requested
+if [[ -n ${UPDATE} ]] && [[ -z ${JUST_LIST} ]] ; then
+ # Ignore these pseudo locales
+ existing_locales=${existing_locales/ C / }
+ existing_locales=${existing_locales/ POSIX / }
+ if [[ -n ${existing_locales// } ]] ; then
+ if [[ -z ${KEEP} ]] ; then
+ [[ ${QUIET} -eq 0 ]] && einfo "Scrubbing old locales:"${existing_locales}
+ cd "${LOCALEDIR}" && rm -rf ${existing_locales}
+ else
+ [[ ${QUIET} -eq 0 ]] && einfo "Keeping old locales:"${existing_locales}
+ fi
+ fi
+fi
+
+exit ${ret}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2025-07-01 21:02 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2025-07-01 21:02 UTC (permalink / raw
To: gentoo-commits
commit: e9a590ba0804d0ade9fe842076ab66b7057b8c36
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Jul 1 21:00:37 2025 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 1 21:00:37 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=e9a590ba
Initial commit of Perl-based locale-gen
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 984 ++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 557 insertions(+), 427 deletions(-)
diff --git a/locale-gen b/locale-gen
index d0e109e..c2e622a 100755
--- a/locale-gen
+++ b/locale-gen
@@ -1,451 +1,581 @@
-#!/bin/bash
+#!/usr/bin/perl
+# locale-gen
#
-# Based upon Debian's locale-gen, fetched from glibc_2.3.6-7.diff.gz, but completely rewritten.
-#
+# Generates a glibc locale archive from templates, potentially limiting itself
+# to a set of locales defined by the admin, typically within /etc/locale.gen.
+
+use v5.36;
+
+use Errno qw(ENOENT);
+use Fcntl qw(SEEK_SET);
+use File::Spec::Functions qw(canonpath catfile catdir splitpath);
+use File::Temp qw(tempdir);
+use Getopt::Long ();
+use JSON::PP ();
+use POSIX qw(LC_ALL setlocale);
-# NB: Bash-4.0+ required. We use += and ${var,,} features.
+# Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
+use experimental qw(try);
-unset POSIXLY_CORRECT IFS
-umask 0022
+# Determine the basename of the presently compiling script.
+my $PROGRAM;
+BEGIN { $PROGRAM = (splitpath(__FILE__))[-1]; }
-argv0=${0##*/}
+my $VERSION = '3.0';
-EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
-if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
- EPREFIX=""
-fi
+my $DEFERRED_SIGNAL = '';
+my $PID = $$;
+my $TEMPDIR;
-FUNCTIONS_SH="/lib/gentoo/functions.sh"
-source "${EPREFIX}"${FUNCTIONS_SH} || {
- echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2
- exit 1
+# For the C locale to be in effect can be a consequence of the user's chosen
+# locale not yet being available. That being the case, unset all environment
+# variables pertaining to locale handling for the benefit of any subprocesses.
+if (setlocale(LC_ALL) eq 'C') {
+ delete @ENV{ grep +( m/^(LANG\z|LC_)/ ), keys %ENV };
}
-COMPILED_LOCALES=""
+# Unset BASH_ENV for security reasons. Even as sh(1), bash acts upon it. Unset
+# CDPATH also, for it is nothing but a liability in a non-interactive context.
+delete @ENV{'BASH_ENV', 'CDPATH'};
+
+{
+ # Determine the locale directory, as reported by localedef(1).
+ my $locale_dir = get_locale_dir();
+
+ # Infer the path of a Gentoo Prefix environment, if any.
+ my $gentoo_prefix = detect_gentoo_prefix($locale_dir);
+ if (length $gentoo_prefix) {
+ $locale_dir =~ s/^\Q$gentoo_prefix//;
+ }
+
+ # Collect any supported options and option-arguments.
+ my %opt = parse_opts($gentoo_prefix, @ARGV);
+ my $prefix = $opt{'prefix'} // $gentoo_prefix;
+
+ # A proxy check is justified because compilation may take a long time.
+ my $archive_dir = catdir($prefix, $locale_dir);
+ if (! utime undef, undef, $archive_dir) {
+ die "$PROGRAM: Aborting because UID $> can't modify '$archive_dir': $!\n";
+ }
+
+ # Honour the --quiet option.
+ if ($opt{'quiet'} && ! open *STDOUT, '>/dev/null') {
+ die "Can't direct STDOUT to /dev/null: $!";
+ }
+
+ # Ensure that the C.UTF-8 locale is made available.
+ my @locales = ([ 'C', 'UTF-8', 'C.UTF-8' ]);
+
+ # Compose a list of up to two configuration files to be read.
+ my @config_files;
+ if (exists $opt{'config'}) {
+ push @config_files, $opt{'config'};
+ } else {
+ push @config_files, (
+ catfile($prefix, '/etc', 'locale.gen'),
+ catfile($prefix, '/usr/share/i18n', 'SUPPORTED')
+ );
+ }
+
+ # Collect the locales that are being requested for installation.
+ push @locales, read_config($prefix, @config_files);
+
+ # Compose a dictionary of installed locales for the --update option.
+ my %installed_by;
+ if ($opt{'update'}) {
+ # If localedef(1) originates from a Gentoo Prefix environment,
+ # the prefix will already have been hard-coded by the utility.
+ my $explicit_prefix = length $gentoo_prefix ? undef : $prefix;
+ %installed_by = map +( $_ => 1 ), list_locales($explicit_prefix);
+ }
+
+ # Filter out locales that are duplicates or that are already installed.
+ my %requested_by;
+ my $i = 0;
+ while ($i <= $#locales) {
+ my $canonical = $locales[$i][2];
+ my $normal = normalize($canonical);
+ if ($requested_by{$normal}++ || $installed_by{$normal}) {
+ splice @locales, $i, 1;
+ } else {
+ ++$i;
+ }
+ }
+
+ # If a non-actionable update was requested, proceed no further.
+ if (! @locales) {
+ print "All of the requested locales are presently installed.\n";
+ exit 0;
+ }
+
+ # Create a temporary directory and switch to it.
+ enter_tempdir($prefix);
+
+ # Compile the selected locales.
+ generate_locales($prefix, $opt{'jobs'}, @locales);
+
+ # Integrate the newly compiled locales into the system's locale archive.
+ generate_archive($prefix, $locale_dir, $opt{'update'}, map +( $_->[2] ), @locales);
+
+ my $total = scalar @locales;
+ printf "Successfully installed %d locale%s.\n", $total, plural($total);
+}
-show_usage() {
- cat <<-EOF
- Usage: ${HILITE}${argv0}${NORMAL} ${GOOD}[options]${NORMAL} -- ${GOOD}[localedef options]${NORMAL}
+sub get_locale_dir () {
+ my $stdout = qx{ localedef --help };
+ if ($? == 0 && $stdout =~ m/\hlocale path\h*:\s+(\/[^:]+)/) {
+ return canonpath($1);
+ } else {
+ die "Can't parse locale directory from localedef(1) output: $!";
+ }
+}
- Generate locales based upon the config file /etc/locale.gen.
+sub detect_gentoo_prefix ($path) {
+ if ($path !~ s/\/usr\/lib\/locale\z//) {
+ die "Can't handle unexpected locale directory of '$path'";
+ } elsif (length $path && -e "$path/etc/gentoo-release") {
+ return $path;
+ } else {
+ return '';
+ }
+}
- ${HILITE}Options:${NORMAL}
- ${GOOD}-k, --keep${NORMAL} Don't nuke existing locales
- ${GOOD}-d, --destdir <dir>${NORMAL} Use locale data in specified DESTDIR tree
- ${GOOD}-c, --config <config>${NORMAL} Use specified config instead of default locale.gen
- ${GOOD}-l, --list${NORMAL} List all the locales to be generated
- ${GOOD}-a, --ask${NORMAL} Ask before generating each locale
- ${GOOD}-A, --all${NORMAL} Pretend the locale list contains all locales
- ${GOOD}-u, --update${NORMAL} Only generate locales that are missing
- ${GOOD}-G, --generate <locale>${NORMAL} Generate specified locale (one shot; implies -k -u)
- ${GOOD}-j, --jobs <num>${NORMAL} Number of locales to generate at a time (parallel)
- ${GOOD}-q, --quiet${NORMAL} Only show errors
- ${GOOD}-V, --version${NORMAL} Meaningless version information
- ${GOOD}-h, --help${NORMAL} Show this help cruft
+sub parse_opts ($known_prefix, @args) {
+ my @options = (
+ [ 'config|c=s' => "The file containing the chosen locales (default: $known_prefix/etc/locale.gen)" ],
+ [ 'all|A' => 'Select all locales, ignoring the config file' ],
+ [ 'update|u' => 'Skip any chosen locales that are already installed', ],
+ [ 'jobs|j=i' => 'Maximum number of localedef(1) instances to run in parallel' ],
+ [ 'prefix|p=s' => 'The prefix of the root filesystem' ],
+ [ 'quiet|q' => 'Only show errors' ],
+ [ 'version|V' => 'Output version information and exit' ],
+ [ 'help|h' => 'Display this help and exit' ]
+ );
+
+ # Parse the provided arguments.
+ my $parser = Getopt::Long::Parser->new;
+ $parser->configure(qw(posix_default bundling_values no_ignore_case));
+ my %opt;
+ {
+ # Decorate option validation errors while also not permitting
+ # for more than one to be reported.
+ local $SIG{'__WARN__'} = sub ($error) { die "$PROGRAM: $error" };
+ $parser->getoptionsfromarray(\@args, \%opt, map +( $_->[0] ), @options);
+ }
+
+ # If either --help or --version was specified, exclusively attend to it.
+ if ($opt{'help'}) {
+ show_usage(@options);
+ exit;
+ } elsif ($opt{'version'}) {
+ show_version();
+ exit;
+ }
+
+ # Validate the options and option-arguments.
+ if ($opt{'all'} && exists $opt{'config'}) {
+ die "$PROGRAM: The --all and --config options are mutually exclusive\n";
+ } elsif (exists $opt{'prefix'} && length $known_prefix && ! is_eq_file($known_prefix, $opt{'prefix'})) {
+ die "$PROGRAM: The --prefix option specifies a path contrary to a detected Gentoo Prefix\n";
+ }
+
+ # Assign values for unspecified options that need them.
+ if (! exists $opt{'jobs'} || $opt{'jobs'} < 1) {
+ $opt{'jobs'} = get_nprocs() || 1;
+ }
+ if ($opt{'all'}) {
+ $opt{'config'} = catfile($opt{'prefix'} // $known_prefix, '/usr/share/i18n', 'SUPPORTED');
+ } elsif (exists $opt{'config'} && $opt{'config'} eq '-') {
+ $opt{'config'} = '/dev/stdin';
+ }
+
+ return %opt;
+}
- ${HILITE}Localedef Options:${NORMAL}
- By default, ${GOOD}${LOCALEDEF_OPTS}${NORMAL} is passed to localedef.
+sub show_usage (@options) {
+ print "Usage: locale-gen [OPTION]...\n\n";
+ my $pipe;
+ if (! open $pipe, "| column -t -s \037") {
+ exit 1;
+ }
+ for my $row (@options) {
+ my ($spec, $description) = $row->@*;
+ my ($long, $short) = split /[|=]/, $spec;
+ printf {$pipe} "-%s, --%s\037%s\n", $short, $long, $description;
+ }
+}
- For more info, see the ${HILITE}locale-gen${NORMAL}(1) and ${HILITE}locale.gen${NORMAL}(8) manpages.
+sub show_version () {
+ print <<~EOF;
+ locale-gen $VERSION
+ Copyright 2024 Kerin Millar <kfm\@plushkava.net>
+ License GPL-2.0-only <https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html>
EOF
- [[ $# -eq 0 ]] && exit 0
- echo ""
- eerror "Unknown option '$1'"
- exit 1
}
-show_version() {
- echo "locale-gen-2.xxx"
- exit 0
+sub list_locales ($prefix) {
+ if (! defined(my $pid = open my $pipe, '-|')) {
+ die "Can't fork: $!";
+ } elsif ($pid == 0) {
+ run_localedef($prefix, '--list-archive');
+ } else {
+ chomp(my @locales = readline $pipe);
+ if (-1 == waitpid($pid, 0) || $? != 0) {
+ die "$PROGRAM: Can't obtain a list of the presently installed locales\n";
+ }
+ return @locales;
+ }
}
-LOCALEDEF_OPTS=""
-KEEP=""
-DESTDIR=""
-CONFIG=""
-JUST_LIST=""
-ASK=""
-ALL=""
-UPDATE=""
-GENERATE=""
-JOBS_MAX=""
-QUIET=0
-SET_X=""
-LOCALE_ARCHIVE=true
-INPLACE_GLIBC=""
-while [[ $# -gt 0 ]] ; do
- case $1 in
- --inplace-glibc) INPLACE_GLIBC=$1;;
- -k|--keep|--keep-existing) KEEP=$1;;
- -d|--destdir) shift; DESTDIR=$1; unset ROOT;;
- -c|--config) shift; CONFIG=$1;;
- -l|--list) JUST_LIST=$1;;
- -a|--ask) ASK=$1;;
- -A|--all) ALL=$1;;
- -u|--update) UPDATE=$1;;
- -G|--generate) shift; GENERATE=$1;;
- -j|--jobs) shift; JOBS_MAX=$(( $1 ));;
- -j*) : $(( JOBS_MAX = ${1#-j} ));;
- -q|--quiet) : $(( ++QUIET ));;
- -x|--debug) SET_X="true";;
- -V|--version) show_version;;
- -h|--help) show_usage;;
- --) shift; LOCALEDEF_OPTS=$*; break;;
- *) show_usage $1;;
- esac
- shift
-done
-
-if [[ -n ${COMPILED_LOCALES} ]] ; then
- ewarn "All locales have been installed and registered by the package manager. If you"
- ewarn "rebuild the locale archive now, file integrity tools may show it as corrupted."
- ewarn "This is not really a big problem, but a better solution is to disable"
- ewarn "USE=compile-locales and re-install glibc if you dont need all locales."
- echo
-fi
-
-if [[ -z ${JOBS_MAX} ]] ; then
- JOBS_MAX=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
- : "${JOBS_MAX:=1}"
-fi
-[[ ${JOBS_MAX} -lt 1 ]] && JOBS_MAX=1
-[[ -n ${SET_X} ]] && set -x
-: "${KEEP:=${JUST_LIST}}"
-[[ -n ${GENERATE} ]] && UPDATE="true" && KEEP="true"
-
-: "${ROOT:=/}"
-ROOT="${ROOT%/}/"
-
-if [[ ${ROOT} != "/" ]] ; then
- eerror "Sorry, but ROOT is not supported."
- exit 0
-fi
-
-: "${EROOT:=${EPREFIX}/}"
-if [[ ${EROOT} != "/" ]] ; then
- einfo "Using locale.gen from ${EROOT%/}/etc/"
-fi
-
-if [[ -n ${DESTDIR} ]] ; then
- DESTDIR="${DESTDIR%/}/"
- einfo "Building locales in DESTDIR '${DESTDIR}'"
-else
- DESTDIR="${EROOT%/}/"
-fi
-
-: "${CONFIG:=${EROOT%/}/etc/locale.gen}"
-LOCALES=${DESTDIR}usr/share/i18n/locales
-CHARMAPS=${DESTDIR}usr/share/i18n/charmaps
-SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED
-ALIAS=${DESTDIR}usr/share/locale/locale.alias
+sub normalize ($canonical) {
+ if (2 == (my ($locale, $charmap) = split /\./, $canonical, 3)) {
+ # en_US.UTF-8 => en_US.utf8; en_US.ISO-8859-1 => en_US.iso88591
+ return join '.', $locale, lc($charmap =~ s/-//gr);
+ } else {
+ die "Can't normalize " . render_printable($canonical);
+ }
+}
-#
-# Grab any user options in their config file
-options=$(sed -n \
- -e '/^[[:space:]]*#%/s:^[[:space:]]*#%[[:space:]]*::p'\
- "${CONFIG}" 2>/dev/null
-)
-IFS=$'\n'
-for option in ${options} ; do
- case ${option} in
- no-locale-archive)
- LOCALE_ARCHIVE=false
- ;;
- *)
- ewarn "Unrecognized option '${option}'"
- ;;
- esac
-done
-unset IFS
-
-[[ -n ${ALL} ]] && CONFIG=${SUPPORTED}
-
-# Extract the location of the locale dir on the fly as `localedef --help` has:
-# locale path : /usr/lib64/locale:/usr/share/i18n
-# For long paths, the line may get wrapped into two, in which case space (' ') is replaced
-# by newline (\n).
-LOCALEDIR=$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -r '/locale path/{N;s|.*:[ \n](.*):/.*|\1|;p}')
-LOCALEDIR="${DESTDIR}${LOCALEDIR#${EPREFIX}}"
-if [[ $? -ne 0 ]] || [[ -z ${LOCALEDIR} ]] || [[ ${LOCALEDIR} != ${DESTDIR}/usr/lib*/locale ]] ; then
- eerror "Unable to parse the output of your localedef utility." 1>&2
- eerror "File a bug about this issue and include the output of 'localedef --help'." 1>&2
- exit 1
-fi
-
-# Only generate locales the user specified before falling back to the config.
-locales_to_generate=${GENERATE}
-
-if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
- locales_to_generate=$(sed \
- -e 's:#.*::' \
- -e '/^[[:space:]]*$/d' \
- "${CONFIG}" | sort)
- # Sanity check to make sure people did not duplicate entries. #550884
- # The first column must be unique specifically. #235555
- dup_locales_to_generate=$(
- echo "${locales_to_generate}" | \
- awk '{ if ($1 == last) { print lastline; print; } else { lastline = $0; last = $1; } }')
- if [[ -n ${dup_locales_to_generate} ]] ; then
- ewarn "These locales have been duplicated in your config:\n${dup_locales_to_generate}"
- ewarn "Some might be filtered, but you must fix it."
- locales_to_generate=$(echo "${locales_to_generate}" | uniq)
- fi
-fi
-
-# Transform the name in locales.gen to the name used when storing the locale data in
-# /usr/lib/locale/. This normalize algo is taken out of the glibc localedef source:
-# https://sourceware.org/git/?p=glibc.git;a=blob;f=locale/programs/localedef.c;hb=glibc-2.34#l562
-normalize() {
- if [[ $1 == *.* ]] ; then
- local ret=${1##*.}
- ret=${ret,,}
- echo "${1%%.*}.${ret//-}"
- else
- echo "$1"
- fi
+sub read_config ($prefix, @paths) {
+ # Compose a dictionary of locale names known to be valid.
+ my %locale_by = map +( $_ => 1 ), get_valid_locales($prefix);
+
+ # Compose a dictionary of character maps known to be valid.
+ my %charmap_by = map +( $_ => 1 ), get_valid_charmaps($prefix);
+
+ # Iterate over the given paths and return the first non-empty list of
+ # valid locale declarations that can be found among them, if any.
+ for my $i (keys @paths) {
+ my $path = $paths[$i];
+ try {
+ my $fh = fopen($path);
+ $! = 0;
+ if (my @locales = parse_config($fh, $path, \%locale_by, \%charmap_by)) {
+ return @locales;
+ }
+ } catch ($e) {
+ # Disregard open errors concerning non-existent files
+ # unless there are no more paths to be tried. Validation
+ # errors shall also be propagated here.
+ if ($! != ENOENT || $i == $#paths) {
+ die $e;
+ }
+ }
+ }
+
+ # For no locales to have been discovered at this point is exceptional.
+ my $path_list = render_printable(scalar @paths == 1 ? $paths[0] : \@paths);
+ die "$PROGRAM: No locale declarations were found within $path_list\n";
+}
+
+sub get_valid_locales ($prefix) {
+ my $top = local $ENV{'TOP'} = catdir($prefix, '/usr/share/i18n/locales');
+ my @paths = qx{ cd -- "\$TOP" && find . ! -path . -prune ! -path '*\n*' -type f -exec grep -lxF LC_IDENTIFICATION {} + };
+ if ($? != 0 || ! @paths) {
+ die "$PROGRAM: Failed to compose a list of valid locale names from '$top'\n";
+ }
+ chomp @paths;
+ return map +( (splitpath($_))[-1] ), @paths;
+}
+
+sub get_valid_charmaps ($prefix) {
+ my $top = catdir($prefix, '/usr/share/i18n/charmaps');
+ if (! opendir my $dh, $top) {
+ die "$PROGRAM: Can't open '$top' for reading: $!\n";
+ } elsif (! (my @names = map +( -f "$top/$_" ? s/\.gz\z//r : () ), readdir $dh)) {
+ die "$PROGRAM: Failed to compose a list of valid character maps from '$top'\n";
+ } else {
+ return @names;
+ }
+}
+
+sub parse_config ($fh, $path, $locale_by, $charmap_by) {
+ # Set up a helper routine to throw for validation errors.
+ my $thrower = sub ($error, $line) {
+ die sprintf "%s: %s at %s[%d]: %s\n",
+ $PROGRAM, $error, $path, $., render_printable($line);
+ };
+
+ my @locales;
+ while (my $line = readline $fh) {
+ # Skip comments and blank lines. Note that \h will match only " " and
+ # "\t", since the input stream is not being subjected to any decoding.
+ next if $line =~ m/^\h*($|#)/;
+
+ # Expect for two fields, separated by horizontal whitespace.
+ my @fields;
+ chomp $line;
+ if (2 != (@fields = split /\h+/, trim_line($line), 3)) {
+ $thrower->('Malformed locale declaration', $line);
+ }
+
+ # Extract the specified locale and character map. Upon success,
+ # a canonicalised representation of the locale is also returned.
+ my ($locale, $charmap, $canonical) = parse_entry(@fields);
+
+ # Validate both locale and character map before accepting.
+ if (! $locale_by->{$locale}) {
+ $thrower->('Invalid locale', $line);
+ } elsif (! $charmap_by->{$charmap}) {
+ $thrower->('Invalid/mismatching charmap', $line);
+ } else {
+ push @locales, [ $locale, $charmap, $canonical ];
+ }
+ }
+
+ return @locales;
+}
+
+sub parse_entry ($locale, $charmap) {
+ my $canonical;
+ if (2 == (my @fields = split /@/, $locale, 3)) {
+ # de_DE@euro ISO-8859-15 => de_DE.ISO-8859-15@euro
+ $canonical = sprintf '%s.%s@%s', $fields[0], $charmap, $fields[1];
+ } elsif (2 == (@fields = split /\./, $locale, 3)) {
+ # en_US.UTF-8 UTF-8 => en_US.UTF-8
+ $locale = $fields[0];
+ $canonical = "$locale.$charmap";
+ if ($fields[1] ne $charmap) {
+ $charmap = '';
+ }
+ } elsif (1 == @fields) {
+ # en_US ISO-8859-1 => en_US.ISO-8859-1
+ $canonical = "$locale.$charmap";
+ }
+ return $locale, $charmap, $canonical;
+}
+
+sub enter_tempdir ($prefix) {
+ # Given that /tmp might be a tmpfs, prefer /var/tmp so as to avoid
+ # undue memory pressure.
+ my $dir = catdir($prefix, '/var/tmp');
+ if (! -d $dir) {
+ $dir = File::Spec->tmpdir;
+ }
+ $TEMPDIR = tempdir('locale-gen.XXXXXXXXXX', 'DIR' => $dir);
+ if (! chdir $TEMPDIR) {
+ die "$PROGRAM: Can't chdir to '$TEMPDIR': $!\n";
+ }
+}
+
+sub generate_locales ($prefix, $workers, @locales) {
+ # Trap SIGINT and SIGTERM so that they may be handled gracefully.
+ my $handler = sub ($signal) { $DEFERRED_SIGNAL ||= $signal };
+ local @SIG{'INT', 'TERM'} = ($handler, $handler);
+
+ my $total = scalar @locales;
+ printf "Compiling %d locale definition file%s with %d worker%s ...\n",
+ $total, plural($total), $workers, plural($workers);
+
+ my $num_width = length $total;
+ my %status_by;
+ for my $i (keys @locales) {
+ # Ensure that the number of concurrent workers is bounded.
+ if ($i >= $workers) {
+ my $pid = wait;
+ last if 0 != ($status_by{$pid} = $?);
+ }
+
+ my ($locale, $charmap, $canonical) = $locales[$i]->@*;
+ printf "[%*d/%d] Compiling locale: %s\n",
+ $num_width, $i + 1, $total, $canonical;
+
+ # Fork and execute localedef(1) for locale compilation.
+ if (! defined(my $pid = fork)) {
+ warn "Can't fork: $!";
+ last;
+ } elsif ($pid == 0) {
+ @SIG{'INT', 'TERM'} = ('DEFAULT', 'DEFAULT');
+ compile_locale($locale, $charmap, $canonical);
+ }
+ } continue {
+ last if $DEFERRED_SIGNAL;
+ }
+
+ # Reap any subprocesses that remain.
+ if ($workers > 1) {
+ print "Waiting for active workers to finish their jobs ...\n";
+ }
+ while (-1 != (my $pid = wait)) {
+ $status_by{$pid} = $?;
+ }
+
+ # Abort if any of the collected status codes are found to be non-zero.
+ # In the case that one subprocess was interrupted by a signal while
+ # another exited non-zero, the resulting diagnostic shall allude to the
+ # signal. Such determinism is achieved by sorting the values.
+ for my $status (sort { $a <=> $b } values %status_by) {
+ throw_child_error('localedef', $status);
+ }
+
+ if ($DEFERRED_SIGNAL) {
+ # The signal shall be propagated by the END block.
+ exit;
+ } elsif (scalar %status_by != $total) {
+ die "$PROGRAM: Aborting because not all of the selected locales were compiled\n";
+ }
}
-# These funky sed's are based on the stuff in glibc's localedata/Makefile
-# Basically we want to rewrite the display like so:
-# <locale without a . or @>.<charmap>[@extra stuff after the @ in the locale]
-# en_US ISO-8859-1 -> en_US.ISO-8859-1
-# en_US.UTF-8 UTF-8 -> en_US.UTF-8
-# de_DE@euro ISO-8859-15 -> de_DE.ISO-8859-15@euro
-locales_disp=$(echo "${locales_to_generate}" | sed \
- -e ' /@/ s:[[:space:]]*\([^@[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3\2:' \
- -e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
-
-# Now check the normalized version for C.UTF-8, and add it if not present
-if [[ -z ${locales_to_generate} ]] ; then
- if [[ -z ${JUST_LIST} ]] ; then
- [[ ${QUIET} -eq 0 ]] && \
- ewarn "No locales to generate found, keeping archive but ensuring C.UTF-8 is present"
- KEEP=1
- UPDATE=1
- locales_disp='C.UTF-8'
- locales_to_generate='C.UTF-8 UTF-8'
- fi
-else
- if echo ${locales_disp} | grep -vqi 'C.UTF-8' ; then
- locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
- locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
- fi
-fi
-
-mkdir -p "${LOCALEDIR}"
-if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
- # Remove all old locale dir and locale-archive before generating new
- # locale data. Scrubbing via update is done elsewhere.
- rm -rf "${LOCALEDIR}"/* &> /dev/null || true
-fi
-
-eval declare -a locales_disp=(${locales_disp})
-eval declare -a locales_to_generate=(${locales_to_generate})
-total=$(( ${#locales_to_generate[*]} / 2 ))
-
-[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
-einfo "Generating ${total} locales (this might take a while) with ${JOBS_MAX} jobs"
-
-if [[ -n ${UPDATE} ]] ; then
- # normalize newlines into spaces
- existing_locales=" $(echo $(locale -a 2>/dev/null)) "
-fi
-
-generate_locale() {
- local output=""
-
- if [[ -z ${ASK} ]] && [[ ${QUIET} -eq 0 ]] ; then
- output=" (${cnt_fmt}/${total}) Generating ${disp}"
- fi
-
- if [[ $(( JOB_IDX_E - JOB_IDX_S )) == ${JOBS_MAX} ]] ; then
- wait ${JOB_PIDS[$(( JOB_IDX_S++ ))]}
- JOB_RETS+=( $? )
- fi
- (
- # Accumulate all the output in one go so the parallel
- # jobs don't tromp on each other
- x=$(
- [[ -n ${output} ]] && ebegin "${output}"
- # In most cases, localedef can just use the system glibc.
- # However, if we are within a major glibc upgrade, this may fail
- # in src_* phases since the new localedef links against the new
- # glibc, but the new glibc is not installed yet...
- if [[ -z ${INPLACE_GLIBC} ]] ; then
- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
- --no-archive \
- -i "${input}" \
- -f "${charmap}" \
- -A "${ALIAS}" \
- --prefix "${DESTDIR%${EPREFIX}/}/" \
- "${locale}" 2>&1
- else
- # We assume that the current directory is "${ED}"/$(get_libdir),
- # see the glibc ebuild, function glibc_sanity_check(), for why.
- LC_ALL=C ./ld-*.so --library-path . \
- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
- --no-archive \
- -i "${input}" \
- -f "${charmap}" \
- -A "${ALIAS}" \
- --prefix "${DESTDIR%${EPREFIX}/}/" \
- "${locale}" 2>&1
- fi
- ret=$?
- [[ -n ${output} ]] && eend ${ret}
- exit ${ret}
- )
- ret=$?
- if [[ -n ${output} ]] ; then
- echo "${x}"
- elif [[ ${ret} -ne 0 ]] ; then
- eerror "${disp}: ${x}"
- fi
-
- if [[ ${ret} -ne 0 && ${locale} == */* ]] ; then
- ewarn "Perhaps you meant to use a space instead of a / in your config file ?"
- fi
- exit ${ret}
- ) &
- JOB_PIDS+=( $! )
- : $(( ++JOB_IDX_E ))
+sub compile_locale ($locale, $charmap, $canonical) {
+ my $output_dir = "./$canonical";
+ my @args = ('--no-archive', '-i', $locale, '-f', $charmap, '--', $output_dir);
+ run_localedef(undef, @args);
+}
+
+sub generate_archive ($prefix, $locale_dir, $do_update, @canonicals) {
+ # Create the temporary subdir that will contain the new locale archive.
+ my $output_dir = catdir('.', $prefix, $locale_dir);
+ run('mkdir', '-p', '--', $output_dir);
+
+ # Determine the eventual destination path of the archive.
+ my $final_path = catfile($prefix, $locale_dir, 'locale-archive');
+ printf "The location of the archive shall be %s.\n", render_printable($final_path);
+
+ # If --update was specified, make a copy of the existing archive.
+ if ($do_update && -e $final_path) {
+ run('cp', '--', $final_path, "$output_dir/");
+ }
+
+ # Integrate all of the compiled locales into the new locale archive.
+ my $total = scalar @canonicals;
+ printf "Adding %d locale%s to the locale archive ...\n", $total, plural($total);
+ my $stderr = fopen('stderr.log', '+>');
+ redirect_stderr($stderr, sub {
+ my @args = ('--quiet', '--add-to-archive', '--replace', '--', @canonicals);
+ run_localedef('.', @args);
+ });
+
+ # Propagate the diagnostics and errors raised by localedef(1), if any.
+ seek $stderr, 0, SEEK_SET;
+ my $i = 0;
+ while (my $line = readline $stderr) {
+ warn $line;
+ ++$i;
+ }
+ close $stderr;
+
+ # Check the status code first.
+ throw_child_error('localedef');
+
+ # Sadly, the exit status of GNU localedef(1) is nigh on useless in the
+ # case that the --add-to-archive option is provided. If anything was
+ # printed to STDERR at all, act as if the utility had exited 1.
+ if ($i > 0) {
+ throw_child_error('localedef', 1 << 8);
+ }
+
+ # The process of replacing the old archive must not be interrupted.
+ local @SIG{'INT', 'TERM'} = ('IGNORE', 'IGNORE');
+
+ # Move the newly minted archive into the appropriate filesystem. Use
+ # mv(1), since there is a chance of crossing a filesystem boundary.
+ my $interim_path = "$final_path.$$";
+ run('mv', '--', catfile($output_dir, 'locale-archive'), $interim_path);
+
+ # Atomically replace the old archive.
+ if (! rename $interim_path, $final_path) {
+ {
+ local $!;
+ unlink $interim_path;
+ }
+ die "$PROGRAM: Can't rename '$interim_path' to '$final_path': $!\n";
+ }
+}
+
+sub run_localedef ($prefix, @args) {
+ # Incorporate the --prefix option, if requested.
+ if (length $prefix) {
+ unshift @args, '--prefix', $prefix;
+ }
+
+ # Prevent the --verbose option from being potentially implied.
+ delete local $ENV{'POSIXLY_CORRECT'};
+
+ # Execute localedef(1). Don't fork if doing so from a child process.
+ my @cmd = ('localedef', @args);
+ if ($$ == $PID) {
+ system @cmd;
+ } elsif (! exec @cmd) {
+ exit 1;
+ }
+}
+
+sub fopen ($path, $mode = '<') {
+ if (! open my $fh, $mode, $path) {
+ die "$PROGRAM: Can't open '$path': $!\n";
+ } elsif (! -f $fh && canonpath($path) !~ m/^\/dev\/(null|stdin)\z/) {
+ die "$PROGRAM: Won't open '$path' because it is not a regular file\n";
+ } else {
+ return $fh;
+ }
+}
+
+sub get_nprocs () {
+ chomp(my $nproc = qx{ { nproc || getconf _NPROCESSORS_CONF; } 2>/dev/null });
+ return $nproc;
+}
+
+sub is_eq_file ($path1, $path2) {
+ # The -ef primary is standard as of POSIX.1-2024.
+ local @ENV{'PATH1', 'PATH2'} = ($path1, $path2);
+ return 0 == system q{ test "$PATH1" -ef "$PATH2" };
+}
+
+sub plural ($int) {
+ return $int == 1 ? '' : 's';
}
-JOB_PIDS=()
-JOB_RETS=()
-JOB_IDX_S=0
-JOB_IDX_E=0
-cnt=0
-lidx=0
-# Keep track of (normalized) locales generated in case the request has different inputs that
-# normalize down to the same value. We trim $existing_locales as we go for later use which
-# prevents its direct use.
-generated_locales=" "
-while [[ -n ${locales_to_generate[${lidx}]} ]] ; do
- : $(( ++cnt ))
- locale=${locales_to_generate[$((lidx++))]}
- charmap=${locales_to_generate[$((lidx++))]}
-
- # XXX: if we wanted to, we could check existence of
- # ${LOCALES}/${locale} and ${CHARMAPS}/${charmap}
- # this would fail for things like "en_US.UTF8", but
- # in that case we could fall back to checking the
- # SUPPORTED file ... then again, the localedef
- # below will abort nicely for us ...
- if [[ -z ${locale} || -z ${charmap} ]] ; then
- eerror "Bad entry in locale.gen: '${locale} ${charmap}'; skipping"
- continue
- fi
-
- disp=${locales_disp[$(( cnt - 1 ))]}
-
- normalized_locale=$(normalize ${locale})
- if [[ ${generated_locales} == *" ${normalized_locale} "* ]] ; then
- already_generated="true"
- else
- already_generated="false"
- fi
- generated_locales+="${normalized_locale} "
- if ${already_generated} || \
- [[ -n ${UPDATE} && ${existing_locales} == *" ${normalized_locale} "* ]] ; then
- existing_locales=${existing_locales/ ${normalized_locale} / }
- if [[ ${QUIET} -eq 0 ]] ; then
- cnt_fmt=$(printf "%${#total}i" ${cnt})
- einfo " (${cnt_fmt}/${total}) Skipping ${disp}"
- fi
- continue
- fi
-
- # If the locale is like 'en_US.UTF8', then we really want 'en_US'
- if [[ -f ${LOCALES}/${locale} ]] ; then
- input=${locale}
- else
- input=${locale%%.*}
- fi
-
- if [[ -z ${JUST_LIST} ]] ; then
- # Format the output for the question/status
- cnt_fmt=$(printf "%${#total}i" ${cnt})
- if [[ -n ${ASK} ]] ; then
- einfon " (${cnt_fmt}/${total}) Generate ${disp} ? (Y/n) "
- read user_answer
- [[ ${user_answer} == [nN]* ]] && continue
- fi
- generate_locale
- else
- echo "${disp}"
- fi
-done
-
-for (( i = JOB_IDX_S; i < JOB_IDX_E; ++i )) ; do
- wait ${JOB_PIDS[i]}
- JOB_RETS+=( $? )
-done
-ret=$(( 0 ${JOB_RETS[@]/#/+} ))
-
-[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
-einfo "Generation complete"
-
-if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
- # need to check that at least one locale has to be added
- if [[ $(echo "${LOCALEDIR}"/*/) != "${LOCALEDIR}"'/*/' ]] ; then
- [[ ${QUIET} -eq 0 ]] && ebegin "Adding locales to archive"
- # The pattern ends with / on purpose: we don't care about files (like
- # locale-archive) in the locale subdir, and we definitely don't want to
- # delete them!
- for LOC in "${LOCALEDIR}"/*/; do
- LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
- x=$(
- # In most cases, localedef can just use the system glibc.
- # However, if we are within a major glibc upgrade, this may fail
- # in src_* phases since the new localedef links against the new
- # glibc, but the new glibc is not installed yet...
- if [[ -z ${INPLACE_GLIBC} ]] ; then
- "${DESTDIR}"usr/bin/localedef \
- --add-to-archive "${LOC}" \
- --replace \
- --prefix "${DESTDIR%${EPREFIX}/}/"
- else
- # We assume that the current directory is "${ED}"/$(get_libdir),
- # see the glibc ebuild, function glibc_sanity_check(), for why.
- LC_ALL=C ./ld-*.so --library-path . \
- "${DESTDIR}"usr/bin/localedef \
- --add-to-archive "${LOC}" \
- --replace \
- --prefix "${DESTDIR%${EPREFIX}/}/"
- fi
- ret=$?
- if [[ -n ${output} ]] ; then
- echo "${x}"
- elif [[ ${ret} -ne 0 ]] ; then
- eerror "${disp}: ${x}"
- fi
- if [[ $ret -eq 0 ]]; then
- rm -r "${LOC}"
- fi
- exit ${ret}
- )
- done
- [[ ${QUIET} -eq 0 ]] && eend ${ret}
- elif [[ ${QUIET} -eq 0 ]] ; then
- einfo "No locales are to be added to the archive."
- fi
-fi
-
-# Remove locales that existed but were not requested
-if [[ -n ${UPDATE} ]] && [[ -z ${JUST_LIST} ]] ; then
- # Ignore these pseudo locales
- existing_locales=${existing_locales/ C / }
- existing_locales=${existing_locales/ POSIX / }
- if [[ -n ${existing_locales// } ]] ; then
- if [[ -z ${KEEP} ]] ; then
- [[ ${QUIET} -eq 0 ]] && einfo "Scrubbing old locales:"${existing_locales}
- cd "${LOCALEDIR}" && rm -rf ${existing_locales}
- else
- [[ ${QUIET} -eq 0 ]] && einfo "Keeping old locales:"${existing_locales}
- fi
- fi
-fi
-
-exit ${ret}
+sub redirect_stderr ($stderr, $callback) {
+ if (! open my $old_stderr, '>&', *STDERR) {
+ die "Can't dup STDERR to a new file descriptor: $!";
+ } elsif (! open *STDERR, '>&', $stderr) {
+ my $fileno = fileno $stderr;
+ die "Can't dup file descriptor #$fileno to STDERR: $!";
+ } else {
+ $callback->();
+ open *STDERR, '>&=', $old_stderr;
+ }
+}
+
+sub render_printable ($value) {
+ my $coder = JSON::PP->new->ascii->space_after;
+ return $coder->encode($value);
+}
+
+sub run ($cmd, @args) {
+ system $cmd, @args;
+ throw_child_error($cmd);
+}
+
+sub throw_child_error ($cmd, $status = $?) {
+ if ($status == -1) {
+ # The program could not be started. Since Perl will already
+ # have printed a warning, no supplemental diagnostic is needed.
+ exit 1;
+ } elsif ($status != 0) {
+ my $printable_cmd = render_printable($cmd);
+ my $fate = ($status & 0x7F) ? 'interrupted by a signal' : 'unsuccessful';
+ die "$PROGRAM: Aborting because the execution of $printable_cmd was $fate\n";
+ }
+}
+
+sub trim_line ($line) {
+ return $line =~ s/^\h+|\h+$//gr;
+}
+
+END {
+ if ($$ == $PID) {
+ if (length $TEMPDIR) {
+ local $?;
+ system 'rm', '-r', '--', $TEMPDIR;
+ }
+
+ # The default SIGINT and SIGTERM handlers are suppressed by
+ # generate_locales. The former is especially important, per
+ # http://www.cons.org/cracauer/sigint.html.
+ if ($DEFERRED_SIGNAL) {
+ kill $DEFERRED_SIGNAL, $$;
+ }
+ }
+}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2023-05-11 22:23 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2023-05-11 22:23 UTC (permalink / raw
To: gentoo-commits
commit: 90bb71ee8aafe4bd412394045965d5af66a46c66
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Thu May 11 22:20:35 2023 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Thu May 11 22:20:35 2023 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=90bb71ee
Add COPYING file with the GNU GPL2
The code was originally taken from GNU glibc, and this license is what
applies to the tools bundled with it.
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
COPYING | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 339 insertions(+)
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d159169
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2023-03-21 17:37 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2023-03-21 17:37 UTC (permalink / raw
To: gentoo-commits
commit: 941f508fba6880b5d189c8fc6681bf9800a6e05b
Author: Bart Oldeman <bart.oldeman <AT> calculquebec <DOT> ca>
AuthorDate: Fri Mar 17 14:47:51 2023 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Mar 21 17:36:45 2023 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=941f508f
Fix use of EROOT to be compatible with EAPI 7+
EROOT no longer has a trailing slash, so replace it with "${EROOT%/}/"
to avoid errors such as:
/home/oldeman/eessi3/usr/sbin/locale-gen: line 168: /home/oldeman/eessi3usr/bin/localedef: No such file or directory
* Unable to parse the output of your localedef utility.
* File a bug about this issue and include the output of 'localedef --help'.
in stage3.log when bootstrapping Gentoo Prefix.
See also:
https://mgorny.pl/articles/the-ultimate-guide-to-eapi-7.html#d-ed-root-eroot-no-longer-have-a-trailing-slash
Closes: https://bugs.gentoo.org/883457
Signed-off-by: Bart Oldeman <bart.oldeman <AT> calculquebec.ca>
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/locale-gen b/locale-gen
index 8d27202..d0e109e 100755
--- a/locale-gen
+++ b/locale-gen
@@ -124,17 +124,17 @@ fi
: "${EROOT:=${EPREFIX}/}"
if [[ ${EROOT} != "/" ]] ; then
- einfo "Using locale.gen from ${EROOT}etc/"
+ einfo "Using locale.gen from ${EROOT%/}/etc/"
fi
if [[ -n ${DESTDIR} ]] ; then
DESTDIR="${DESTDIR%/}/"
einfo "Building locales in DESTDIR '${DESTDIR}'"
else
- DESTDIR=${EROOT}
+ DESTDIR="${EROOT%/}/"
fi
-: "${CONFIG:=${EROOT}etc/locale.gen}"
+: "${CONFIG:=${EROOT%/}/etc/locale.gen}"
LOCALES=${DESTDIR}usr/share/i18n/locales
CHARMAPS=${DESTDIR}usr/share/i18n/charmaps
SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-09-27 6:49 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2021-09-27 6:49 UTC (permalink / raw
To: gentoo-commits
commit: 692486a6d5b757f485e15a7acf269fd1bf28d970
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 27 06:46:19 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 27 06:46:19 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=692486a6
switch from tr to bash builtin ${var,,}
This seems to speed things up. Or I'm lying to myself. Either way.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
locale-gen | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/locale-gen b/locale-gen
index c746eef..9759daa 100755
--- a/locale-gen
+++ b/locale-gen
@@ -196,10 +196,11 @@ fi
# https://sourceware.org/git/?p=glibc.git;a=blob;f=locale/programs/localedef.c;hb=glibc-2.34#l562
normalize() {
if [[ $1 == *.* ]] ; then
- local ret=$(echo ${1##*.} | tr '[[:upper:]]' '[[:lower:]]')
- echo ${1%%.*}.${ret//-}
+ local ret=${1##*.}
+ ret=${ret,,}
+ echo "${1%%.*}.${ret//-}"
else
- echo $1
+ echo "$1"
fi
}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-09-27 6:49 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2021-09-27 6:49 UTC (permalink / raw
To: gentoo-commits
commit: 953486683088c5aed6af94e97644a64c68e8d1f5
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 27 06:38:45 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 27 06:38:45 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=95348668
fix hint about use of / in locale names
We checked $ret outside of the subshell where it was set, so this
code never actually fired. Move it up to where it should work.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
locale-gen | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/locale-gen b/locale-gen
index 03caff2..c746eef 100755
--- a/locale-gen
+++ b/locale-gen
@@ -299,14 +299,14 @@ generate_locale() {
elif [[ ${ret} -ne 0 ]] ; then
eerror "${disp}: ${x}"
fi
+
+ if [[ ${ret} -ne 0 && ${locale} == */* ]] ; then
+ ewarn "Perhaps you meant to use a space instead of a / in your config file ?"
+ fi
exit ${ret}
) &
JOB_PIDS+=( $! )
: $(( ++JOB_IDX_E ))
-
- if [[ ${ret} != 0 && ${locale} == */* ]] ; then
- ewarn "Perhaps you meant to use a space instead of a / in your config file ?"
- fi
}
JOB_PIDS=()
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-09-27 6:49 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2021-09-27 6:49 UTC (permalink / raw
To: gentoo-commits
commit: 7e275ec9547798e204126fd7e4ca80a1d086cfec
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 27 06:46:50 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 27 06:46:50 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=7e275ec9
document bash version requirements
With bash-4.0 released in 2009, should be plenty of time to use its
features. Especially with Gentoo requiring newer already.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
locale-gen | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index 9759daa..8d27202 100755
--- a/locale-gen
+++ b/locale-gen
@@ -1,9 +1,11 @@
#!/bin/bash
#
-# Based upon Debian's locale-gen, fetched from glibc_2.3.6-7.diff.gz
+# Based upon Debian's locale-gen, fetched from glibc_2.3.6-7.diff.gz, but completely rewritten.
#
+# NB: Bash-4.0+ required. We use += and ${var,,} features.
+
unset POSIXLY_CORRECT IFS
umask 0022
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-09-27 6:49 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2021-09-27 6:49 UTC (permalink / raw
To: gentoo-commits
commit: 3e7cd37ec35419adf97d603839e69be3c4a1eafc
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 27 06:35:22 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 27 06:35:22 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=3e7cd37e
delete unused CUTF_ADDED variable
The code deleting its use forgot to clean up its decl.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
locale-gen | 1 -
1 file changed, 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index d4417d8..4eb75d0 100755
--- a/locale-gen
+++ b/locale-gen
@@ -71,7 +71,6 @@ JOBS_MAX=""
QUIET=0
SET_X=""
LOCALE_ARCHIVE=true
-CUTF_ADDED=""
INPLACE_GLIBC=""
while [[ $# -gt 0 ]] ; do
case $1 in
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-09-27 6:49 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2021-09-27 6:49 UTC (permalink / raw
To: gentoo-commits
commit: 78802b1270bf48bea2e39039877096c4867afbb3
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 27 06:31:11 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 27 06:31:11 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=78802b12
skip duplicate locales when normalized
If you try to generate "en_US.UTF-8 UTF-8" and "en_US.UTF8 UTF-8", we
end up generating the locale twice even though it normalizes down to
the same value (or, in the case of --update, we skip the 1st and then
always generate the 2nd). Keep track of all locales we've processed
so we can dedupe as we go.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
locale-gen | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/locale-gen b/locale-gen
index d313c23..d4417d8 100755
--- a/locale-gen
+++ b/locale-gen
@@ -192,9 +192,9 @@ if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
fi
fi
-# Transform the name in locales.gen to the name used when storing
-# the locale data in /usr/lib/locale/ ... this normalize algo is
-# taken out of the glibc localedef source code ...
+# Transform the name in locales.gen to the name used when storing the locale data in
+# /usr/lib/locale/. This normalize algo is taken out of the glibc localedef source:
+# https://sourceware.org/git/?p=glibc.git;a=blob;f=locale/programs/localedef.c;hb=glibc-2.34#l562
normalize() {
if [[ $1 == *.* ]] ; then
local ret=$(echo ${1##*.} | tr '[[:upper:]]' '[[:lower:]]')
@@ -316,6 +316,10 @@ JOB_IDX_S=0
JOB_IDX_E=0
cnt=0
lidx=0
+# Keep track of (normalized) locales generated in case the request has different inputs that
+# normalize down to the same value. We trim $existing_locales as we go for later use which
+# prevents its direct use.
+generated_locales=" "
while [[ -n ${locales_to_generate[${lidx}]} ]] ; do
: $(( ++cnt ))
locale=${locales_to_generate[$((lidx++))]}
@@ -334,16 +338,21 @@ while [[ -n ${locales_to_generate[${lidx}]} ]] ; do
disp=${locales_disp[$(( cnt - 1 ))]}
- if [[ -n ${UPDATE} ]] ; then
- normalized_locale=$(normalize ${locale})
- if [[ ${existing_locales} == *" ${normalized_locale} "* ]] ; then
- existing_locales=${existing_locales/ ${normalized_locale} / }
- if [[ ${QUIET} -eq 0 ]] ; then
- cnt_fmt=$(printf "%${#total}i" ${cnt})
- einfo " (${cnt_fmt}/${total}) Skipping ${disp}"
- fi
- continue
+ normalized_locale=$(normalize ${locale})
+ if [[ ${generated_locales} == *" ${normalized_locale} "* ]] ; then
+ already_generated="true"
+ else
+ already_generated="false"
+ fi
+ generated_locales+="${normalized_locale} "
+ if ${already_generated} || \
+ [[ -n ${UPDATE} && ${existing_locales} == *" ${normalized_locale} "* ]] ; then
+ existing_locales=${existing_locales/ ${normalized_locale} / }
+ if [[ ${QUIET} -eq 0 ]] ; then
+ cnt_fmt=$(printf "%${#total}i" ${cnt})
+ einfo " (${cnt_fmt}/${total}) Skipping ${disp}"
fi
+ continue
fi
# If the locale is like 'en_US.UTF8', then we really want 'en_US'
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-09-27 6:49 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2021-09-27 6:49 UTC (permalink / raw
To: gentoo-commits
commit: 088812be4e5e61bb614d90df14dc7a7117b38d51
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 27 06:37:39 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 27 06:37:39 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=088812be
add quotes around : ${...} defaults
In practice this shouldn't matter, but this makes shellcheck a bit
happy in case of pathological globs in environment variables.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
locale-gen | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index 4eb75d0..03caff2 100755
--- a/locale-gen
+++ b/locale-gen
@@ -105,14 +105,14 @@ fi
if [[ -z ${JOBS_MAX} ]] ; then
JOBS_MAX=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
- : ${JOBS_MAX:=1}
+ : "${JOBS_MAX:=1}"
fi
[[ ${JOBS_MAX} -lt 1 ]] && JOBS_MAX=1
[[ -n ${SET_X} ]] && set -x
-: ${KEEP:=${JUST_LIST}}
+: "${KEEP:=${JUST_LIST}}"
[[ -n ${GENERATE} ]] && UPDATE="true" && KEEP="true"
-: ${ROOT:=/}
+: "${ROOT:=/}"
ROOT="${ROOT%/}/"
if [[ ${ROOT} != "/" ]] ; then
@@ -120,7 +120,7 @@ if [[ ${ROOT} != "/" ]] ; then
exit 0
fi
-: ${EROOT:="${EPREFIX}/"}
+: "${EROOT:=${EPREFIX}/}"
if [[ ${EROOT} != "/" ]] ; then
einfo "Using locale.gen from ${EROOT}etc/"
fi
@@ -132,7 +132,7 @@ else
DESTDIR=${EROOT}
fi
-: ${CONFIG:=${EROOT}etc/locale.gen}
+: "${CONFIG:=${EROOT}etc/locale.gen}"
LOCALES=${DESTDIR}usr/share/i18n/locales
CHARMAPS=${DESTDIR}usr/share/i18n/charmaps
SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-09-27 5:46 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2021-09-27 5:46 UTC (permalink / raw
To: gentoo-commits
commit: 7e7ec15d2c96b8b13923b470b4f5f31a993ab756
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 27 05:38:10 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Sep 27 05:38:10 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=7e7ec15d
omit more spam when in quiet mode
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
locale-gen | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 264cd23..d313c23 100755
--- a/locale-gen
+++ b/locale-gen
@@ -379,7 +379,7 @@ einfo "Generation complete"
if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
# need to check that at least one locale has to be added
if [[ $(echo "${LOCALEDIR}"/*/) != "${LOCALEDIR}"'/*/' ]] ; then
- ebegin "Adding locales to archive"
+ [[ ${QUIET} -eq 0 ]] && ebegin "Adding locales to archive"
# The pattern ends with / on purpose: we don't care about files (like
# locale-archive) in the locale subdir, and we definitely don't want to
# delete them!
@@ -416,7 +416,7 @@ if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
exit ${ret}
)
done
- eend $ret
+ [[ ${QUIET} -eq 0 ]] && eend ${ret}
elif [[ ${QUIET} -eq 0 ]] ; then
einfo "No locales are to be added to the archive."
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-08-06 21:09 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2021-08-06 21:09 UTC (permalink / raw
To: gentoo-commits
commit: 799b0ed2ef39e49b56f0204bc8db52d0353b1e63
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 6 21:09:03 2021 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Aug 6 21:09:03 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=799b0ed2
Ensure DESTDIR ends with a /
Bug: https://bugs.gentoo.org/779790
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 1 +
1 file changed, 1 insertion(+)
diff --git a/locale-gen b/locale-gen
index b41258f..264cd23 100755
--- a/locale-gen
+++ b/locale-gen
@@ -127,6 +127,7 @@ if [[ ${EROOT} != "/" ]] ; then
fi
if [[ -n ${DESTDIR} ]] ; then
+ DESTDIR="${DESTDIR%/}/"
einfo "Building locales in DESTDIR '${DESTDIR}'"
else
DESTDIR=${EROOT}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2021-03-12 16:28 Mike Frysinger
0 siblings, 0 replies; 148+ messages in thread
From: Mike Frysinger @ 2021-03-12 16:28 UTC (permalink / raw
To: gentoo-commits
commit: 92c3c0492056f25062780302317429d0792e5ed8
Author: Mike Frysinger <vapier <AT> chromium <DOT> org>
AuthorDate: Fri Mar 12 16:28:27 2021 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Mar 12 16:28:27 2021 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=92c3c049
omit spam when in quiet mode
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
locale-gen | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index f0dc40e..b41258f 100755
--- a/locale-gen
+++ b/locale-gen
@@ -416,7 +416,7 @@ if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
)
done
eend $ret
- else
+ elif [[ ${QUIET} -eq 0 ]] ; then
einfo "No locales are to be added to the archive."
fi
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-07-27 15:38 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-07-27 15:38 UTC (permalink / raw
To: gentoo-commits
commit: 05bbf16bcf7c9cc690324182f411d98dddbae7c6
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 27 15:37:43 2020 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 27 15:37:43 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=05bbf16b
Fix error message if no locales are to be added
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index 93616b3..f0dc40e 100755
--- a/locale-gen
+++ b/locale-gen
@@ -376,12 +376,13 @@ ret=$(( 0 ${JOB_RETS[@]/#/+} ))
einfo "Generation complete"
if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
- if true ; then # need to check that at least one locale has to be added
+ # need to check that at least one locale has to be added
+ if [[ $(echo "${LOCALEDIR}"/*/) != "${LOCALEDIR}"'/*/' ]] ; then
ebegin "Adding locales to archive"
# The pattern ends with / on purpose: we don't care about files (like
# locale-archive) in the locale subdir, and we definitely don't want to
# delete them!
- for LOC in "${LOCALEDIR}"/*/; do
+ for LOC in "${LOCALEDIR}"/*/; do
LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
x=$(
# In most cases, localedef can just use the system glibc.
@@ -415,6 +416,8 @@ if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
)
done
eend $ret
+ else
+ einfo "No locales are to be added to the archive."
fi
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-07-27 10:36 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-07-27 10:36 UTC (permalink / raw
To: gentoo-commits
commit: 550b6726e3fed643c3eb3ce19bd56887b5a3a840
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 27 10:35:50 2020 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 27 10:35:50 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=550b6726
Further logic improvements
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 114 ++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 60 insertions(+), 54 deletions(-)
diff --git a/locale-gen b/locale-gen
index f740d70..93616b3 100755
--- a/locale-gen
+++ b/locale-gen
@@ -191,19 +191,6 @@ if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
fi
fi
-if [[ -z ${locales_to_generate} ]] ; then
- [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
- ewarn "No locales to generate found, keeping locale archive"
- exit 0
-fi
-
-mkdir -p "${LOCALEDIR}"
-if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
- # Remove all old locale dir and locale-archive before generating new
- # locale data. Scrubbing via update is done elsewhere.
- rm -rf "${LOCALEDIR}"/* &> /dev/null || true
-fi
-
# Transform the name in locales.gen to the name used when storing
# the locale data in /usr/lib/locale/ ... this normalize algo is
# taken out of the glibc localedef source code ...
@@ -227,10 +214,27 @@ locales_disp=$(echo "${locales_to_generate}" | sed \
-e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
# Now check the normalized version for C.UTF-8, and add it if not present
-if echo ${locales_disp} | grep -vq 'C.UTF-8' ; then
- locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
- locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
- CUTF_ADDED="true"
+if [[ -z ${locales_to_generate} ]] ; then
+ if [[ -z ${JUST_LIST} ]] ; then
+ [[ ${QUIET} -eq 0 ]] && \
+ ewarn "No locales to generate found, keeping archive but ensuring C.UTF-8 is present"
+ KEEP=1
+ UPDATE=1
+ locales_disp='C.UTF-8'
+ locales_to_generate='C.UTF-8 UTF-8'
+ fi
+else
+ if echo ${locales_disp} | grep -vqi 'C.UTF-8' ; then
+ locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
+ locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
+ fi
+fi
+
+mkdir -p "${LOCALEDIR}"
+if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
+ # Remove all old locale dir and locale-archive before generating new
+ # locale data. Scrubbing via update is done elsewhere.
+ rm -rf "${LOCALEDIR}"/* &> /dev/null || true
fi
eval declare -a locales_disp=(${locales_disp})
@@ -372,44 +376,46 @@ ret=$(( 0 ${JOB_RETS[@]/#/+} ))
einfo "Generation complete"
if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
- ebegin "Adding locales to archive"
- # The pattern ends with / on purpose: we don't care about files (like
- # locale-archive) in the locale subdir, and we definitely don't want to
- # delete them!
- for LOC in "${LOCALEDIR}"/*/; do
- LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
- x=$(
- # In most cases, localedef can just use the system glibc.
- # However, if we are within a major glibc upgrade, this may fail
- # in src_* phases since the new localedef links against the new
- # glibc, but the new glibc is not installed yet...
- if [[ -z ${INPLACE_GLIBC} ]] ; then
- "${DESTDIR}"usr/bin/localedef \
- --add-to-archive "${LOC}" \
- --replace \
- --prefix "${DESTDIR%${EPREFIX}/}/"
- else
- # We assume that the current directory is "${ED}"/$(get_libdir),
- # see the glibc ebuild, function glibc_sanity_check(), for why.
- LC_ALL=C ./ld-*.so --library-path . \
+ if true ; then # need to check that at least one locale has to be added
+ ebegin "Adding locales to archive"
+ # The pattern ends with / on purpose: we don't care about files (like
+ # locale-archive) in the locale subdir, and we definitely don't want to
+ # delete them!
+ for LOC in "${LOCALEDIR}"/*/; do
+ LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
+ x=$(
+ # In most cases, localedef can just use the system glibc.
+ # However, if we are within a major glibc upgrade, this may fail
+ # in src_* phases since the new localedef links against the new
+ # glibc, but the new glibc is not installed yet...
+ if [[ -z ${INPLACE_GLIBC} ]] ; then
"${DESTDIR}"usr/bin/localedef \
- --add-to-archive "${LOC}" \
- --replace \
- --prefix "${DESTDIR%${EPREFIX}/}/"
- fi
- ret=$?
- if [[ -n ${output} ]] ; then
- echo "${x}"
- elif [[ ${ret} -ne 0 ]] ; then
- eerror "${disp}: ${x}"
- fi
- if [[ $ret -eq 0 ]]; then
- rm -r "${LOC}"
- fi
- exit ${ret}
- )
- done
- eend $ret
+ --add-to-archive "${LOC}" \
+ --replace \
+ --prefix "${DESTDIR%${EPREFIX}/}/"
+ else
+ # We assume that the current directory is "${ED}"/$(get_libdir),
+ # see the glibc ebuild, function glibc_sanity_check(), for why.
+ LC_ALL=C ./ld-*.so --library-path . \
+ "${DESTDIR}"usr/bin/localedef \
+ --add-to-archive "${LOC}" \
+ --replace \
+ --prefix "${DESTDIR%${EPREFIX}/}/"
+ fi
+ ret=$?
+ if [[ -n ${output} ]] ; then
+ echo "${x}"
+ elif [[ ${ret} -ne 0 ]] ; then
+ eerror "${disp}: ${x}"
+ fi
+ if [[ $ret -eq 0 ]]; then
+ rm -r "${LOC}"
+ fi
+ exit ${ret}
+ )
+ done
+ eend $ret
+ fi
fi
# Remove locales that existed but were not requested
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-07-26 17:37 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-07-26 17:37 UTC (permalink / raw
To: gentoo-commits
commit: d3a30d74e67bb80213857ed4effe86c09d231eb6
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 15 01:58:30 2020 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jul 15 01:58:30 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=d3a30d74
Minor output fix
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index 140654a..7741aa7 100755
--- a/locale-gen
+++ b/locale-gen
@@ -123,7 +123,7 @@ fi
: ${EROOT:="${EPREFIX}/"}
if [[ ${EROOT} != "/" ]] ; then
- einfo "Using locale.gen from ROOT ${EROOT}etc/"
+ einfo "Using locale.gen from ${EROOT}etc/"
fi
if [[ -n ${DESTDIR} ]] ; then
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-07-26 17:37 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-07-26 17:37 UTC (permalink / raw
To: gentoo-commits
commit: 8d707a9d314b8843608da773a072d2bcdce3eb35
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 26 17:36:37 2020 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Jul 26 17:36:37 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=8d707a9d
Rework C.UTF-8 insertion logic
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/locale-gen b/locale-gen
index 7741aa7..f740d70 100755
--- a/locale-gen
+++ b/locale-gen
@@ -189,26 +189,11 @@ if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
ewarn "Some might be filtered, but you must fix it."
locales_to_generate=$(echo "${locales_to_generate}" | uniq)
fi
-
- if echo ${locales_to_generate} | grep -vq 'C.UTF-8' ; then
- if [[ -z ${locales_to_generate} ]] ; then
- locales_to_generate='C.UTF-8 UTF-8'
- else
- locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
- fi
- CUTF_ADDED="true"
- fi
fi
if [[ -z ${locales_to_generate} ]] ; then
[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
- ewarn "No locales found, keeping locale archive"
- exit 0
-fi
-
-if [[ ${locales_to_generate} == "C.UTF-8 UTF-8" ]] && [[ -n ${CUTF_ADDED} ]] ; then
- [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
- ewarn "No locales found, keeping locale archive"
+ ewarn "No locales to generate found, keeping locale archive"
exit 0
fi
@@ -241,6 +226,13 @@ locales_disp=$(echo "${locales_to_generate}" | sed \
-e ' /@/ s:[[:space:]]*\([^@[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3\2:' \
-e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
+# Now check the normalized version for C.UTF-8, and add it if not present
+if echo ${locales_disp} | grep -vq 'C.UTF-8' ; then
+ locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
+ locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
+ CUTF_ADDED="true"
+fi
+
eval declare -a locales_disp=(${locales_disp})
eval declare -a locales_to_generate=(${locales_to_generate})
total=$(( ${#locales_to_generate[*]} / 2 ))
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-07-15 1:56 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-07-15 1:56 UTC (permalink / raw
To: gentoo-commits
commit: b867411c83fa70444e3042f2ddb5430cc98c4ded
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 15 01:47:06 2020 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jul 15 01:47:06 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=b867411c
Drop useless old cvs version information
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/locale-gen b/locale-gen
index 8afb5d1..b330851 100755
--- a/locale-gen
+++ b/locale-gen
@@ -52,15 +52,12 @@ show_usage() {
eerror "Unknown option '$1'"
exit 1
}
+
show_version() {
- local b="(" a=")"
- local cvsver="$Revision: 1.42 $b $Date: 2017/08/12 16:30:06 $a"
- echo "locale-gen-${cvsver//: }"
+ echo "locale-gen-2.xxx"
exit 0
}
-
-
LOCALEDEF_OPTS=""
KEEP=""
DESTDIR=""
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-07-15 1:56 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-07-15 1:56 UTC (permalink / raw
To: gentoo-commits
commit: 3018f745b83ee4b6e11b0f6554a9472fe4517091
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 15 01:56:02 2020 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Wed Jul 15 01:56:02 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=3018f745
Remove incomplete, nonfunctional ROOT support
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/locale-gen b/locale-gen
index b330851..140654a 100755
--- a/locale-gen
+++ b/locale-gen
@@ -115,26 +115,23 @@ fi
: ${ROOT:=/}
ROOT="${ROOT%/}/"
-if [[ -n ${DESTDIR} ]] && [[ ${ROOT} != "/" ]] ; then
- eerror "DESTDIR and ROOT are mutually exclusive options"
- exit 1
+
+if [[ ${ROOT} != "/" ]] ; then
+ eerror "Sorry, but ROOT is not supported."
+ exit 0
fi
-: ${EROOT:="${ROOT%/}${EPREFIX}/"}
+
+: ${EROOT:="${EPREFIX}/"}
if [[ ${EROOT} != "/" ]] ; then
einfo "Using locale.gen from ROOT ${EROOT}etc/"
fi
+
if [[ -n ${DESTDIR} ]] ; then
einfo "Building locales in DESTDIR '${DESTDIR}'"
else
DESTDIR=${EROOT}
fi
-# XXX: should fix this ...
-if [[ ${ROOT} != "/" ]] ; then
- eerror "Sorry, but ROOT support is incomplete at this time."
- exit 0
-fi
-
: ${CONFIG:=${EROOT}etc/locale.gen}
LOCALES=${DESTDIR}usr/share/i18n/locales
CHARMAPS=${DESTDIR}usr/share/i18n/charmaps
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-05-12 4:23 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-05-12 4:23 UTC (permalink / raw
To: gentoo-commits
commit: faf329009b4df7d2f4c02f9745ea345301e6aeeb
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 14 19:43:04 2018 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 12 04:19:26 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=faf32900
locale-gen: remove --force option from localedef call
Originally 9231f507d365b6d81ccae618aaeca27076b92164, gentoo/glibc-9999-15
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index bfbd505..8afb5d1 100755
--- a/locale-gen
+++ b/locale-gen
@@ -61,7 +61,7 @@ show_version() {
-LOCALEDEF_OPTS="-c"
+LOCALEDEF_OPTS=""
KEEP=""
DESTDIR=""
CONFIG=""
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-05-12 4:23 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-05-12 4:23 UTC (permalink / raw
To: gentoo-commits
commit: e384a5562c53795590cfc9239b422062bf559105
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 2 23:45:43 2019 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 12 04:17:24 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=e384a556
locale-gen: add trigger variable for compiled-locales and warning to locale-gen
Originally ab05be2e3957ccbec1279124f7da51c0a602fdea, gentoo/glibc-9999-14
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/locale-gen b/locale-gen
index 794cfeb..bfbd505 100755
--- a/locale-gen
+++ b/locale-gen
@@ -20,6 +20,8 @@ source "${EPREFIX}"${FUNCTIONS_SH} || {
exit 1
}
+COMPILED_LOCALES=""
+
show_usage() {
cat <<-EOF
Usage: ${HILITE}${argv0}${NORMAL} ${GOOD}[options]${NORMAL} -- ${GOOD}[localedef options]${NORMAL}
@@ -96,6 +98,15 @@ while [[ $# -gt 0 ]] ; do
esac
shift
done
+
+if [[ -n ${COMPILED_LOCALES} ]] ; then
+ ewarn "All locales have been installed and registered by the package manager. If you"
+ ewarn "rebuild the locale archive now, file integrity tools may show it as corrupted."
+ ewarn "This is not really a big problem, but a better solution is to disable"
+ ewarn "USE=compile-locales and re-install glibc if you dont need all locales."
+ echo
+fi
+
if [[ -z ${JOBS_MAX} ]] ; then
JOBS_MAX=$(getconf _NPROCESSORS_ONLN 2>/dev/null)
: ${JOBS_MAX:=1}
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-05-12 4:23 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-05-12 4:23 UTC (permalink / raw
To: gentoo-commits
commit: 3f617b2cc378016b4eaa458151b809487af54c8a
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 21 15:30:13 2018 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 12 04:12:04 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=3f617b2c
locale-gen: do not touch locale-archive when no locales requested in config
Originally 3179a4df4ea81aa9116b70e2a064f55da65d13e8, gentoo/glibc-9999-10
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index f88c677..87dd30e 100755
--- a/locale-gen
+++ b/locale-gen
@@ -72,6 +72,7 @@ JOBS_MAX=""
QUIET=0
SET_X=""
LOCALE_ARCHIVE=true
+CUTF_ADDED=""
while [[ $# -gt 0 ]] ; do
case $1 in
-k|--keep|--keep-existing) KEEP=$1;;
@@ -183,13 +184,24 @@ if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
fi
if echo ${locales_to_generate} | grep -vq 'C.UTF-8' ; then
- locales_to_generate=$(echo "${locales_to_generate}" ; echo "C.UTF-8 UTF-8")
+ if [[ -z ${locales_to_generate} ]] ; then
+ locales_to_generate='C.UTF-8 UTF-8'
+ else
+ locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
+ fi
+ CUTF_ADDED="true"
fi
fi
if [[ -z ${locales_to_generate} ]] ; then
[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
- ewarn "No locales found"
+ ewarn "No locales found, keeping locale archive"
+ exit 0
+fi
+
+if [[ ${locales_to_generate} == "C.UTF-8 UTF-8" ]] && [[ -n ${CUTF_ADDED} ]] ; then
+ [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
+ ewarn "No locales found, keeping locale archive"
exit 0
fi
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-05-12 4:23 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-05-12 4:23 UTC (permalink / raw
To: gentoo-commits
commit: b7315c4a85743a10719bc4a3b1364b5035944eb8
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 14 19:43:04 2018 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 12 04:14:50 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=b7315c4a
locale-gen: Add switch to force use of newly built ld.so for glibc updates
Originally 6f89339308241bceb5194a200c99002e6c75dbb6, gentoo/glibc-9999-11
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 55 ++++++++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 44 insertions(+), 11 deletions(-)
diff --git a/locale-gen b/locale-gen
index 87dd30e..794cfeb 100755
--- a/locale-gen
+++ b/locale-gen
@@ -73,8 +73,10 @@ QUIET=0
SET_X=""
LOCALE_ARCHIVE=true
CUTF_ADDED=""
+INPLACE_GLIBC=""
while [[ $# -gt 0 ]] ; do
case $1 in
+ --inplace-glibc) INPLACE_GLIBC=$1;;
-k|--keep|--keep-existing) KEEP=$1;;
-d|--destdir) shift; DESTDIR=$1; unset ROOT;;
-c|--config) shift; CONFIG=$1;;
@@ -262,13 +264,30 @@ generate_locale() {
# jobs don't tromp on each other
x=$(
[[ -n ${output} ]] && ebegin "${output}"
- "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
- --no-archive \
- -i "${input}" \
- -f "${charmap}" \
- -A "${ALIAS}" \
- --prefix "${DESTDIR%${EPREFIX}/}/" \
- "${locale}" 2>&1
+ # In most cases, localedef can just use the system glibc.
+ # However, if we are within a major glibc upgrade, this may fail
+ # in src_* phases since the new localedef links against the new
+ # glibc, but the new glibc is not installed yet...
+ if [[ -z ${INPLACE_GLIBC} ]] ; then
+ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
+ --no-archive \
+ -i "${input}" \
+ -f "${charmap}" \
+ -A "${ALIAS}" \
+ --prefix "${DESTDIR%${EPREFIX}/}/" \
+ "${locale}" 2>&1
+ else
+ # We assume that the current directory is "${ED}"/$(get_libdir),
+ # see the glibc ebuild, function glibc_sanity_check(), for why.
+ LC_ALL=C ./ld-*.so --library-path . \
+ "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \
+ --no-archive \
+ -i "${input}" \
+ -f "${charmap}" \
+ -A "${ALIAS}" \
+ --prefix "${DESTDIR%${EPREFIX}/}/" \
+ "${locale}" 2>&1
+ fi
ret=$?
[[ -n ${output} ]] && eend ${ret}
exit ${ret}
@@ -363,10 +382,24 @@ if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
for LOC in "${LOCALEDIR}"/*/; do
LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it
x=$(
- "${DESTDIR}"usr/bin/localedef \
- --add-to-archive "${LOC}" \
- --replace \
- --prefix "${DESTDIR%${EPREFIX}/}/"
+ # In most cases, localedef can just use the system glibc.
+ # However, if we are within a major glibc upgrade, this may fail
+ # in src_* phases since the new localedef links against the new
+ # glibc, but the new glibc is not installed yet...
+ if [[ -z ${INPLACE_GLIBC} ]] ; then
+ "${DESTDIR}"usr/bin/localedef \
+ --add-to-archive "${LOC}" \
+ --replace \
+ --prefix "${DESTDIR%${EPREFIX}/}/"
+ else
+ # We assume that the current directory is "${ED}"/$(get_libdir),
+ # see the glibc ebuild, function glibc_sanity_check(), for why.
+ LC_ALL=C ./ld-*.so --library-path . \
+ "${DESTDIR}"usr/bin/localedef \
+ --add-to-archive "${LOC}" \
+ --replace \
+ --prefix "${DESTDIR%${EPREFIX}/}/"
+ fi
ret=$?
if [[ -n ${output} ]] ; then
echo "${x}"
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-05-12 4:23 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-05-12 4:23 UTC (permalink / raw
To: gentoo-commits
commit: e384fae0f4cafe49304afbc872cb7d3422903681
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 14 19:43:04 2018 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 12 04:08:39 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=e384fae0
locale-gen: Always build the C.UTF-8 locale (which we now patch in)
Originally f2ed15510fd0f7b9bcc923e24efd2681aacd0d5f, gentoo/glibc-9999-9
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/locale-gen b/locale-gen
index fc861f4..f88c677 100755
--- a/locale-gen
+++ b/locale-gen
@@ -181,6 +181,10 @@ if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
ewarn "Some might be filtered, but you must fix it."
locales_to_generate=$(echo "${locales_to_generate}" | uniq)
fi
+
+ if echo ${locales_to_generate} | grep -vq 'C.UTF-8' ; then
+ locales_to_generate=$(echo "${locales_to_generate}" ; echo "C.UTF-8 UTF-8")
+ fi
fi
if [[ -z ${locales_to_generate} ]] ; then
@@ -339,7 +343,7 @@ ret=$(( 0 ${JOB_RETS[@]/#/+} ))
[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
einfo "Generation complete"
-if ${LOCALE_ARCHIVE} ; then
+if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; then
ebegin "Adding locales to archive"
# The pattern ends with / on purpose: we don't care about files (like
# locale-archive) in the locale subdir, and we definitely don't want to
@@ -367,7 +371,7 @@ if ${LOCALE_ARCHIVE} ; then
fi
# Remove locales that existed but were not requested
-if [[ -n ${UPDATE} ]] ; then
+if [[ -n ${UPDATE} ]] && [[ -z ${JUST_LIST} ]] ; then
# Ignore these pseudo locales
existing_locales=${existing_locales/ C / }
existing_locales=${existing_locales/ POSIX / }
^ permalink raw reply related [flat|nested] 148+ messages in thread
* [gentoo-commits] proj/locale-gen:master commit in: /
@ 2020-05-12 4:23 Andreas K. Hüttel
0 siblings, 0 replies; 148+ messages in thread
From: Andreas K. Hüttel @ 2020-05-12 4:23 UTC (permalink / raw
To: gentoo-commits
commit: 720917daed356ccda8a39bab4870b6d6db2bfc0e
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 10 15:27:30 2018 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue May 12 04:05:38 2020 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=720917da
locale-gen: suppress ignored error when emptying already empty directory
Originally aba214da1a265afe4dfa3b52bc356275a275a9aa, gentoo/glibc-9999-6
Closes: https://bugs.gentoo.org/647188
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
locale-gen | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/locale-gen b/locale-gen
index 6653cad..fc861f4 100755
--- a/locale-gen
+++ b/locale-gen
@@ -193,7 +193,7 @@ mkdir -p "${LOCALEDIR}"
if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
# Remove all old locale dir and locale-archive before generating new
# locale data. Scrubbing via update is done elsewhere.
- rm -rf "${LOCALEDIR}"/* || true
+ rm -rf "${LOCALEDIR}"/* &> /dev/null || true
fi
# Transform the name in locales.gen to the name used when storing
^ permalink raw reply related [flat|nested] 148+ messages in thread
end of thread, other threads:[~2025-09-18 23:06 UTC | newest]
Thread overview: 148+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15 22:18 [gentoo-commits] proj/locale-gen:master commit in: / Kerin Millar
-- strict thread matches above, loose matches on Subject: below --
2025-09-18 23:06 Kerin Millar
2025-09-18 23:04 Kerin Millar
2025-09-18 23:04 Kerin Millar
2025-09-15 5:08 Kerin Millar
2025-09-15 4:07 Kerin Millar
2025-09-15 4:07 Kerin Millar
2025-09-15 4:07 Kerin Millar
2025-09-14 4:24 Kerin Millar
2025-09-14 4:20 Kerin Millar
2025-09-13 23:53 Kerin Millar
2025-09-13 23:51 Kerin Millar
2025-09-13 23:51 Kerin Millar
2025-09-13 23:23 Kerin Millar
2025-09-13 23:23 Kerin Millar
2025-09-13 9:42 Kerin Millar
2025-09-13 9:35 Kerin Millar
2025-09-13 9:27 Kerin Millar
2025-09-13 8:46 Kerin Millar
2025-09-13 8:42 Kerin Millar
2025-09-13 1:23 Kerin Millar
2025-09-13 1:14 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-08-22 23:42 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-20 2:39 Kerin Millar
2025-08-20 2:39 Kerin Millar
2025-08-19 13:37 Kerin Millar
2025-08-19 13:19 Kerin Millar
2025-08-18 2:46 Kerin Millar
2025-08-18 1:18 Kerin Millar
2025-08-18 1:18 Kerin Millar
2025-08-17 2:01 Kerin Millar
2025-08-16 23:17 Kerin Millar
2025-08-16 23:17 Kerin Millar
2025-08-16 3:46 Kerin Millar
2025-08-15 22:29 Kerin Millar
2025-08-15 22:29 Kerin Millar
2025-08-15 5:35 Kerin Millar
2025-08-15 4:07 Kerin Millar
2025-08-15 3:57 Kerin Millar
2025-08-13 23:49 Kerin Millar
2025-08-13 22:53 Kerin Millar
2025-08-13 22:45 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 10:09 Kerin Millar
2025-08-13 10:09 Kerin Millar
2025-08-12 17:32 Kerin Millar
2025-08-12 5:06 Kerin Millar
2025-08-12 5:06 Kerin Millar
2025-08-11 22:43 Kerin Millar
2025-08-11 16:04 Kerin Millar
2025-08-11 16:04 Kerin Millar
2025-08-11 0:39 Kerin Millar
2025-08-10 22:53 Kerin Millar
2025-08-10 22:22 Kerin Millar
2025-08-10 22:22 Kerin Millar
2025-08-10 17:05 Kerin Millar
2025-08-10 8:15 Kerin Millar
2025-08-10 1:22 Kerin Millar
2025-08-09 20:18 Kerin Millar
2025-08-09 19:42 Kerin Millar
2025-08-09 19:42 Kerin Millar
2025-08-09 19:42 Kerin Millar
2025-08-08 17:44 Kerin Millar
2025-08-08 17:44 Kerin Millar
2025-08-08 17:44 Kerin Millar
2025-08-08 17:44 Kerin Millar
2025-08-07 23:20 Kerin Millar
2025-08-07 23:20 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 19:43 Kerin Millar
2025-08-07 19:41 Kerin Millar
2025-08-07 19:41 Kerin Millar
2025-08-07 16:35 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-06 17:02 Kerin Millar
2025-08-06 7:44 Kerin Millar
2025-08-06 6:48 Kerin Millar
2025-08-05 23:00 Kerin Millar
2025-08-05 21:53 Kerin Millar
2025-08-05 21:53 Kerin Millar
2025-08-05 21:53 Kerin Millar
2025-08-05 10:55 Kerin Millar
2025-08-05 10:32 Kerin Millar
2025-08-05 10:29 Kerin Millar
2025-08-05 10:29 Kerin Millar
2025-08-04 16:02 Kerin Millar
2025-08-04 12:13 Kerin Millar
2025-08-04 12:13 Kerin Millar
2025-08-04 11:56 Kerin Millar
2025-08-04 11:25 Kerin Millar
2025-08-04 11:19 Sam James
2025-07-01 21:02 Andreas K. Hüttel
2023-05-11 22:23 Andreas K. Hüttel
2023-03-21 17:37 Andreas K. Hüttel
2021-09-27 6:49 Mike Frysinger
2021-09-27 6:49 Mike Frysinger
2021-09-27 6:49 Mike Frysinger
2021-09-27 6:49 Mike Frysinger
2021-09-27 6:49 Mike Frysinger
2021-09-27 6:49 Mike Frysinger
2021-09-27 5:46 Mike Frysinger
2021-08-06 21:09 Andreas K. Hüttel
2021-03-12 16:28 Mike Frysinger
2020-07-27 15:38 Andreas K. Hüttel
2020-07-27 10:36 Andreas K. Hüttel
2020-07-26 17:37 Andreas K. Hüttel
2020-07-26 17:37 Andreas K. Hüttel
2020-07-15 1:56 Andreas K. Hüttel
2020-07-15 1:56 Andreas K. Hüttel
2020-05-12 4:23 Andreas K. Hüttel
2020-05-12 4:23 Andreas K. Hüttel
2020-05-12 4:23 Andreas K. Hüttel
2020-05-12 4:23 Andreas K. Hüttel
2020-05-12 4:23 Andreas K. Hüttel
2020-05-12 4:23 Andreas K. Hüttel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox