commit: 888b7b5106d7f2c860b54d800f5c844044aed76b
Author: Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Oct 28 02:25:01 2025 +0000
Commit: Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Oct 28 02:25:01 2025 +0000
URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=888b7b51
Check whether --prefix refers to / in a more reliable way
Use the -ef operator of the test(1) utility to determine whether the
--prefix option-argument refers to the same directory entry as the root
directory itself.
See-also: 21ae7e5f4825f082191a5adcabccb7c642b81c86
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 0a891f5..3449aef 100644
--- a/locale-gen
+++ b/locale-gen
@@ -124,7 +124,7 @@ umask 0022;
};
# Install the new locale archive.
- my $is_prefixed = $prefix ne '' && $prefix ne '/';
+ my $is_prefixed = length $prefix && ! is_eq_file($prefix, '/');
my $size = install_archive($src_path, $dst_path, ! $is_prefixed);
my $total = scalar @locales + scalar %installed_by;
@@ -717,6 +717,12 @@ sub print_warning ($warning) {
}
}
+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" };
+}
+
END {
if ($$ == $PID) {
if (@TEMPFILES) {