commit: 2fd0df367ce494dae677b912c453530cd738283a Author: Kerin Millar <kfm <AT> plushkava <DOT> net> AuthorDate: Sat Sep 13 23:47:07 2025 +0000 Commit: Kerin Millar <kfm <AT> plushkava <DOT> net> CommitDate: Sat Sep 13 23:49:18 2025 +0000 URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=2fd0df36
Ignore findmnt(8) exiting 1 where / is not a mountpoint Presently, the has_mount_option() subroutine executes findmnt(8) so as to determine the mount options of the mountpoint subsuming the directory that is intended to contain the locale archive. However, in some cases, such as where using qemu-user, no / mountpoint exists. In that case, it is highly probable that findmnt -T will recurse upwards until it reaches /, only to exit 1 because it cannot be resolved. Address this issue by disregarding an exit status of 1 in the case that / is found not to be a mountpoint. Closes: https://bugs.gentoo.org/962817 Reported-by: jiakang.cjk <AT> aliyun.com Tested-by: Nicolas PARLANT <nicolas.parlant <AT> parhuet.fr> Signed-off-by: Kerin Millar <kfm <AT> plushkava.net> locale-gen | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/locale-gen b/locale-gen old mode 100755 new mode 100644 index 9018e7b..8346877 --- a/locale-gen +++ b/locale-gen @@ -652,15 +652,16 @@ sub dirname ($path) { } sub has_mount_option ($target, $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,/; - } + # 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,/; } sub can_run ($bin) {
