bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #57485] [PATCH] accept any number of arguments for .Dd in the g


From: Steffen Nurpmeso
Subject: Re: [bug #57485] [PATCH] accept any number of arguments for .Dd in the groff_mdoc(7) macros
Date: Thu, 26 Dec 2019 21:06:00 +0100
User-agent: s-nail v14.9.15-262-g449d711c

Hi Ingo.

Ingo Schwarze wrote in <address@hidden>:
 |Follow-up Comment #1, bug #57485 (project groff):
 |
 |I'd like to stress that this patch indeed fixes a bug.  In 4.4BSD, 
 |it was *not* documented that .Dd requires exactly three arguments
 |and prints the current date otherwise, but several manual pages
 |existed that gave a single quoted argument of the form "Month day, 
 |year".  Documenting the weird behaviour of the groff_mdoc(7) macros
 |was done much later.  The mandoc(1) utility has been providing the

But that "later" was 20 years ago!  How many programmers even know
about things before that??  I for example have never seen anything
else, and it is in use in entire BSD land like that.

 |more useful behaviour proposed here for years, in a way that is in
 |particular compatible with the original 4.4BSD manual pages, and
 |it has been documenting the more useful behaviour for years, too.

No, not true.  I look at v14.4.4 from 2018-08-08 and there you
still say

     Dd               document date: $Mdocdate$ | month day, year

and you also do that in v14.4.5 which seems current?

 |So calling the current groff_mdoc(7) behaviour "documented behaviour"
 |is misleading.  At some point, a bug was documented instead of fixed 
 |in groff, a bug that broke the formatting of even the original 4.4BSD
 |manuals, i.e. those of the system where these macros came from.

And i have to go back to

  .\"     @(#)tmac.doc.old        5.2 (Berkeley) 3/13/91
  .\"     Slightly modified by address@hidden to work with groff as well.

where Dd exists as

  .de Dd
  .nr aa 0
  .ie \\n(.$>0 \{\
  .       ie \\n(.$<4 \{\
  .               ds dD \\$1 \\$2 \\$3
  .       \}
  .       el .tm Usage: .Dd Month Day, Year (e.g July 4, 1977).
  .\}
  .el \{\
  .       ds dD Epoch
  .\}

And that behaviour i think is sensible, though ==3 would be
better, and even better would likely be to ".ds dD Epoch" and only
overwrite it on request, since .Dd should be present in every mdoc
document me thinks.
I mean, FreeBSD imported groff very early, for example, so we are
talking about multiple generations of programmers here!

 |To clarify two minor details:
 |
 |Losing unbreakable spaces is totally irrelevant.  For any sane 
 |input, the footer line is always a single line only; no linebreaks
 |occur.

Maybe.  But with the constraint that one reason for this is that
many tools especially on Linux are not properly, or not at all
documented.  Names like dbus-update-activation-environment could
become a problem in conjunction with a date and something else
a little longer.  Not that anyone cares the manual for the
mentioned does not care for 80 columns anyway, so wtf.

 |Of course this ticket only applies to the non-Mdocdate case,
 |nothing changes for Mdocdate.

Yep.
Well, i personally would rather do something like

  diff --git a/tmac/mdoc-common b/tmac/mdoc-common
  index a2d0cc63..00589e0d 100644
  --- a/tmac/mdoc-common
  +++ b/tmac/mdoc-common
  @@ -808,6 +808,7 @@
   .    el .ie (\n[.$] == 3) \
   .      ds doc-date-string \$1\~\$2 \$3
   .    el \{\
  +.      tm mdoc warning: .Dd directive falsely used
   .      ds doc-date-string "\*[doc-date-\n[mo]]
   .      as doc-date-string \~\n[dy], \n[year]
   .    \}

but forgive the wording etc.  Maybe even

  diff --git a/tmac/mdoc-common b/tmac/mdoc-common
  index a2d0cc63..f7eb574f 100644
  --- a/tmac/mdoc-common
  +++ b/tmac/mdoc-common
  @@ -798,6 +798,7 @@
   .ds doc-date-10 October
   .ds doc-date-11 November
   .ds doc-date-12 December
  +.ds doc-date-string Epoch
   .
   .de Dd
   .  ds doc-command-name
  @@ -807,13 +808,8 @@
   .      ds doc-date-string \$2\~\$3, \$4
   .    el .ie (\n[.$] == 3) \
   .      ds doc-date-string \$1\~\$2 \$3
  -.    el \{\
  -.      ds doc-date-string "\*[doc-date-\n[mo]]
  -.      as doc-date-string \~\n[dy], \n[year]
  -.    \}
  +.    el .tm mdoc warning: .Dd directive falsely used
   .  \}
  -.  el \
  -.    ds doc-date-string Epoch
   ..
   .
   .

and not taking into account that the el..ie is falsely grouped and
provokes -w warnings like a lot of other stuff that ships with
groff.  (Like a NetBSD thread has revealed just a few days ago.)

 |Reply to this item at:
 |
 |  <https://savannah.gnu.org/bugs/?57485>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]