Release: 1.4.1
Environment
Debian GNU/Linux
- System Information: Debian Release: 3.1 APT prefers testing APT policy: (300, 'testing'), (200, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.11 Locale: LANG=fr_LU.UTF-8, LC_CTYPE=fr_LU.UTF-8 (charmap=UTF-8)
Versions of packages gnupg depends on: ii libbz2-1.0 1.0.2-7 high-quality block-sorting file co ii libc6 2.3.5-3 GNU C Library: Shared libraries an ii libldap2 2.1.30-8 OpenLDAP libraries ii libreadline5 5.0-10 GNU readline and history libraries ii libusb-0.1-4 2:0.1.10a-9.sarge.1 userspace USB programming library ii makedev 2.3.1-77 creates device files in /dev ii zlib1g 1:1.2.2-4.sarge.2 compression library - runtime
Description
When one uses --use-agent, but no agent is present, GnuPG falls back
to asking for a passphrase the old way. So far, so good. If one enters
the right passphrase, GnuPG successfully does the operation
(e.g. sign), but then exits with a failure exit code:
master@tofu:~/src/hylafax$ gpg --sign capi4hylafax_01.03.00-1.dsc
You need a passphrase to unlock the secret key for
user: "Lionel Elie Mamane <lionel@mamane.lu>"
1024-bit DSA key, ID 3E7B4B73, created 1998-12-02
gpg: gpg-agent is not available in this session
master@tofu:~/src/hylafax$ echo $?
2
master@tofu:~/src/hylafax$ gpg --no-use-agent --sign capi4hylafax_01.03.00-1.dsc
You need a passphrase to unlock the secret key for
user: "Lionel Elie Mamane <lionel@mamane.lu>"
1024-bit DSA key, ID 3E7B4B73, created 1998-12-02
File `capi4hylafax_01.03.00-1.dsc.gpg' exists. Overwrite? (y/N) y
master@tofu:~/src/hylafax$ echo $?
0
The operation was done successfully, hence it should exit with return
code 0, not non-zero.
This breaks scripts that call gnupg and check the return value for success or failure.
How To Repeat
See description.
Fix
Make it return 0 if the operation is successful
Release Note
Fixed in my working copy:
- passphrase.c (agent_open): Print a warning and not an error in case of a missing agent. Should fix Debian bug #325578.
Patch already sent to the Debian tracker.