bugGNU roff - Bugs: bug #62673, [pre-grohtml] wrongly discards...

 
 

bug #62673: [pre-grohtml] wrongly discards standard error output from troff

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Sat 25 Jun 2022 10:30:15 PM UTC
   
 
Category:  Preprocessor html Severity:  3 - Normal
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
   

Sun 26 Jun 2022 02:34:56 AM UTC, comment #3: 

Okay, my pending fix for bug #60782 made this worse.  Back to the drawing board on that one.

G. Branden Robinson <gbranden>
Group administrator
Sun 26 Jun 2022 02:29:39 AM UTC, comment #2: 

Hi, Bjarni.

You're right!  If I `git checkout origin` I can reproduce your results.  I have 12 commits pending.

It looks like I fixed the core dump accidentally!  :-O

...but managed to resurrect the stderr-hiding problem from 1.22.4, so now we can see clearly that the problem is an assertion failure.

Thanks for this feedback.  This bug will need to be renamed but I'll save it for when I've root-caused the problem.

G. Branden Robinson <gbranden>
Group administrator
Sun 26 Jun 2022 01:17:56 AM UTC, comment #1: 

  I get a different amount of output for

echo | build/test-groff -mz -Thtml

troff: fatal error: unable to open macro file for -m argument 'z'
troff: fatal error: unable to open macro file for -m argument 'z'
<!-- Creator     : groff version 1.22.4.4894-d1d5 -->
<!-- CreationDate: Sun Jun 26 01:03:30 2022 -->
<!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></title>
</head>
<body>

<hr>
post-grohtml: ../src/devices/grohtml/post-html.cpp:5141:
do_file_components(): assertion failed: 'current_paragraph != 0'
/home/bg/git/groff/build/groff:troff:10: error: post-grohtml: Aborted
(core dumped)


Bjarni Ingi Gislason <bjarniig>
Sat 25 Jun 2022 10:30:15 PM UTC, original submission:  

Observed in groff 1.22.4, although it is obscured there...by a segfault.  :-|

The SEGV is fixed in Git HEAD and I don't aim to chase it down right now.


$ echo | groff -mz -Tascii
troff: fatal error: can't find macro file z
$ echo | groff -mz -Thtml
groff: pre-grohtml: Signal 11 (core dumped)
$ echo | ./build/test-groff -mz -Tascii
troff: fatal error: unable to open macro file for -m argument 'z'
$ echo | ./build/test-groff -mz -Thtml
pre-grohtml: fatal error: 'groff' exited with status 1


This is pretty tedious to deal with because `pre-grohtml` redirects stderr to extract lines prefixed with "grohtml-info:".  I question the wisdom of this sort of in-band signaling but refactoring that is a heavier lift.

If you execute `troff` successfully, stderr does not get lost.


$ cat EXPERIMENTS/tm.roff
.tm this is GNU troff \n(.x.\n(.y.\n(.Y; a=\na
$ groff -Tascii EXPERIMENTS/tm.roff
this is GNU troff 1.22.4; a=0
$ groff -Thtml EXPERIMENTS/tm.roff
groff: pre-grohtml: Signal 11 (core dumped)


https://gfycat.com/daringwarpedamericanredsquirrel-wendell-pierce


$ ./build/test-groff -Tascii EXPERIMENTS/tm.roff
this is GNU troff 1.23.0; a=0
$ ./build/test-groff -Thtml EXPERIMENTS/tm.roff
this is GNU troff 1.23.0; a=0
this is GNU troff 1.23.0; a=0
<!-- Creator     : groff version 1.23.0.rc1.2634-0f6c7 -->
<!-- CreationDate: Sat Jun 25 17:23:35 2022 -->
<!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></title>
</head>
<body>

<hr>
<hr>
</body>
</html>


Arguably, "groff -Thtml" shouldn't produce an empty document when "groff -T_anything-else_" doesn't, but again, that's a separate issue.

At present I suspect the issue has something to do with file descriptor management.  I observe that src/roff/groff/pipeline.c uses `_exit()` instead of exit() when shutting down failing pipelines, and that may be the problem.  There appear to be multiple attempts to flush the stderr stream beforehand, though...either they're not reliable or I'm looking in the wrong place.

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 bjarniig (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.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code