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 BD885158200 for ; Sat, 13 Sep 2025 23:23:30 +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 A067C341052 for ; Sat, 13 Sep 2025 23:23:30 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id BC316110572; Sat, 13 Sep 2025 23:23:27 +0000 (UTC) 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) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id B60B7110572 for ; Sat, 13 Sep 2025 23:23:27 +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 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6F3D0340EC9 for ; Sat, 13 Sep 2025 23:23:27 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7D2393997 for ; Sat, 13 Sep 2025 23:23:25 +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: <1757803917.1c1b32c6af1e053338714a850503f632bd25f820.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: 1c1b32c6af1e053338714a850503f632bd25f820 X-VCS-Branch: master Date: Sat, 13 Sep 2025 23:23:25 +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: 5f3e8ba0-330c-4c82-b03a-6af8e5976b7f X-Archives-Hash: e42a2671c6677f158edea107a6fc568f commit: 1c1b32c6af1e053338714a850503f632bd25f820 Author: Kerin Millar plushkava net> AuthorDate: Sat Sep 13 22:51:57 2025 +0000 Commit: Kerin Millar plushkava 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 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 = $?) {