From f3f231cf70d1702b1a44a1297e2d8089beb19132 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 15 Nov 2025 14:32:26 +0100 Subject: [PATCH] __fish_apropos: assume only /usr/bin/apropos is broken As discovered in #12062, man-db as installed from brew is not affected by the "read-only-filesystem" problem what makewhatis suffers from (though users do need to run "gmandb" once). Restrict the workaround to the path to macOS's apropos; hopefully that's stable. This breaks people who define an alias for apropos; I guess for those we could check "command -v" instead, but that's weird because the thing found by type is the actual thing we're gonna execute. So I'd first rather want to find out why anyone would override this obscure command. --- share/functions/__fish_apropos.fish | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/functions/__fish_apropos.fish b/share/functions/__fish_apropos.fish index c25c8a467..d826be325 100644 --- a/share/functions/__fish_apropos.fish +++ b/share/functions/__fish_apropos.fish @@ -17,6 +17,12 @@ if test (__fish_uname) = Darwin function __fish_apropos -V dir # macOS has a read only filesystem where the whatis database should be. + + if functions -q apropos || test "$(command -v apropos)" != /usr/bin/apropos + __fish_without_manpager apropos "$argv" + return + end + # The whatis database is non-existent, so apropos tries (and fails) to create it every time, # which can take seconds. # @@ -32,7 +38,7 @@ if test (__fish_uname) = Darwin set age (path mtime -R -- $whatis) end - MANPATH="$dir" __fish_without_manpager apropos "$argv" + MANPATH="$dir" __fish_without_manpager /usr/bin/apropos "$argv" if test $age -ge $max_age test -d "$dir" || mkdir -m 700 -p $dir