Page MenuHome GnuPG

gpg --fetch-keys no longer returns non 0 exit status on failure
Closed, ResolvedPublic

Description

Before 2.2, --fetch-keys returned with a non-zero exit status. This is no longer the case. It makes automation rather difficult.

# gpg --version
gpg (GnuPG) 2.2.12
libgcrypt 1.7.6-beta
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: /root/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

# gpg --fetch-keys http://foo.com/key-not-there.key; echo $?
gpg: requesting key from 'http://foo.com/key-not-there.key'
gpg: WARNING: unable to fetch URI http://foo.com/key-not-there.key: No data
0

Details

Version
2.2.12

Event Timeline

werner triaged this task as Normal priority.Mar 30 2021, 8:16 PM
werner added a project: gnupg (gpg22).
werner added a subscriber: werner.

You are coming pretty late to the party ;-). Since 2.1.0 we don't use the ancient keyserver helpers anymore but reworked the entire network access. I even doubt that I can still test with a 2.0 version.

Anyway, you are right that we should return an error code.

Will be in 2.2.29.

By looking at the source, I actuallly found no version which returns an error. Did you have a concrete version in mind.

werner claimed this task.