[Bug 279774] man(1) displays first file from current directory instead of .so file

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 15 Jun 2024 21:08:11 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=279774

            Bug ID: 279774
           Summary: man(1) displays first file from current directory
                    instead of .so file
           Product: Base System
           Version: 14.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: sean@donelan.com

Created attachment 251480
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=251480&action=edit
patch for usr.bin/man.sh to check null filename

When a manpage contains a .so link to a second manpage, man(1) displays first
file in current directory

The function exists() in man.sh uses file globbing to check if file exists.
When called with a null filename, such as when redirecting .so link to new
manpage file, globbing returns the name of the first file in the current
directory.

sean@clifden:~ % zgrep -e "^\.so" /usr/local/share/man/man1/doveadm-backup*
/usr/local/share/man/man1/doveadm-backup.1.gz:.so man1/doveadm-sync.1

sean@clifden:~ % man -w doveadm-backup
a-file-in-directory (source: "/usr/local/share/man/man1/doveadm-sync.1.gz")

Patched result

sean@clifden:/usr/bin % man -w doveadm-backup
/usr/local/share/man/man1/doveadm-sync.1.gz

-- 
You are receiving this mail because:
You are the assignee for the bug.