unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] test: fix support for gpgsm in gnupg 2.3
@ 2022-01-11 13:12 Stig Palmquist
  2022-01-11 14:04 ` David Bremner
  2022-01-11 23:52 ` [PATCH] test/gpgsm: use --with-colons when calculating fingerprint David Bremner
  0 siblings, 2 replies; 5+ messages in thread
From: Stig Palmquist @ 2022-01-11 13:12 UTC (permalink / raw)
  To: notmuch

gpgsm --list-keys output changed the label for fingerprints from
"fingerprint: " to "sha[12] fpr: " breaking tests with gnupg 2.3. this
adds support for both.
---
 test/test-lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 6bc0b723..3de608f9 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -145,7 +145,7 @@ add_gpgsm_home () {
     mkdir -p -m 0700 "$GNUPGHOME"
     gpgsm --batch --no-tty --no-common-certs-import --pinentry-mode=loopback --passphrase-fd 3 \
 	  --disable-dirmngr --import  >"$GNUPGHOME"/import.log 2>&1 3<<<'' <$NOTMUCH_SRCDIR/test/smime/0xE0972A47.p12
-    fpr=$(gpgsm --batch --list-key test_suite@notmuchmail.org | sed -n 's/.*fingerprint: //p')
+    fpr=$(gpgsm --batch --list-key test_suite@notmuchmail.org | sed -n 's/.*\(fingerprint\|sha1 fpr\): //p')
     echo "$fpr S relax" >> "$GNUPGHOME/trustlist.txt"
     gpgsm --quiet --batch --no-tty --no-common-certs-import --disable-dirmngr --import < $NOTMUCH_SRCDIR/test/smime/ca.crt
     echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> "$GNUPGHOME/trustlist.txt"
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] test: fix support for gpgsm in gnupg 2.3
  2022-01-11 13:12 [PATCH] test: fix support for gpgsm in gnupg 2.3 Stig Palmquist
@ 2022-01-11 14:04 ` David Bremner
  2022-01-11 23:52 ` [PATCH] test/gpgsm: use --with-colons when calculating fingerprint David Bremner
  1 sibling, 0 replies; 5+ messages in thread
From: David Bremner @ 2022-01-11 14:04 UTC (permalink / raw)
  To: Stig Palmquist, notmuch

Stig Palmquist <stig@stig.io> writes:

> gpgsm --list-keys output changed the label for fingerprints from
> "fingerprint: " to "sha[12] fpr: " breaking tests with gnupg 2.3. this
> adds support for both.
> ---
>  test/test-lib.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/test/test-lib.sh b/test/test-lib.sh
> index 6bc0b723..3de608f9 100644
> --- a/test/test-lib.sh
> +++ b/test/test-lib.sh
> @@ -145,7 +145,7 @@ add_gpgsm_home () {
>      mkdir -p -m 0700 "$GNUPGHOME"
>      gpgsm --batch --no-tty --no-common-certs-import --pinentry-mode=loopback --passphrase-fd 3 \
>  	  --disable-dirmngr --import  >"$GNUPGHOME"/import.log 2>&1 3<<<'' <$NOTMUCH_SRCDIR/test/smime/0xE0972A47.p12
> -    fpr=$(gpgsm --batch --list-key test_suite@notmuchmail.org | sed -n 's/.*fingerprint: //p')
> +    fpr=$(gpgsm --batch --list-key test_suite@notmuchmail.org | sed -n 's/.*\(fingerprint\|sha1 fpr\): //p')

Thanks for the patch. It occurs to me that we should probably use
--with-colons to avoid future issues like this. It looks like we wabt
the row labelled "fpr"; I assume this has not changed with 2.3?

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] test/gpgsm: use --with-colons when calculating fingerprint.
  2022-01-11 13:12 [PATCH] test: fix support for gpgsm in gnupg 2.3 Stig Palmquist
  2022-01-11 14:04 ` David Bremner
@ 2022-01-11 23:52 ` David Bremner
       [not found]   ` <20220112163817.teztj5t4wwcqmbew@stig.io>
  2022-01-12 17:27   ` David Bremner
  1 sibling, 2 replies; 5+ messages in thread
From: David Bremner @ 2022-01-11 23:52 UTC (permalink / raw)
  To: Stig Palmquist, notmuch

