Skip to content

Commit 21b839e

Browse files
committed
Merge branch 'fs/gpgsm-update'
Newer version of GPGSM changed its output in a backward incompatible way to break our code that parses its output. It also added more processes our tests need to kill when cleaning up. Adjustments have been made to accommodate these changes. * fs/gpgsm-update: t/lib-gpg: kill all gpg components, not just gpg-agent t/lib-gpg: reload gpg components after updating trustlist gpg-interface/gpgsm: fix for v2.3
2 parents bde1e3e + b0b70d5 commit 21b839e

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

gpg-interface.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ static int sign_buffer_gpg(struct strbuf *buffer, struct strbuf *signature,
934934
struct child_process gpg = CHILD_PROCESS_INIT;
935935
int ret;
936936
size_t bottom;
937+
const char *cp;
937938
struct strbuf gpg_status = STRBUF_INIT;
938939

939940
strvec_pushl(&gpg.args,
@@ -953,7 +954,13 @@ static int sign_buffer_gpg(struct strbuf *buffer, struct strbuf *signature,
953954
signature, 1024, &gpg_status, 0);
954955
sigchain_pop(SIGPIPE);
955956

956-
ret |= !strstr(gpg_status.buf, "\n[GNUPG:] SIG_CREATED ");
957+
for (cp = gpg_status.buf;
958+
cp && (cp = strstr(cp, "[GNUPG:] SIG_CREATED "));
959+
cp++) {
960+
if (cp == gpg_status.buf || cp[-1] == '\n')
961+
break; /* found */
962+
}
963+
ret |= !cp;
957964
strbuf_release(&gpg_status);
958965
if (ret)
959966
return error(_("gpg failed to sign the data"));

t/lib-gpg.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ test_lazy_prereq GPG '
4040
# > lib-gpg/ownertrust
4141
mkdir "$GNUPGHOME" &&
4242
chmod 0700 "$GNUPGHOME" &&
43-
(gpgconf --kill gpg-agent || : ) &&
43+
(gpgconf --kill all || : ) &&
4444
gpg --homedir "${GNUPGHOME}" --import \
4545
"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
4646
gpg --homedir "${GNUPGHOME}" --import-ownertrust \
@@ -72,12 +72,11 @@ test_lazy_prereq GPGSM '
7272
--passphrase-fd 0 --pinentry-mode loopback \
7373
--import "$TEST_DIRECTORY"/lib-gpg/gpgsm_cert.p12 &&
7474
75-
gpgsm --homedir "${GNUPGHOME}" -K |
76-
grep fingerprint: |
77-
cut -d" " -f4 |
78-
tr -d "\\n" >"${GNUPGHOME}/trustlist.txt" &&
75+
gpgsm --homedir "${GNUPGHOME}" -K --with-colons |
76+
awk -F ":" "/^fpr:/ {printf \"%s S relax\\n\", \$10}" \
77+
>"${GNUPGHOME}/trustlist.txt" &&
78+
(gpgconf --reload all || : ) &&
7979
80-
echo " S relax" >>"${GNUPGHOME}/trustlist.txt" &&
8180
echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \
8281
-u [email protected] -o /dev/null --sign -
8382
'

t/t4202-log.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,8 @@ test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 miss
20372037
git merge --no-ff -m msg signed_tag_x509_nokey &&
20382038
GNUPGHOME=. git log --graph --show-signature -n1 plain-x509-nokey >actual &&
20392039
grep "^|\\\ merged tag" actual &&
2040-
grep "^| | gpgsm: certificate not found" actual
2040+
grep -e "^| | gpgsm: certificate not found" \
2041+
-e "^| | gpgsm: failed to find the certificate: Not found" actual
20412042
'
20422043

20432044
test_expect_success GPGSM 'log --graph --show-signature for merged tag x509 bad signature' '

0 commit comments

Comments
 (0)