bugGNU roff - Bugs: bug #60782, groff: doesn't exit with status 1...

 
 

bug #60782: groff: doesn't exit with status 1 when .ab request used with -Thtml

Submitter:  G. Branden Robinson <gbranden>
Submitted:  Tue 15 Jun 2021 07:45:04 PM UTC
   
 
Category:  Core Severity:  4 - Important
Item Group:  Incorrect behaviour Status:  Fixed
Privacy:  Public Assigned to:  gbranden
Open/Closed:  Closed Planned Release:  1.23.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 06 Jul 2022 09:38:31 AM UTC, comment #5: 


commit 11137209eded488c5ecb598e13bd9450f004dd49
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
Date:   Mon Jun 27 10:34:32 2022 -0500

    [pre-grohtml]: Fix Savannah #60782.

    * src/preproc/html/pre-html.cpp (char_buffer::run_output_filter): Return
      wait status of child process.

      (char_buffer::run_output_filter, main): Rename local variable `status`
      to `wstatus` to recognize distinction between exit status (a 7-bit
      quantity) and wait status (a wider type).

      (main): Issue fatal diagnostic if child process exited with nonzero
      status.  Since the child's output to the standard error stream is
      lost, advise re-running with different output driver to see them.
      This unhappy shortcoming is filed as Savannah #62673.  Explicitly
      return zero otherwise.

    Fixes <https://savannah.gnu.org/bugs/?60782>.


G. Branden Robinson <gbranden>
Group administrator
Thu 23 Jun 2022 01:53:20 AM UTC, comment #4: 


diff --git a/src/preproc/html/pre-html.cpp b/src/preproc/html/pre-html.cpp
index a3e09db04..d111b9e6c 100644
--- a/src/preproc/html/pre-html.cpp
+++ b/src/preproc/html/pre-html.cpp
@@ -1414,6 +1414,8 @@ int char_buffer::run_output_filter(int filter, int argc, char **argv)

     if (WAIT(&status, child_pid, _WAIT_CHILD) != child_pid)
       sys_fatal("wait");
+    if (WEXITSTATUS(status) != 0)
+      fatal("'%1' exited with status %2", argv[0], WEXITSTATUS(status));
   }

 #elif MAY_SPAWN_ASYNCHRONOUS_CHILD
@@ -1481,6 +1483,8 @@ int char_buffer::run_output_filter(int filter, int argc, char **argv)

   if (WAIT(&status, child_pid, _WAIT_CHILD) != child_pid)
     sys_fatal("wait");
+  if (WEXITSTATUS(status) != 0)
+    fatal("'%1' exited with status %2", argv[0], WEXITSTATUS(status));

 #else /* can't do asynchronous pipes! */


G. Branden Robinson <gbranden>
Group administrator
Sun 15 May 2022 09:13:47 AM UTC, comment #3: 

Hi Gaius,

Any luck?

comment #2:

> Thanks for the bug report - I'll fix this!

G. Branden Robinson <gbranden>
Group administrator
Wed 30 Jun 2021 12:33:18 PM UTC, comment #2: 

Thanks for the bug report - I'll fix this!

Gaius Mulley <gaius>
Group Member
Tue 15 Jun 2021 11:46:12 PM UTC, comment #1: 

This is really just egregiously bad.

The cause of the problem is not obvious; I checked src/roff/groff/pipeline.c and everything there seems to be in order.  All commands in the pipeline that get forked off exit with status zero.

It is troff itself that should be exiting with status 1, but that's not run as part of the pipeline.

Sample of instrumented output:


$ ./build/groff -F ./build/font -Thtml -t -man ./build/tmac/groff_man.7 ./build/src/preproc/eqn/neqn.1 >/dev/null
GBR: execing soelim as pid 36382
GBR: execing tbl as pid 36383
GBR: execing pre-grohtml as pid 36384
GBR: execing post-grohtml as pid 36385
GBR: pid 36382 exited with status 0
GBR: pid 36383 exited with status 0
GBR: pid 36384 exited with status 0
GBR: pid 36385 exited with status 0


G. Branden Robinson <gbranden>
Group administrator
Tue 15 Jun 2021 07:45:04 PM UTC, original submission:  

The HTML output driver is not consistent with others.  It always emits a blank document even if there were no text lines in the input, and worse, it doesn't exit with a nonzero status if the .ab request was used.


$ for D in ps pdf utf8 ascii latin1 lj4 lbp dvi X100-12 html; do echo ".ab" | groff -T$D; if [ $? != 1 ]; then echo groff -T$D exited with wrong status; fi; done
User Abort.
User Abort.
User Abort.
User Abort.
User Abort.
User Abort.
User Abort.
User Abort.
User Abort.
User Abort.
<!-- Creator     : groff version 1.22.4 -->
<!-- CreationDate: Tue Jun 15 19:43:48 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></title>
</head>
<body>

<hr>
<hr>
</body>
</html>
User Abort.
groff -Thtml exited with wrong status


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 gaius (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 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-06 gbranden StatusIn Progress Fixed
    2022-07-06 gbranden Open/ClosedOpen Closed
        Planned ReleaseNone 1.23.0
    2022-06-22 gbranden StatusNone In Progress
        Assigned togaius gbranden
    2021-06-30 gaius Assigned toNone gaius
    2021-06-15 gbranden Severity3 - Normal 4 - Important

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code