The format code `%N` doesn't appear at all, even though it is definitely found in the manual source code: https://github.com/freebsd/freebsd-src/blob/release/14.1.0/bin/date/date.1 Reported by: jinwookjeongg@gmail.com via hackers@.
(In reply to Mateusz Piotrowski from comment #0) I can see it working in stable/15. Could you explain your use case where it fails?
(In reply to Marek Zarychta from comment #1) This is specifically about man page rendering on the website, i.e. https://man.freebsd.org/cgi/man.cgi?query=date. See e.g. the STANDARDS subsection. Output from man(1): The ‘%N’ conversion specification for nanoseconds is a non-standard extension. It is compatible with GNU date's ‘%N’. Website version: The `conversion specification for nanoseconds is a non-standard extension. It is compatible with GNU date's `''
It is not just the %N symbol itself that is not rendering correctly on https://man.freebsd.org/cgi/man.cgi?query=date Viewing source to see the raw html: > <a name="HISTORY" href="#end"><b>HISTORY</b></a> > A <b>date</b> command appeared in Version 1 AT&T UNIX. > ... > The <b>-I</b> flag was added in FreeBSD 12.0. > > The `conversion specification was added in FreeBSD' Compare that last line to the man page: https://github.com/freebsd/freebsd-src/blob/release/14.1.0/bin/date/date.1 > The > .Ql %N > conversion specification was added in > .Fx 14.1 . The "14.1" has been "eaten" by the %N. Interestingly, html output from mandoc is fine: > mandoc -T html date.1 Produces: > <p class="Pp">The ‘<code class="Li">%N</code>’ conversion > specification was added in <span class="Ux">FreeBSD 14.1</span>.</p> This renders correctly - but man.freebsd.org clearly does not use mandoc html.
I believe man.freebsd.org uses groff(1) (version 1.23.0?) which struggles with %N presumably as it is a references & citations macro for issue number: see https://man.freebsd.org/cgi/man.cgi?query=groff_mdoc To replicate the website's History section error: $ groff -mdoc -T html date.1 > <p style="margin-left:9%; margin-top: 1em">The > <b>−I</b> flag was added in FreeBSD 12.0.</p> > > <p style="margin-left:9%; margin-top: 1em">The > ‘conversion specification was added in FreeBSD’ Or in plain ASCII, generating an mdoc warning: $ groff -a -mdoc > The <->I flag was added in FreeBSD 12.0. > mdoc warning: Using a macro as first argument cancels effect of .Li (#618) > Usage: .%N issue_number ... (#618) > The <oq>conversion specification was added in FreeBSD<cq> While mandoc(1) generates the desired html, it still warns with -Tlint: $ mandoc -Tlint date.1 > mandoc: date.1:146:8: WARNING: skipping empty macro: No > mandoc: date.1:331:5: WARNING: macro neither callable nor escaped: %N > mandoc: date.1:594:5: WARNING: macro neither callable nor escaped: %N > mandoc: date.1:597:5: WARNING: macro neither callable nor escaped: %N > mandoc: date.1:618:5: WARNING: macro neither callable nor escaped: %N > mandoc: date.1:198:2: STYLE: useless macro: Tn > mandoc: date.1:511:2: STYLE: useless macro: Tn
Each "%N" in date.1 should be escaped as "\&%N", as done in https://github.com/freebsd/freebsd-src/blob/main/contrib/mandoc/mdoc.7 Post-sed, the groff output is much better: > <p style="margin-left:9%; margin-top: 1em">The > <b>−I</b> flag was added in FreeBSD 12.0.</p> > > <p style="margin-left:9%; margin-top: 1em">The > ‘%N’ conversion specification was added in > FreeBSD 14.1. FreeBSD 14.3 September 10, 2024 > DATE(1)</p>
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=e878ba8eea7206b3a435338c6eed0e4264e0ce14 commit e878ba8eea7206b3a435338c6eed0e4264e0ce14 Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-11-05 12:34:31 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-11-05 12:36:35 +0000 date.1: Lint with mandoc Specifically, remove Tn macors, replace Li with Ql, and escape %N to address date.1's rendering issues on man.freebsd.org. PR: 290801 Reported by: jinwookjeongg@gmail.com MFC after: 1 week Sponsored by: Klara, Inc. bin/date/date.1 | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
Thanks everyone! I've committed a fix.
A commit in branch stable/15 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6ef503c80ff3d5d219b30e63124f704721148a4b commit 6ef503c80ff3d5d219b30e63124f704721148a4b Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-11-05 12:34:31 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-11-12 09:43:34 +0000 date.1: Lint with mandoc Specifically, remove Tn macors, replace Li with Ql, and escape %N to address date.1's rendering issues on man.freebsd.org. PR: 290801 Reported by: jinwookjeongg@gmail.com MFC after: 1 week Sponsored by: Klara, Inc. (cherry picked from commit e878ba8eea7206b3a435338c6eed0e4264e0ce14) bin/date/date.1 | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)
A commit in branch stable/14 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=6c185061a63b6db6676c6a24e6bf0802774a07fa commit 6c185061a63b6db6676c6a24e6bf0802774a07fa Author: Mateusz Piotrowski <0mp@FreeBSD.org> AuthorDate: 2025-11-05 12:34:31 +0000 Commit: Mateusz Piotrowski <0mp@FreeBSD.org> CommitDate: 2025-11-12 09:43:49 +0000 date.1: Lint with mandoc Specifically, remove Tn macors, replace Li with Ql, and escape %N to address date.1's rendering issues on man.freebsd.org. PR: 290801 Reported by: jinwookjeongg@gmail.com MFC after: 1 week Sponsored by: Klara, Inc. (cherry picked from commit e878ba8eea7206b3a435338c6eed0e4264e0ce14) bin/date/date.1 | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-)