bugGNU roff - Bugs: bug #60637, [man] HTML rendering of multiple...

 
 

bug #60637: [man] HTML rendering of multiple documents doesn't make much sense

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Wed 19 May 2021 12:34:33 PM UTC
   
 
Category:  Macro man Severity:  4 - Important
Item Group:  Incorrect behaviour Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Thu 10 Aug 2023 01:52:40 PM UTC, comment #4: 

Un-postponing.  What this really needs is a new bug filed about pre-grohtml's (I guess) gluttonous devouring of nonzero exit statuses.

Who knows?  Maybe migrating to `posix_spawn()` will fix it... (see bug #64055)

G. Branden Robinson <gbranden>
Group administrator
Tue 23 Aug 2022 10:16:41 PM UTC, comment #3: 

Thanks, Dave.

Unfortunately life still sucks.

I tried an updated version of the patch, along with something ambitious to exercise it.


diff --git a/doc/doc.am b/doc/doc.am
index 806058d9e..7dd553e0c 100644
--- a/doc/doc.am
+++ b/doc/doc.am
@@ -59,7 +59,8 @@ GENERATEDDOCFILES = \
 # Files generated in the build tree
 if USE_GROHTML
 PROCESSEDDOCFILES_HTML = \
-  doc/pic.html
+  doc/pic.html \
+  doc/groff-man-pages.html
 endif
 if USE_GROPDF
 PROCESSEDDOCFILES_PDF = \
@@ -251,6 +252,12 @@ man-clean:
        $(RM) $(GROFF_MAN_PAGES_ALL)

 # Many pages use tbl, a few use eqn, and soelim(1) uses pic.
+doc/groff-man-pages.html: $(GROFF_MAN_PAGES_ALL) eqn pic tbl
+       $(GROFF_V)$(DOC_GROFF) -pet -Thtml -mandoc -rC1 \
+         -rCHECKSTYLE=3 $(GROFF_MAN_PAGES1) \
+         $(tmac_srcdir)/sv.tmac $(GROFF_MAN_PAGES2) \
+         $(tmac_srcdir)/en.tmac $(GROFF_MAN_PAGES3) > $@
+
 doc/groff-man-pages.pdf: $(GROFF_MAN_PAGES_ALL) eqn pic tbl
        $(GROFF_V)$(DOC_GROFF) -pet -Tpdf -P-e -mandoc -rC1 \
          -rCHECKSTYLE=3 $(GROFF_MAN_PAGES1) \
diff --git a/tmac/an.tmac b/tmac/an.tmac
index 88b25163f..41170fdbb 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -210,6 +210,8 @@
 .  if !\\n[an-is-first-page-of-document] \{\
 .    ie \\n[cR] .an-end
 .    el         .an-start-new-document
+.    if \\n[an-is-output-html] \
+.      ab \\*[an]: fatal error: cannot render multiple documents to HTML
 .    nr an-is-first-page-of-document 1
 .  \}
 .


The results?


$ make doc/groff-man-pages.html
  GROFF    doc/groff-man-pages.html
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':666: macro 'SH'
troff: backtrace: file './src/devices/grolbp/grolbp.1':261
troff:./src/devices/grolbp/grolbp.1:261: error: suppression limit registers span more than a page; grohtml-info for image 8 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':974: macro 'RE'
troff: backtrace: file './src/preproc/tbl/tbl.1':1765
troff:./src/preproc/tbl/tbl.1:1765: error: suppression limit registers span more than a page; grohtml-info for image 12 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':751: macro 'P'
troff: backtrace: file './man/groff.7':817
troff:./man/groff.7:817: error: suppression limit registers span more than a page; grohtml-info for image 16 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':693: macro 'SS'
troff: backtrace: file './man/groff_char.7':597
troff:./man/groff_char.7:597: error: suppression limit registers span more than a page; grohtml-info for image 22 will be wrong
troff: backtrace: file './man/groff_char.7':1010
troff:./man/groff_char.7:1010: warning: special character '.j' not defined
troff: backtrace: file './man/groff_char.7':1019
troff:./man/groff_char.7:1019: error: suppression limit registers span more than a page; grohtml-info for image 24 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':693: macro 'SS'
troff: backtrace: file './man/groff_char.7':1187
troff:./man/groff_char.7:1187: error: suppression limit registers span more than a page; grohtml-info for image 27 will be wrong
troff: backtrace: file './man/groff_char.7':1407
troff:./man/groff_char.7:1407: error: suppression limit registers span more than a page; grohtml-info for image 30 will be wrong
troff: backtrace: file './man/groff_char.7':1430
troff:./man/groff_char.7:1430: warning: special character 'vA' not defined
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':693: macro 'SS'
troff: backtrace: file './man/groff_char.7':1540
troff:./man/groff_char.7:1540: error: suppression limit registers span more than a page; grohtml-info for image 33 will be wrong
troff: backtrace: file './man/groff_char.7':1559
troff:./man/groff_char.7:1559: warning: special character 'bs' not defined
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':693: macro 'SS'
troff: backtrace: file './man/groff_char.7':1650
troff:./man/groff_char.7:1650: error: suppression limit registers span more than a page; grohtml-info for image 37 will be wrong
troff: backtrace: file './man/groff_char.7':1730
troff:./man/groff_char.7:1730: warning: special character '-+' not defined
troff: backtrace: file './man/groff_char.7':1779
troff:./man/groff_char.7:1779: warning: special character 'coproduct' not defined
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':693: macro 'SS'
troff: backtrace: file './man/groff_char.7':1805
troff:./man/groff_char.7:1805: error: suppression limit registers span more than a page; grohtml-info for image 38 will be wrong
troff: backtrace: file './man/groff_char.7':1874
troff:./man/groff_char.7:1874: warning: special character '+e' not defined
troff: backtrace: file './man/groff_char.7':1882
troff:./man/groff_char.7:1882: error: suppression limit registers span more than a page; grohtml-info for image 39 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':779: macro 'IP'
troff: backtrace: file './tmac/groff_man_style.7':1879
troff:./tmac/groff_man_style.7:1879: error: suppression limit registers span more than a page; grohtml-info for image 82 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':751: macro 'P'
troff: backtrace: file './tmac/groff_me.7':170
troff:./tmac/groff_me.7:170: error: suppression limit registers span more than a page; grohtml-info for image 92 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':751: macro 'P'
troff: backtrace: file './tmac/groff_me.7':332
troff:./tmac/groff_me.7:332: error: suppression limit registers span more than a page; grohtml-info for image 93 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':974: macro 'RE'
troff: backtrace: file './contrib/mm/groff_mm.7':1225
troff:./contrib/mm/groff_mm.7:1225: error: suppression limit registers span more than a page; grohtml-info for image 104 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':974: macro 'RE'
troff: backtrace: file './contrib/mm/groff_mm.7':2553
troff:./contrib/mm/groff_mm.7:2553: error: suppression limit registers span more than a page; grohtml-info for image 112 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':974: macro 'RE'
troff: backtrace: file './contrib/mm/groff_mm.7':4463
troff:./contrib/mm/groff_mm.7:4463: error: suppression limit registers span more than a page; grohtml-info for image 128 will be wrong
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':658: macro 'an-break-paragraph'
troff: backtrace: '/home/branden/src/GIT/groff/build/../tmac/an.tmac':666: macro 'SH'
troff: backtrace: file './tmac/groff_ms.7':2734
troff:./tmac/groff_ms.7:2734: error: suppression limit registers span more than a page; grohtml-info for image 139 will be wrong
an.tmac: fatal error: cannot render multiple documents to HTML


Except for the last line, all that spew is typical of rendering our man page corpus as HTML.

No, the really sad part is this.


[all that crap above]
an.tmac: fatal error: cannot render multiple documents to HTML
$ echo $?
0


Something is still eating my god damn nonzero exit status.

And, no, bug #60782 really is fixed.


$ bash -x ../src/roff/groff/tests/ab_works.sh
[...]
+ for d in ascii cp1047 dvi html latin1 lbp lj4 pdf ps utf8
+ echo 'verifying exit status of .ab request using html device'
verifying exit status of .ab request using html device
+ printf '.ab\n'
+ ./test-groff -Thtml
pre-grohtml: fatal error: 'pre-grohtml' exited with status 1; re-run 'pre-grohtml' with a different output driver to see diagnostic messages
+ test 1 -eq 1


So this is blocked on some other bizarre bug.

G. Branden Robinson <gbranden>
Group administrator
Wed 17 Aug 2022 09:40:15 PM UTC, comment #2: 

comment #1:

> Here's a patch, but it doesn't work because of bug #60782.


Assuming that was the only blocker, since it was fixed last month, I'm un-Postponing this bug, and also updating the Summary to reflect that a patch has been posted here in comment #1.

Dave <barx>
Group Member
Tue 15 Jun 2021 11:43:11 PM UTC, comment #1: 

Here's a patch, but it doesn't work because of bug #60782.

groff -Thtml happily renders all documents anyway and exits with status zero.


diff --git a/tmac/an-old.tmac b/tmac/an-old.tmac
index 44ff676c..b9f6b536 100644
--- a/tmac/an-old.tmac
+++ b/tmac/an-old.tmac
@@ -171,6 +171,10 @@
 .  if !\\n[an-is-first-page-of-document] \{\
 .    ie \\n[cR] .an-end
 .    el         .an-start-new-document
+.    if \\n[an-is-output-html] \{\
+.      ds an-msg fatal error: cannot render multiple documents to HTML
+.      ab \\*[an-old]: \\*[an-msg]
+.    \}
 .    nr an-is-first-page-of-document 1
 .  \}
 .


G. Branden Robinson <gbranden>
Group administrator
Wed 19 May 2021 12:34:33 PM UTC, original submission:  

When rendering to the HTML device, we should consider making the man package abort if it encounters another .TH call after the first; the output HTML in its current form doesn't seem to even contemplate this scenario.

Input (degenerate but valid):

.TH foo 1 2021-05-19 "groff foo test suite"
.TH bar 1 2021-05-19 "groff bar test suite"


Output:

<!-- Creator     : groff version 1.23.0.rc1.467-a060 -->
<!-- CreationDate: Wed May 19 22:32:07 2021 -->
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="generator" content="groff -Thtml, see www.gnu.org">
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="Content-Style" content="text/css">
<style type="text/css">
       p       { margin-top: 0; margin-bottom: 0; vertical-align: top }
       pre     { margin-top: 0; margin-bottom: 0; vertical-align: top }
       table   { margin-top: 0; margin-bottom: 0; vertical-align: top }
       h1      { text-align: center }
</style>
<title>foo</title>

</head>
<body>

<h1 align="center">foo</h1>

<hr>


<p style="margin-top: 1em">bar</p>
<hr>
</body>
</html>


So the first page rendered gets the title tag and the h1 header, and subsequent pages get...a paragraph.

That's total nonsense.  We shouldn't do that.

G. Branden Robinson <gbranden>
Group administrator

 

(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 barx (Posted a comment)
  • -email is unavailable- added by gbranden (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-08-10 gbranden StatusPostponed None
    2022-08-23 gbranden StatusNone Postponed
        Summary[PATCH] [man] HTML rendering of multiple documents doesn't make much sense [man] HTML rendering of multiple documents doesn't make much sense
    2022-08-17 barx StatusPostponed None
        Summary[man] HTML rendering of multiple documents doesn't make much sense [PATCH] [man] HTML rendering of multiple documents doesn't make much sense
    2021-06-15 gbranden StatusNone Postponed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code