commit:     42a137eb54c2adba26d4030b981bdf3a1433534e
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Sep 13 23:43:54 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Sat Sep 13 23:45:48 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=42a137eb

Revert "Ignore findmnt(8) exiting 1 where / is not a mountpoint"

This reverts commit 4d24a40275db2a0f75cabccade0ef6ea63772194. This is
only so that it may be re-applied with a commit message that mentions
both the bug reporter and tester.

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

 locale-gen | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/locale-gen b/locale-gen
index 8346877..9018e7b 100755
--- a/locale-gen
+++ b/locale-gen
@@ -652,16 +652,15 @@ sub dirname ($path) {
 }
 
 sub has_mount_option ($target, $option) {
-       # Per bug 962817, / may not necessarily exist as a mountpoint. Assuming
-       # it does not, ignore the case that findmnt(8) exits with a status of 1.
-       local $ENV{'TARGET'} = $target;
-       my $stdout = qx{
-               findmnt -no options -T "\$TARGET"
-               case \$? in 1) ! mountpoint -q / ;; *) exit "\$?" ;; esac
-       };
-       throw_child_error('findmnt');
-       chomp $stdout;
-       return ",$stdout," =~ m/\Q,$option,/;
+       if (! open my $pipe, '-|', qw( findmnt -no options -T ), $target) {
+               exit 1;
+       } else {
+               chomp(my $stdout = do { local $/; readline $pipe });
+               if (! close $pipe && $! == 0) {
+                       throw_child_error('findmnt');
+               }
+               return ",$stdout," =~ m/\Q,$option,/;
+       }
 }
 
 sub can_run ($bin) {

Reply via email to