commit: 4d24a40275db2a0f75cabccade0ef6ea63772194 Author: Kerin Millar <kfm <AT> plushkava <DOT> net> AuthorDate: Sat Sep 13 23:19:47 2025 +0000 Commit: Kerin Millar <kfm <AT> plushkava <DOT> net> CommitDate: Sat Sep 13 23:19:47 2025 +0000 URL: https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=4d24a402
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. Bug: https://bugs.gentoo.org/962817 Bug: https://bugs.gentoo.org/962753 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 index 9018e7b..8346877 100755 --- 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) {
