Mailing List Archive

["J.H.M. Dassen" <jdassen@wi.leidenuniv.nl>] Bug#26908: gnupg: Wrong exit code
Hi,

This is a bug report reported via the Debian Bug Tracking System[1],
please reply to 26908@bugs.debian.org and jdassen@wi.leidenuniv.nl as
well as the list.

I've just looked at the source and it seems to me that there's no sane
reason to pretend errors didn't occur if _not_ in batch mode, but
rather the opposite. Perhaps something like the following was meant?

--- gnupg-0.4.3/g10/mainproc.c~ Sun Nov 8 16:43:46 1998
+++ gnupg-0.4.3/g10/mainproc.c Mon Nov 9 01:51:41 1998
@@ -854,7 +854,7 @@
putc('\n', stderr);
if( !rc )
rc = check_signatures_trust( sig );
- if( opt.batch && rc )
+ if( !opt.batch && rc )
g10_exit(1);
}
else {

[1] http://www.debian.org/Bugs/

--
James
------- Start of forwarded message -------
Subject: Bug#26908: gnupg: Wrong exit code
Reply-To: "J.H.M. Dassen" <jdassen@wi.leidenuniv.nl>, 26908@bugs.debian.org
Resent-From: "J.H.M. Dassen" <jdassen@wi.leidenuniv.nl>
Resent-To: debian-bugs-dist@lists.debian.org
Resent-CC: James Troup <james@nocrew.org>
Resent-Date: Mon, 21 Sep 1998 18:48:00 GMT
Resent-Message-ID: <handler.26908.B.90640294825155@bugs.debian.org>
Resent-Sender: iwj@debian.org
Message-ID: <19980920143341.A20175@zensunni>
Date: Sun, 20 Sep 1998 14:33:41 +0200
From: "J.H.M. Dassen" <jdassen@wi.leidenuniv.nl>
To: Debian bugtracking system <submit@bugs.debian.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Organization: Ray at home

Package: gnupg
Version: 0.3.2-1
Severity: grave

According to gpg(1):
:RETURN VALUE
: The Program returns 0 if everything was fine, 1 if at
: least a signature was bad and other errorcode for fatal
: errors.

However, the actual behaviour differs. With a PGP-signed .dsc file (and
using the RSA and IDEA extensions) with a deliberate error (s/r/R/ in
Architecture):
zensunni ray 14:26 ..packages/non-maintainer/dpkg > gpg
/tmp/dpkg_1.4.0.28.dsc ; echo $?
gpg (GNUPG) 0.3.2; Copyright (C) 1998 Free Software Foundation, Inc.
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. See the file COPYING for details.

gpg: Warning: using insecure memory!
Source: dpkg
Version: 1.4.0.28
Binary: dpkg, dpkg-dev
Maintainer: Klee Dienes and Ian Jackson <dpkg-maint@chiark.greenend.org.uk>
ArchitectuRe: any
Standards-Version: 2.1.0.0
Files:
b356dafd11da0749e770ee4fe444b97b 457787 dpkg_1.4.0.28.tar.gz

gpg: Signature made Sat Sep 19 17:18:25 1998 using RSA key ID 672D05C1
gpg: BAD signature from "J.H.M. Dassen (Ray) <jdassen@wi.LeidenUniv.nl>"
0
^ !!!!!

This makes it difficult to use gpg in scripts that do non-interactive
signature verification, like dinstall. As we want to switch to gpg for
signing packages, this problem is severe.

-- System Information
Debian Release: slink
Kernel Version: Linux zensunni 2.0.35 #1 Sat Aug 29 11:03:34 CEST 1998 i686 unknown

Versions of the packages gnupg depends on:
ii libc6 2.0.7t-1 The GNU C library version 2 (run-time files)
ii zlib1g 1.1.2-0.1 compression library - runtime
--
Ray Dassen jdassen@wi.LeidenUniv.nl
------- End of forwarded message -------
Re: ["J.H.M. Dassen" <jdassen@wi.leidenuniv.nl>] Bug#26908: gnupg: Wrong exit code [ In reply to ]
James Troup <james@nocrew.org> writes:

> I've just looked at the source and it seems to me that there's no sane
> reason to pretend errors didn't occur if _not_ in batch mode, but
> rather the opposite. Perhaps something like the following was meant?
[...]
> - if( opt.batch && rc )
> + if( !opt.batch && rc )
> g10_exit(1);

This is intended; but I changed it, so that gpg returns with 1 if it
has seen at least one BAD (or untrusted) signature.

It will we in the next release or in the CVS in a couple of hours.


Werner