As stressed by the gpg documentation, the non-'with-colons' output
format is subject to change, and indeed it did in 2.3.x (x<=3). This
should make the the test suite more robust against such changes.
---
 test/test-lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index 6bc0b723..f1275b85 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -145,7 +145,7 @@ add_gpgsm_home () {
     mkdir -p -m 0700 "$GNUPGHOME"
     gpgsm --batch --no-tty --no-common-certs-import --pinentry-mode=loopback --passphrase-fd 3 \
 	  --disable-dirmngr --import  >"$GNUPGHOME"/import.log 2>&1 3<<<'' <$NOTMUCH_SRCDIR/test/smime/0xE0972A47.p12
-    fpr=$(gpgsm --batch --list-key test_suite@notmuchmail.org | sed -n 's/.*fingerprint: //p')
+    fpr=$(gpgsm --batch --with-colons --list-key test_suite@notmuchmail.org | awk -F: '/^fpr/ {print $10}')
     echo "$fpr S relax" >> "$GNUPGHOME/trustlist.txt"
     gpgsm --quiet --batch --no-tty --no-common-certs-import --disable-dirmngr --import < $NOTMUCH_SRCDIR/test/smime/ca.crt
     echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> "$GNUPGHOME/trustlist.txt"
-- 
2.34.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] test/gpgsm: use --with-colons when calculating fingerprint.
       [not found]   ` <20220112163817.teztj5t4wwcqmbew@stig.io>
@ 2022-01-12 16:39     ` Stig Palmquist
  0 siblings, 0 replies; 5+ messages in thread
From: Stig Palmquist @ 2022-01-12 16:39 UTC (permalink / raw)
  To: notmuch

On 2022-01-12 17:38, Stig Palmquist wrote:
> LGTM, tests work with GnuPG 2.3
> 
> Nice use of awk btw.
> 
> Stig.
> 
> On 2022-01-11 19:52, David Bremner wrote:
> > As stressed by the gpg documentation, the non-'with-colons' output
> > format is subject to change, and indeed it did in 2.3.x (x<=3). This
> > should make the the test suite more robust against such changes.
> > ---
> >  test/test-lib.sh | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/test/test-lib.sh b/test/test-lib.sh
> > index 6bc0b723..f1275b85 100644
> > --- a/test/test-lib.sh
> > +++ b/test/test-lib.sh
> > @@ -145,7 +145,7 @@ add_gpgsm_home () {
> >      mkdir -p -m 0700 "$GNUPGHOME"
> >      gpgsm --batch --no-tty --no-common-certs-import --pinentry-mode=loopback --passphrase-fd 3 \
> >  	  --disable-dirmngr --import  >"$GNUPGHOME"/import.log 2>&1 3<<<'' <$NOTMUCH_SRCDIR/test/smime/0xE0972A47.p12
> > -    fpr=$(gpgsm --batch --list-key test_suite@notmuchmail.org | sed -n 's/.*fingerprint: //p')
> > +    fpr=$(gpgsm --batch --with-colons --list-key test_suite@notmuchmail.org | awk -F: '/^fpr/ {print $10}')
> >      echo "$fpr S relax" >> "$GNUPGHOME/trustlist.txt"
> >      gpgsm --quiet --batch --no-tty --no-common-certs-import --disable-dirmngr --import < $NOTMUCH_SRCDIR/test/smime/ca.crt
> >      echo "4D:E0:FF:63:C0:E9:EC:01:29:11:C8:7A:EE:DA:3A:9A:7F:6E:C1:0D S" >> "$GNUPGHOME/trustlist.txt"
> > -- 
> > 2.34.1
> > 
> 

-- 
Stig Palmquist <stig@stig.io>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] test/gpgsm: use --with-colons when calculating fingerprint.
  2022-01-11 23:52 ` [PATCH] test/gpgsm: use --with-colons when calculating fingerprint David Bremner
       [not found]   ` <20220112163817.teztj5t4wwcqmbew@stig.io>
@ 2022-01-12 17:27   ` David Bremner
  1 sibling, 0 replies; 5+ messages in thread
From: David Bremner @ 2022-01-12 17:27 UTC (permalink / raw)
  To: Stig Palmquist, notmuch

David Bremner <david@tethera.net> writes:

> As stressed by the gpg documentation, the non-'with-colons' output
> format is subject to change, and indeed it did in 2.3.x (x<=3). This
> should make the the test suite more robust against such changes.

applied to release and master.

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-12 17:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 13:12 [PATCH] test: fix support for gpgsm in gnupg 2.3 Stig Palmquist
2022-01-11 14:04 ` David Bremner
2022-01-11 23:52 ` [PATCH] test/gpgsm: use --with-colons when calculating fingerprint David Bremner
     [not found]   ` <20220112163817.teztj5t4wwcqmbew@stig.io>
2022-01-12 16:39     ` Stig Palmquist
2022-01-12 17:27   ` David Bremner

Code repositories for project(s) associated with this inbox:

	notmuch.git.git (no URL configured)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).