Fix man completions on macOS with symlinked manpath

When `manpath` prints a symlink to a directory, `/usr/libexec/makewhatis`
ignores the entire directory:

```
$ /usr/libexec/makewhatis -o /tmp/whatis \
    (/usr/bin/manpath | string split :)
makewhatis: /Users/wiggles/.nix-profile/share/man: Not a directory
```

This means that the built-in `man` completions will not index any commands in
these directories.

If we pass the directories to `readlink -f` first, `makewhatis` correctly
indexes the `man` pages.

```
$ /usr/libexec/makewhatis -o /tmp/whatis \
    (/usr/bin/manpath | string split : | xargs readlink -f)
```
This commit is contained in:
Rebecca Turner 2024-09-10 16:37:07 -07:00 committed by Peter Ammon
parent bc55945072
commit a6c8cd6e85

View File

@ -40,7 +40,7 @@ if test $status -eq 0 -a (count $sysver) -eq 3
if test $age -ge $max_age
test -d "$dir" || mkdir -m 700 -p $dir
/usr/libexec/makewhatis -o "$whatis" (/usr/bin/manpath | string split :) >/dev/null 2>&1 </dev/null &
/usr/libexec/makewhatis -o "$whatis" (/usr/bin/manpath | string split : | xargs readlink -f) >/dev/null 2>&1 </dev/null &
disown $last_pid
end
end