On 2005-10-14 21:42:16, Robert Bihlmeyer <ro...@orcus.priv.at> spake thus:
> I also support to put "Debian" into volume-operating-system. As
> upstream does not seem to like it, I guess the best option for Debian
> is to put
> 
> .ds volume-operating-system Debian
> 
> into the shipped version of /etc/groff/mdoc.local.
> 
> Rationale:
> 
> The intention of the titlebar is not really clear. Given a program
> "foo" written by an author neither affiliated with *BSD or Debian,
> should the output of "man 1 foo" pretend that the manpage is part of
> the "FreeBSD General Commands Manual" when run on FreeBSD and the
> "Debian General Commands Manual" when run on Debian? Or some other,
> constant value, because its actually the same program regardless of the
> distribution/OS?
> 
> My gut says the former, namely that the manpage, by virtue of it being
> included in the Debian distribution, becomes part of the mythical
> "Debian General Commands Manual", regardless of whether the GCM of
> some other distributions/OSes may include the same page.
> 
> The current situation, that the manpage is shown to be part of the
> "BSD General Commands Manual" even when we are on Debian GNU/Linux
> certainly is wrong. Even unsetting the variable would be better.
> 
> -- 
> Robbe
> 

Hi Folks,

I tripped over this issue today and found my way to this bug
report. The mdoc manpage for a tool I was working on rendered with
with the following headers and footer:


    FOO(1)          BSD General Commands Manual         FOO(1)

    NAME
        foo - Foobricate quuxels

    SYNOPSIS
    ...
    BSD                 October 14, 2020                   BSD


I love the BSDs as much as the next person, but that labeling is not
what I expected to see when rendering the page on my Debian
GNU/Linux host  ;-)

I have read Werner LEMBERG's comments[0] over on related issue
#176575, and agree that the upstream GNU Groff source is not the
right location for Debian labeling. But I also read the statement:

    "I think you should provide correct default values in mdoc.local --"

as confirmation that mdoc.local /is/ the right place for such
labeling. The attached patch (which I'm running on my main system
right now) provides that with the addition (in essence) of the
following lines:

    .ds doc-volume-operating-system Debian
    .ds doc-default-operating-system Debian\~GNU/Linux

The first affects the heading in an mdoc manpage, the second the
footer.

For completeness, I read the follow-up statement:

    "any man page which is specific to a certain operating system should
     say that by using .Os properly."

as meaning that authors of components that truly are specific to a
given operating system should explicitly name that OS as the
argument to the mdoc '.Os' macro:

    .Os Foonix

So this change is not overriding anything that is not intended to be
overridden by the distribution.

The attached patch (against groff-1.22.4) takes a hint from the
'base-files' package and adapts the labeling appropriate for build
host, using the $NAME value from the /etc/os-release file. On my
Debian GNU/Linux host, the header and footer are now rendered like
this:

    FOO(1)        Debian General Commands Manual        FOO(1)
    ...
    Debian GNU/Linux     October 14, 2020     Debian GNU/Linux

On Debian GNU/Hurd or GNU/kFreeBSD would presumably render with the
relative appropriately adapted labels (I didn't test them).

Please consider applying this patch or something like it to the
groff package.

Thanks,
-Al


[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=176575#10

-- 
-----------------------------------------------------------------
a l a n   d.   s a l e w s k i                 ads@salewski.email
                                                 salew...@att.net
-----------------------------------------------------------------
# Description: Add Debian labelling for mdoc manpages (mdoc.local)
# Author: "Alan D. Salewski" <ads@salewski.email>
# Bug-Debian: https://bugs.debian.org/284002
# Forwarded: not-needed
# Last-Update: 2020-10-14
diff -r -u groff-1.22.4-orig/debian/mandoc.local groff-1.22.4-chng/debian/mandoc.local
--- groff-1.22.4-orig/debian/mandoc.local	2020-05-06 04:24:11.000000000 -0400
+++ groff-1.22.4-chng/debian/mandoc.local	2020-10-14 18:45:16.102920887 -0400
@@ -27,3 +27,16 @@
 .      char \- \N'45'
 .  \}
 .\}
+
+.\" When rendering an mdoc manpage that has an empty .Os macro, the
+.\" 'doc-volume-operating-system' string is rendered in the center
+.\" heading at the top of the manpage.
+.\"
+.\" The 'doc-default-operating-system' string is rendered on both
+.\" the left and right at the bottom of the manpage.
+.\"
+.\" Yields .e.g, "Debian General Commands Manual"
+.ds doc-volume-operating-system Debian
+.\"
+.\" Renders as-is in mdoc manpage footer, left and right sides.
+.ds doc-default-operating-system %%%OSNAME%%%
diff -r -u groff-1.22.4-orig/debian/rules groff-1.22.4-chng/debian/rules
--- groff-1.22.4-orig/debian/rules	2020-05-06 04:24:11.000000000 -0400
+++ groff-1.22.4-chng/debian/rules	2020-10-14 21:14:47.752043014 -0400
@@ -91,8 +91,11 @@
 override_dh_install:
 	dh_install
 	# Debian additions to *.local
-	cat debian/mandoc.local >> $(gbtmp)/etc/groff/man.local
-	cat debian/mandoc.local >> $(gbtmp)/etc/groff/mdoc.local
+	# Note that /etc/os-release is provided by the 'base-files' package
+	OSNAME=$$(/bin/sh -c '. /etc/os-release; printf "$${NAME}"' \
+		| sed -e 's,[[:space:]],\\\\~,g') \
+	&& sed -e "s^%%%OSNAME%%%^$${OSNAME}^" debian/mandoc.local >> $(gbtmp)/etc/groff/man.local \
+	&& sed -e "s^%%%OSNAME%%%^$${OSNAME}^" debian/mandoc.local >> $(gbtmp)/etc/groff/mdoc.local
 	# Scripts should be executable
 	chmod +x $(gbtmp)/$(datadir)/font/devps/generate/afmname \
 		 $(gbtmp)/$(datadir)/font/devps/generate/symbol.sed

Reply via email to