On Tue, Mar 19, 2019 at 04:20:13PM -0700, Dave Huseby wrote: > Fix the way GPG keyrings are imported during testing to prevent GPG from > prompting for approval to change the default config. This appears to have no > adverse affects on GPG users with "normal" configurations but fixes the > always-interactive prompting I see with my multi-keyring setup. > > v2: fixed the whitespace. > > Signed-off-by: Dave Huseby <dhuseby@xxxxxxxxxxxxxxxxxxx> > --- > t/lib-gpg.sh | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh > index 8d28652b72..e72e0554f1 100755 > --- a/t/lib-gpg.sh > +++ b/t/lib-gpg.sh > @@ -32,8 +32,8 @@ then > GNUPGHOME="$(pwd)/gpghome" && > export GNUPGHOME && > (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) && > - gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \ > - "$TEST_DIRECTORY"/lib-gpg/keyring.gpg && > + gpg --import-options merge-only --homedir "${GNUPGHOME}" 2>/dev/null \ > + --import "$TEST_DIRECTORY"/lib-gpg/keyring.gpg && Normally an Ubuntu 16.04 LTS based box can run all tests with the GPG prereq just fine, but with this patch it can't. After making 'lib-gpg.sh' a bit more informative by adding 'set -x' and removing the 'gpg ... 2>/dev/null' redirections it appears that with this '--import-options merge-only' GPG can't find the keys: $ ./t7612-merge-verify-signatures.sh -V -x + gpg --version + gpg_version=gpg (GnuPG) 1.4.20 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://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: /home/szeder/src/git/t/trash directory.t7612-merge-verify-signatures/gnupg-home-not-used Supported algorithms: Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB, BZIP2 + test 0 != 127 + mkdir ./gpghome + chmod 0700 ./gpghome + pwd + GNUPGHOME=/home/szeder/src/git/t/trash directory.t7612-merge-verify-signatures/gpghome + export GNUPGHOME + gpgconf --kill gpg-agent + gpg --import-options merge-only --homedir /home/szeder/src/git/t/trash directory.t7612-merge-verify-signatures/gpghome --import /home/szeder/src/git/t/lib-gpg/keyring.gpg gpg: keyring `/home/szeder/src/git/t/trash directory.t7612-merge-verify-signatures/gpghome/secring.gpg' created gpg: keyring `/home/szeder/src/git/t/trash directory.t7612-merge-verify-signatures/gpghome/pubring.gpg' created gpg: key CDDE430D: secret key not found: secret key not available gpg: error reading `/home/szeder/src/git/t/lib-gpg/keyring.gpg': secret key not available gpg: import from `/home/szeder/src/git/t/lib-gpg/keyring.gpg' failed: secret key not available gpg: Total number processed: 0 gpg: secret keys read: 1 + test_have_prereq GPG + save_IFS= + IFS=, + set -- GPG + IFS= + total_prereq=0 + ok_prereq=0 + missing_prereq= + negative_prereq= + total_prereq=1 + satisfied_this_prereq= + prerequisite=GPG + test -z + missing_prereq=GPG + test 1 = 0 + set +x ok 1 # skip create signed commits (missing GPG) [....]