From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5441915808A for ; Tue, 05 Aug 2025 10:29:34 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 3ADB5340AB3 for ; Tue, 05 Aug 2025 10:29:34 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id EC2B21104A0; Tue, 05 Aug 2025 10:29:30 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id E18881104A0 for ; Tue, 05 Aug 2025 10:29:30 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7EF1C340AB3 for ; Tue, 05 Aug 2025 10:29:30 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1D6D832A1 for ; Tue, 05 Aug 2025 10:29:29 +0000 (UTC) From: "Kerin Millar" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Kerin Millar" Message-ID: <1754389486.4177dab14cfee01f5b9b29f3cbbb38635bba41c5.kfm@gentoo> Subject: [gentoo-commits] proj/locale-gen:master commit in: / X-VCS-Repository: proj/locale-gen X-VCS-Files: locale-gen X-VCS-Directories: / X-VCS-Committer: kfm X-VCS-Committer-Name: Kerin Millar X-VCS-Revision: 4177dab14cfee01f5b9b29f3cbbb38635bba41c5 X-VCS-Branch: master Date: Tue, 05 Aug 2025 10:29:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 72b717de-1c6f-4561-8f50-caf3e9ae84c4 X-Archives-Hash: 97a7720a8d18a73a04db17b061a4443a commit: 4177dab14cfee01f5b9b29f3cbbb38635bba41c5 Author: Kerin Millar plushkava net> AuthorDate: Tue Aug 5 00:45:31 2025 +0000 Commit: Kerin Millar plushkava 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 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.