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) {