bugGNU roff - Bugs: bug #62455, tmac/an.tmac: fix the...

 
 

bug #62455: tmac/an.tmac: fix the "an-extra3" algorithm when the fifth argument to 'TH' is empty

Submitter:  Bjarni Ingi Gislason <bjarniig>
Submitted:  Fri 13 May 2022 07:30:39 PM UTC
   
 
Category:  Macro man Severity:  3 - Normal
Item Group:  Incorrect behaviour Status:  Invalid
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 19 May 2022 09:42:40 AM UTC, comment #5: 

Closing as invalid per submitter.

G. Branden Robinson <gbranden>
Group administrator
Wed 18 May 2022 07:47:05 PM UTC, comment #4: 

  My change (patch) is wrong as it was based on my lack of
understanding of the fifth argument being defined as an empty string.

  This ticket should be closed as being invalid.

  With my change "man libsasl" shows the middle header as "File Formats
Manual"!

Bjarni Ingi Gislason <bjarniig>
Fri 13 May 2022 09:19:13 PM UTC, comment #3: 

I also can't reproduce any problems when contriving a man page that should have a fifth TH argument but lacks one, and the 'CHECKSTYLE' feature works as it should when this register is set to any positive value.


$ cat EXPERIMENTS/empty-fifth-TH-argument.man
.TH foo 1extension 2022-05-13 "groff test suite"
.SH Name
foo \- frobnicate a bar
$ ./build/test-groff -Tutf8 -b -ww -rCHECKSTYLE=1 -man EXPERIMENTS/empty-fifth-TH-argument.man
an.tmac:EXPERIMENTS/empty-fifth-TH-argument.man:1: style: .TH missing fifth argument and second argument '1extension' not a recognized manual section; specify volume title
foo(1extension)                                                foo(1extension)

Name
       foo - frobnicate a bar

groff test suite                  2022‐05‐13                   foo(1extension)


G. Branden Robinson <gbranden>
Group administrator
Fri 13 May 2022 08:52:38 PM UTC, comment #2: 

I also can't reproduce any problems when formatting the sasl(3) man page from Debian's libsasl2-dev package, even with "-rCHECKSTYLE=3".  I get no diagnostic messages at all.

It might be helpful to include the source of the man page document as an attachment to this Savannah ticket.

G. Branden Robinson <gbranden>
Group administrator
Fri 13 May 2022 08:47:31 PM UTC, comment #1: 

I don't find this report very helpful.

Please simply include the diagnostic output, or incorrect formatting, of the man page in question.

The patch has spurious comments and rationale.  *roff does not have a Boolean data type.  Please review the section/node "Numeric Expressions" of our Texinfo manual for an explanation of truth values in the language.

https://git.savannah.gnu.org/cgit/groff.git/tree/doc/groff.texi#n5600

Further, the existing code in the 'TH' macro definition of tmac/an.tmac does not use the '&' operator at all, anywhere; the commit message and comments in the patch seem to suggest that it was employing it incorrectly, when this is not the case.

https://git.savannah.gnu.org/cgit/groff.git/tree/tmac/an.tmac#n199

As a rule of thumb, it is a good practice to present the underlying problem in a defect report with at least much detail as a proposed patch, because an alternative solution might be a better one.

G. Branden Robinson <gbranden>
Group administrator
Fri 13 May 2022 07:30:39 PM UTC, original submission:  

From a65c7e1ad7b5bcf5fecd2b91fb02fe192627b19b Mon Sep 17 00:00:00 2001
From: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Date: Fri, 13 May 2022 19:23:36 +0000
Subject: [PATCH] tmac/an.tmac: fix the "an-extra3" algorithm when the fifth
 argument to 'TH' is empty

  The logical operator 'and' (&) is only for numeric expressions.

  Use boolean values for the numeric '>' and the string
'...'...' comparison.

  Bug seen in the output of "man 5 libsasl".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
---
 tmac/an.tmac | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tmac/an.tmac b/tmac/an.tmac
index 38ce146a4..7c7911982 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -276,7 +276,21 @@
 .  ds an-title "\\$1\"
 .  if \\n[CT] .stringup an-title
 .  ds an-section "\\$2\"
-.  ie (\\n[.$] > 4)    .ds an-extra3 "\\$5\"
+.
+.\" operator '&' is only for numeric expressions
+.\" use boolean values
+.ie (\\n[.$] > 4) \{\
+.  nr an-nr-bool 1
+.  ie '\\$5'' .nr an-str-bool 0
+.  el .nr an-str-bool 1
+.\}
+.el \{\
+.  nr an-nr-bool 0
+.  nr an-str-bool 0
+.\}
+.ie (\\n[an-nr-bool] & \\n[an-str-bool]) .ds an-extra3 "\\$5
+.\" end of boolean values
+.
 .  el \{ .ie '\\$2'1'  .ds an-extra3 \\*[an*section1]\"
 .  el \{ .ie '\\$2'2'  .ds an-extra3 \\*[an*section2]\"
 .  el \{ .ie '\\$2'3'  .ds an-extra3 \\*[an*section3]\"
--
2.35.1


Bjarni Ingi Gislason <bjarniig>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gbranden (Posted a comment)
  • -email is unavailable- added by bjarniig (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-06-10 gbranden Summary[PATCH] tmac/an.tmac: fix the &quot;an-extra3&quot; algorithm when the fifth argument to 'TH' is empty tmac/an.tmac: fix the "an-extra3" algorithm when the fifth argument to 'TH' is empty
    2022-05-19 gbranden StatusNeed Info Invalid
        Open/ClosedOpen Closed
    2022-05-13 gbranden StatusNone Need Info
        Assigned toNone gbranden

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code