gbranden pushed a commit to branch master
in repository groff.

commit 48ab4912bb9fb7a23ee7814544207d4d72efbf62
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Nov 17 21:20:21 2025 -0600

    [gropdf]: Fix Savannah #67612.
    
    * src/devices/gropdf/gropdf.pl (Warn): Set exit status to 1, not 2, if
      the scalar `warnexit` (set by the `-W` command-line option) is truthy.
    
      (usage): Exit with status 2, not 1, on usage errors.
    
    * src/devices/gropdf/gropdf.1.man (Options, Exit status): Update
      documentation accordingly.
    
    Fixes <https://savannah.gnu.org/bugs/?67612>.  Thanks to Dave Kemper for
    the report and to him and Deri for the code review.
---
 ChangeLog                       | 12 ++++++++++++
 src/devices/gropdf/gropdf.1.man | 20 +++++++++-----------
 src/devices/gropdf/gropdf.pl    |  6 +++---
 3 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 41502c581..0dfad2942 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2025-11-07  G. Branden Robinson <[email protected]>
+
+       * src/devices/gropdf/gropdf.pl (Warn): Set exit status to 1, not
+       2, if the scalar `warnexit` (set by the `-W` command-line
+       option) is truthy.
+       (usage): Exit with status 2, not 1, on usage errors.
+       * src/devices/gropdf/gropdf.1.man (Options, Exit status): Update
+       documentation accordingly.
+
+       Fixes <https://savannah.gnu.org/bugs/?67612>.  Thanks to Dave
+       Kemper for the report and to him and Deri for the code review.
+
 2025-11-16  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/input.cpp: Slightly refactor.
diff --git a/src/devices/gropdf/gropdf.1.man b/src/devices/gropdf/gropdf.1.man
index 09b5d191a..87ccd025c 100644
--- a/src/devices/gropdf/gropdf.1.man
+++ b/src/devices/gropdf/gropdf.1.man
@@ -316,11 +316,7 @@ or have no CMap at all by omitting the argument.
 .
 .TP
 .B \-W
-Exit with failure status if font embedding fails.
-.
-Normally,
-.I gropdf
-issues a warning diagnostic and proceeds.
+Exit with failure status if any warnings are issued.
 .
 .
 .\" .TP
@@ -1944,17 +1940,19 @@ see hello.pdf
 .IP 0
 .I gropdf
 successfully produced a PDF document.
+.
+.
 .IP 1
 .I gropdf
 experienced a critical error,
-or could not interpret its arguments.
-No PDF was produced,
-or the document produced will be unusable.
+or warnings were emitted and the
+.B \-W
+option was specified.
+.
+.
 .IP 2
 .I gropdf
-emitted warnings.
-The document produced may be usable,
-but may fail to render as desired.
+could not interpret its command-line arguments.
 .
 .
 .br
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index d0da52c42..db0562c9c 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -461,7 +461,7 @@ sub usage
 "Translate the output of troff(1) into Portable Document Format.\n" .
 "See the gropdf(1) manual page.\n";
     }
-    exit($had_error);
+    exit($had_error ? 2 : 0);
 }
 
 my $fd;
@@ -498,7 +498,7 @@ if (!GetOptions('F=s' => \@fdlist, 'I=s' => \@idirs, 'l' => 
\$frot,
     'e' => \$embedall, 'y=s' => \$Foundry, 's' => \$stats, 'W' => \$warnexit,
     'u:s' => \$unicodemap))
 {
-    &usage(1);
+    &usage(1); # had error
 }
 
 unshift(@idirs,'.');
@@ -3197,7 +3197,7 @@ sub Warn
     unshift(@_, "warning: ");
     my $msg=join('',@_);
     Msg(0,$msg);
-    $xitcd=2 if $warnexit;
+    $xitcd=1 if $warnexit;
 }
 
 sub Die

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to