NetBSD Problem Report #59655
From www@netbsd.org Sun Sep 14 16:19:48 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature RSA-PSS (2048 bits)
client-signature RSA-PSS (2048 bits))
(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
by mollari.NetBSD.org (Postfix) with ESMTPS id 682561A923C
for <gnats-bugs@gnats.NetBSD.org>; Sun, 14 Sep 2025 16:19:48 +0000 (UTC)
Message-Id: <20250914161946.ECE8F1A923D@mollari.NetBSD.org>
Date: Sun, 14 Sep 2025 16:19:46 +0000 (UTC)
From: rwhitlock22@gmail.com
Reply-To: rwhitlock22@gmail.com
To: gnats-bugs@NetBSD.org
Subject: man pages report incorrect OS version when running later kernel
X-Send-Pr-Version: www-1.0
>Number: 59655
>Category: misc
>Synopsis: man pages report incorrect OS version when running later kernel
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: misc-bug-people
>State: open
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Sun Sep 14 16:20:00 +0000 2025
>Last-Modified: Sun Sep 14 20:30:01 +0000 2025
>Originator: Robert Whitlock
>Release: NetBSD 11.99.2 kernel with 10.99.14 userland
>Organization:
>Environment:
NetBSD thinkpad 11.99.2 NetBSD 11.99.2 (kerncompile) #0: Sat Sep 13 23:35:40 EDT 2025 rob@thinkpad:/usr/netbsd/current/build/THINKPAD/kerncompile amd64
>Description:
If update your kernel so that you are running a kernel that is newer than your userland then many man pages report an incorrect OS version for the OS that they were from. For instance, printf(3) reports that it is from version 11.99.2 if your kernel is 11.99.2, even though printf comes from libc, which is a userland library, and so should correspond to the version of the userland that was installed.
This seems to be because the man pages use the .Os directive with no further arguments to denote the OS version, which presumably uses the version of the kernel.
>How-To-Repeat:
Install NetBSD.
Compile a newer kernel.
Install the newer kernel and reboot.
man 3 printf
>Fix:
Add explicit version information to the .Os directives in the man pages. This should be parameterized so that the build resolves the arguments of .Os to be the version of the OS that is being built. After the man pages are built during the userland build, the OS version arguments for .Os would be plain text and so would not depend on the specific kernel version that is running.
Perhaps some thought could be given to the possibility of whether it would be desirable to avoid updating the version if the interface has not changed.
>Audit-Trail:
From: Kimmo Suominen <kim@netbsd.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: misc/59655: man pages report incorrect OS version when running
later kernel
Date: Sun, 14 Sep 2025 23:27:14 +0300
On Sun, Sep 14, 2025 at 04:20:00PM +0000, rwhitlock22@gmail.com wrote:
> If update your kernel so that you are running a kernel that is newer
> than your userland then many man pages report an incorrect OS version
> for the OS that they were from. For instance, printf(3) reports that
> it is from version 11.99.2 if your kernel is 11.99.2, even though
> printf comes from libc, which is a userland library, and so should
> correspond to the version of the userland that was installed.
>
> This seems to be because the man pages use the .Os directive with no
> further arguments to denote the OS version, which presumably uses the
> version of the kernel.
This is just a symptom of how mandoc(1) is computing the default value
for the Os macro using uname(3).
https://github.com/NetBSD/src/blob/6cee2c5b88e06440257c4c8ad704f388954c9fb0/external/bsd/mdocml/dist/mdoc_validate.c#L2892
For nroff/troff the default value is part of the macro definitions, and
is not affected by the return value of uname(3).
https://github.com/NetBSD/src/blob/6cee2c5b88e06440257c4c8ad704f388954c9fb0/external/gpl2/groff/tmac/mdoc.local#L46
So in my opinion, this is not an issue with the manual pages themselves
but rather with mandoc(1).
Maybe the default value for Os should be definable in man.conf(5).
In any case, this is not really a bug, but rather "works as designed".
Proposals for changing the behaviour are probably best addressed on one
of the many mailing lists.
Kind regards,
+ Kimmo
(Contact us)
$NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2025
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.