Bug 289683 - OS installation with legacy files: results of 'man -k' are incomplete
Summary: OS installation with legacy files: results of 'man -k' are incomplete
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 15.0-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: install
Depends on:
Blocks: 15.0-metabug
  Show dependency treegraph
 
Reported: 2025-09-18 11:59 UTC by Graham Perrin
Modified: 2025-11-15 17:21 UTC (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Graham Perrin 2025-09-18 11:59:10 UTC
Spun off from <https://lists.freebsd.org/archives/freebsd-stable/2025-September/003158.html>. 

base ea5e50c2985b this morning is for OS installation with packages. 

I see a similar situation with legacy files instead of packages. Reproducible. 

In the example below, 
man -k dtrace
finds nothing until after a run of 
makewhatis

----

Script started on Thu Sep 18 12:48:51 2025
root@whatis:~ # echo $SHELL
/bin/sh
root@whatis:~ # freebsd-version -kru ; uname -mvKU
15.0-ALPHA2
15.0-ALPHA2
15.0-ALPHA2
FreeBSD 15.0-ALPHA2 stable/15-n280122-da62a299de31 GENERIC amd64 1500064 1500064
root@whatis:~ # uptime
12:49PM  up 41 secs, 1 user, load averages: 0.16, 0.04, 0.01
root@whatis:~ # man -k dtrace
apropos: nothing appropriate
root@whatis:~ # makewhatis
root@whatis:~ # man -k dtrace
dtrace(1) - dynamic tracing compiler and tracing utility
dwatch(1) - watch processes as they trigger a particular DTrace probe
plockstat(1) - Trace pthread lock statistics using DTrace
dtrace_audit, dtaudit(4) - A DTrace provider for tracing audit 4 events
dtrace_dtrace(4) - a DTrace provider for BEGIN, END, and ERROR probes
dtrace_fbt(4) - a DTrace provider for dynamic kernel tracing based on function boundaries
dtrace_io(4) - a DTrace provider for tracing events related to disk I/O
dtrace_ip(4) - a DTrace provider for tracing events related to the IPv4 and IPv6 protocols
dtrace_kinst(4) - a DTrace provider for tracing arbitrary instructions in a given kernel function
dtrace_lockstat(4) - a DTrace provider for tracing kernel locking events
dtrace_proc(4) - a DTrace provider for tracing events related to user processes
dtrace_profile(4) - a DTrace provider for firing probes at a given time interval
dtrace_sched(4) - a DTrace provider for tracing CPU scheduling events
dtrace_sctp(4) - a DTrace provider for tracing events related to the sctp 4 protocol
dtrace_tcp(4) - a DTrace provider for tracing events related to the tcp 4 protocol
dtrace_udp(4) - a DTrace provider for tracing events related to the UDP protocol
dtrace_udplite(4) - a DTrace provider for tracing events related to the UDP-Lite protocol
d, D(7) - DTrace scripting language overview
SDT, SDT_PROBE_DECLARE, SDT_PROBE_DEFINE, SDT_PROVIDER_DECLARE, SDT_PROVIDER_DEFINE, SDT_PROBE(9) - a DTrace framework for adding statically-defined tracing probes
root@whatis:~ # exit

Script done on Thu Sep 18 12:49:26 2025
Comment 1 Mark Johnston freebsd_committer freebsd_triage 2025-09-19 15:49:14 UTC
I can reproduce this.  In an alpha1 chroot:

# man -k dtrace
dtrace(1) - dynamic tracing compiler and tracing utility
dwatch(1) - watch processes as they trigger a particular DTrace probe
plockstat(1) - Trace pthread lock statistics using DTrace
# strings mandoc.db | grep dtrace
dtrace
man1/dtrace.1.gz
dtrace(1)
dtrace_audit(4)
dtrace_dtrace(4)
dtrace_fbt(4)
dtrace_io(4)
dtrace_ip(4)
dtrace_kinst(4)
dtrace_lockstat(4)
dtrace_proc(4)
dtrace_profile(4)
dtrace_sched(4)
dtrace_sctp(4)
dtrace_tcp(4)
dtrace_udp(4)
dtrace_udplite(4)
/boot/dtrace.dof
/usr/lib/dtrace
dtrace
security.bsd.allow_destructive_dtrace
# pwd
/usr/share/man
# ls -la mandoc.db 
-rw-r--r--  1 root wheel 510076 Sep  6 19:26 mandoc.db
# makewhatis .
# ls -la mandoc.db 
-rw-r--r--  1 root wheel 3295356 Sep 19 15:48 mandoc.db
Comment 2 Dag-Erling Smørgrav freebsd_committer freebsd_triage 2025-09-19 16:21:50 UTC
mandoc.db is generated as part of the afterinstall target in etc/Makefile.  It seems this runs earlier now than it used to, so it doesn't see the full set of manual pages.  I wasn't able to find out when exactly the order changed, but 14.3 does not have this issue.  The easiest solution is probably to move this logic out of etc/Makefile and into Makefile.inc1.
Comment 3 commit-hook freebsd_committer freebsd_triage 2025-11-02 17:45:44 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=dcb6706ba494f34e2a2ce97e5c5f2867b9e1f5ef

commit dcb6706ba494f34e2a2ce97e5c5f2867b9e1f5ef
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-11-02 04:22:26 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-02 17:45:31 +0000

    Makefile.incl1: .WAIT before distribute in etc

    In order to make sure that man pages are all installed before we run
    makewhatis to generate mandoc.db files, we have long placed etc at the
    end of the list of subdirectories being recursed into by the build.
    In order to support installworld -jN, a .WAIT was more recently added
    here.

    With the recent adoption by the release engineering team of parallel
    *release* builds (aka 'make release -jN') it is now also necessary to
    add the same .WAIT before recursing for the 'distribute' target, as we
    otherwise end up with distribution sets containing incomplete mandoc.db
    files.

    Reviewed by:    bdrewery
    PR:             289683
    MFC after:      3 days
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D53533

 Makefile.inc1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 4 commit-hook freebsd_committer freebsd_triage 2025-11-05 22:04:08 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b9e5c888ef28d02caff974938bbfb1d5fff3b20b

commit b9e5c888ef28d02caff974938bbfb1d5fff3b20b
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-11-02 04:22:26 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-05 22:03:21 +0000

    Makefile.incl1: .WAIT before distribute in etc

    In order to make sure that man pages are all installed before we run
    makewhatis to generate mandoc.db files, we have long placed etc at the
    end of the list of subdirectories being recursed into by the build.
    In order to support installworld -jN, a .WAIT was more recently added
    here.

    With the recent adoption by the release engineering team of parallel
    *release* builds (aka 'make release -jN') it is now also necessary to
    add the same .WAIT before recursing for the 'distribute' target, as we
    otherwise end up with distribution sets containing incomplete mandoc.db
    files.

    Reviewed by:    bdrewery
    PR:             289683
    MFC after:      3 days
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D53533

    (cherry picked from commit dcb6706ba494f34e2a2ce97e5c5f2867b9e1f5ef)

 Makefile.inc1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2025-11-06 23:12:44 UTC
A commit in branch releng/15.0 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=299dfb3cec6b3953c7a4697efd57659a4ae4e3e0

commit 299dfb3cec6b3953c7a4697efd57659a4ae4e3e0
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-11-02 04:22:26 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-06 23:11:15 +0000

    Makefile.incl1: .WAIT before distribute in etc

    In order to make sure that man pages are all installed before we run
    makewhatis to generate mandoc.db files, we have long placed etc at the
    end of the list of subdirectories being recursed into by the build.
    In order to support installworld -jN, a .WAIT was more recently added
    here.

    With the recent adoption by the release engineering team of parallel
    *release* builds (aka 'make release -jN') it is now also necessary to
    add the same .WAIT before recursing for the 'distribute' target, as we
    otherwise end up with distribution sets containing incomplete mandoc.db
    files.

    Approved by:    re (cperciva)
    Reviewed by:    bdrewery
    PR:             289683
    MFC after:      3 days
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D53533

    (cherry picked from commit dcb6706ba494f34e2a2ce97e5c5f2867b9e1f5ef)
    (cherry picked from commit 48dbf763337aea30e29971e751d3aa1044a555ef)

 Makefile.inc1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)