Update of bug #67612 (group groff):
Status: Fixed => Need Info
Summary: [gropdf] exits with nonzero status on warning =>
[PATCH] [gropdf] exits with nonzero status on warning
_______________________________________________________
Follow-up Comment #22:
[comment #21 comment #21:]
> It appears that
> [http://git.savannah.gnu.org/cgit/groff.git/commit/?id=72911e55b commit
> 72911e55b] does what I suggested in the last sentence of comment #18: making
> all warnings produce a nonzero exit code. The relevant change in "sub Warn"
> is:
> - $xitcd=2;
> + $xitcd=2 if $warnexit;
> However, the -W description in the man page still says the option is
> effective "if font embedding fails," which no longer appears to be a
> restriction.
>
> The "Exit status" section of the man page also states the exit status is 2
> when "gropdf emitted warnings," although this appears to no longer be the
> default behavior.
Here's a patch to tidy this stuff up.
Deri, do you have any objections?
diff --git a/src/devices/gropdf/gropdf.1.man
b/src/devices/gropdf/gropdf.1.man
index 09b5d191a..20cf1f37c 100644
--- a/src/devices/gropdf/gropdf.1.man
+++ b/src/devices/gropdf/gropdf.1.man
@@ -1944,17 +1944,19 @@ .SH "Exit status"
.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..71f00633a 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(2);
}
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
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?67612>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
