commit:     a2a247b76c7fc7956ceffb96d8b34d1cd886f9eb
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Tue Oct 28 15:49:36 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Tue Oct 28 16:52:41 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=a2a247b7

Avoid the invocation of a shell in is_eq_file()

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 locale-gen | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/locale-gen b/locale-gen
index 3449aef..da6565a 100644
--- a/locale-gen
+++ b/locale-gen
@@ -718,9 +718,10 @@ 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" };
+       # Compare the inode numbers, just as the test(1) -ef operator does.
+       my @stat1 = stat $path1;
+       my @stat2 = stat $path2;
+       return @stat1 && @stat2 && $stat1[1] == $stat2[1];
 }
 
 END {

Reply via email to