bug-groff
[Top][All Lists]
Advanced

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

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


From: G. Branden Robinson
Subject: [bug #62673] [pre-grohtml] wrongly discards standard error output from troff
Date: Sat, 25 Jun 2022 18:30:17 -0400 (EDT)

URL:
  <https://savannah.gnu.org/bugs/?62673>

                 Summary: [pre-grohtml] wrongly discards standard error output
from troff
                 Project: GNU troff
               Submitter: 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
         Discussion Lock: Any
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 25 Jun 2022 10:30:15 PM UTC By: G. Branden Robinson <gbranden>
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.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62673>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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