[Bug 287037] man(1) runs in endless loop

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 24 May 2025 06:56:31 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287037

            Bug ID: 287037
           Summary: man(1) runs in endless loop
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: wosch@FreeBSD.org

I noticed that man(1) crashed for some ports manual pages. The shell script
man.sh limit the CPU usage to catch problems in the mandoc or groff toolchain.
But in this case the shell scripts killed itself after 20 seconds due the high
CPU usage.

How to repeat:

mkdir -p  man/man3
echo '.so man3/m.3' | gzip > man/man3/m.3.gz
/usr/bin/man man/man3/m.3.gz 
Killed

or in debug mode:
/usr/bin/man -d man/man3/m.3.gz 
-- Using architecture: amd64:amd64
-- Using pager: less -s
-- Searching PATH for man directories
--   Adding /usr/share/man to manpath
--   Adding /usr/local/share/man to manpath
-- Adding default manpath entries
--   Adding /usr/share/openssl/man to manpath
-- Parsing config file: /usr/local/etc/man.d/perl5.conf
--   Adding /usr/local/lib/perl5/site_perl/man to manpath
--   Adding /usr/local/lib/perl5/5.36/perl/man to manpath
-- Using manual path:
/usr/share/man:/usr/local/share/man:/usr/share/openssl/man:/usr/local/lib/perl5/site_perl/man:/usr/local/lib/perl5/5.36/perl/man
-- Using manual sections: 1:8:2:3:3lua:n:4:5:6:7:9:l
-- Using locale paths: .
-- Using standard page width
-- Searching for "man/man3/m.3.gz"
-- Found a usable page, displaying that
-- man/man3/m.3.gz includes man3/m.3
--     Found manpage "/tmp/man/man3/../man3/m.3.gz"
--     Skipping catpage: not found or old
-- /tmp/man/man3/../man3/m.3.gz includes man3/m.3
--     Found manpage "/tmp/man/man3/../man3/m.3.gz"
--     Skipping catpage: not found or old
-- /tmp/man/man3/../man3/m.3.gz includes man3/m.3
--     Found manpage "/tmp/man/man3/../man3/m.3.gz"
--     Skipping catpage: not found or old
[...]

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