From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailout.scc.kit.edu (mailout.scc.kit.edu [129.13.185.202]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id rAB7gv4i028374 for ; Mon, 11 Nov 2013 02:42:58 -0500 (EST) Received: from hekate.usta.de (asta-nat.asta.uni-karlsruhe.de [172.22.63.82]) by scc-mailout-02.scc.kit.edu with esmtp (Exim 4.72 #1) id 1Vfm99-0000bQ-H7; Mon, 11 Nov 2013 08:42:55 +0100 Received: from donnerwolke.usta.de ([172.24.96.3]) by hekate.usta.de with esmtp (Exim 4.77) (envelope-from ) id 1Vfm99-0001g5-F1; Mon, 11 Nov 2013 08:42:55 +0100 Received: from iris.usta.de ([172.24.96.5] helo=usta.de) by donnerwolke.usta.de with esmtp (Exim 4.72) (envelope-from ) id 1Vfm99-0002rh-EH; Mon, 11 Nov 2013 08:42:55 +0100 Received: from schwarze by usta.de with local (Exim 4.77) (envelope-from ) id 1Vfm99-0002gv-46; Mon, 11 Nov 2013 08:42:55 +0100 Date: Mon, 11 Nov 2013 08:42:54 +0100 From: Ingo Schwarze To: discuss@mdocml.bsd.lv, groff@gnu.org Cc: "Anthony J. Bentley" , =?iso-8859-1?Q?J=E9r=E9mie_Courr=E8ges-Anglas?= Subject: an-old.tmac: without preceding RS, RE wrongly resets left margin Message-ID: <20131111074254.GB26659@iris.usta.de> References: <22208.1384115694@cathet.us> X-Mailinglist: mdocml-discuss Reply-To: discuss@mdocml.bsd.lv MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22208.1384115694@cathet.us> User-Agent: Mutt/1.5.21 (2010-09-15) Hi, Anthony J. Bentley wrote on Sun, Nov 10, 2013 at 01:34:54PM -0700: > Consider this man(7) source, based on gpg.1: > > .TP > foo > bar > .RE > .PP > baz Actually, the point is that there is no preceding .RS. A complete test case is: .TH RS-LONELYRE 1 "November 10, 2013" OpenBSD .SH NAME RS-lonelyRE \- closing RS that is not open .SH DESCRIPTION .TP 6n tag body .RE out of body > mandoc -Tlint complains (via man_macro.c:blk_close()): > > ERROR: skipping end of block that is not open groff(1) does not complain, which might be something else that one could fix, but i'm keeping this patch minimal for now to make review easier. > and formats like so: > > foo bar > > baz OK, the man(7) code we have to process here is buggy, RE without preceding RS is structurally invalid. That said, i think what mandoc(1) does is the best way to deal with this bad situation. > Groff formats like so: > > foo bar > > baz That seems like a bug. Under no circumstances should the outer left margin be violated. Only .SH headers should go that far left. See below for a proposed fix to groff's tmac/an-old.tmac: - Whenever (re)setting \n[an-level] to 1 - which happens when encountering .TH, .SH, and .SS - make sure to also (re)set \n[an-saved-margin1] and \n[an-saved-prevailing-indent1] to a sane value such that immediate .RE cannot wreak havoc. - As .set-an-margin is always preceded by .nr an-level 1 and followed by .nr an-prevailing-indent \\n[IN], and since these form a logical unit of action, pull the latter two into .de set-an-margin. Comments and testing reports welcome. I tested on the complete set of OpenBSD base system manuals and found no regressions. Rather, the formatting of the nslookup(1) manual improves. Yours, Ingo Index: tmac/an-old.tmac =================================================================== RCS file: /sources/groff/groff/tmac/an-old.tmac,v retrieving revision 1.67 diff -u -r1.67 an-old.tmac --- tmac/an-old.tmac 16 Jul 2013 07:20:48 -0000 1.67 +++ tmac/an-old.tmac 11 Nov 2013 07:34:39 -0000 @@ -122,7 +122,11 @@ .\} . .de set-an-margin +. nr an-level 1 . nr an-margin \\n[IN] +. nr an-saved-margin1 \\n[IN] +. nr an-prevailing-indent \\n[IN] +. nr an-saved-prevailing-indent1 \\n[IN] .. . .ds an-extra1 @@ -198,9 +202,7 @@ . PD . if !r SN \ . nr SN 3n \" the indentation of sub-sub-headings relative to sub-headings -. nr an-level 1 . set-an-margin -. nr an-prevailing-indent \\n[IN] . nr an-tag-sep 1n . . nr an-no-space-flag 0 @@ -342,9 +344,7 @@ . .de1 SH . sp \\n[PD]u -. nr an-level 1 . set-an-margin -. nr an-prevailing-indent \\n[IN] . fi . in \\n[an-margin]u . ti 0 @@ -361,9 +361,7 @@ . .de1 SS . sp \\n[PD]u -. nr an-level 1 . set-an-margin -. nr an-prevailing-indent \\n[IN] . fi . in \\n[IN]u . ti \\n[SN]u -- To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv