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) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 94B1C1581FD for ; Sat, 13 Sep 2025 01:15:00 +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 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 7FA34341403 for ; Sat, 13 Sep 2025 01:15:00 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 7D66F1104B5; Sat, 13 Sep 2025 01:14:59 +0000 (UTC) Received: from smtp.gentoo.org (smtp.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 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 76D871104B5 for ; Sat, 13 Sep 2025 01:14:59 +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 F1468341403 for ; Sat, 13 Sep 2025 01:14:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5BFAA394D for ; Sat, 13 Sep 2025 01:14:57 +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: <1757725944.30b519f15fce4f78de28ccd49b829c327072f4a6.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: 30b519f15fce4f78de28ccd49b829c327072f4a6 X-VCS-Branch: master Date: Sat, 13 Sep 2025 01:14:57 +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: 4e8f9d81-f66e-4f8f-8782-efb78b82c40c X-Archives-Hash: db7b771738a9fa161a4a36750226b59c commit: 30b519f15fce4f78de28ccd49b829c327072f4a6 Author: Kerin Millar plushkava net> AuthorDate: Sat Sep 13 01:10:32 2025 +0000 Commit: Kerin Millar plushkava 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 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