Subject: [bug#42404] [PATCH 3/5] gnu: Add rnp.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 24 Jul 2020 15:20:45 +0200

Hi!

Justus Winter <[email-masked]> skribis:

> * gnu/packages/openpgp.scm (rnp): New variable.
> * gnu/packages/patches/rnp-disable-ruby-rnp-tests.patch: New file.
> * gnu/packages/patches/rnp-fix-gnupg-list-packets.patch: New file.
> * gnu/packages/patches/rnp-fix-test-setup.patch: New file.
> * gnu/packages/patches/rnp-fix-test.patch: New file.
> * gnu/packages/patches/rnp-fix-true-false.patch: New file.
> * gnu/packages/patches/rnp-unbundle-googletest.patch: New file.

Thanks for the quick update!

Some (hopefully final!) comments:

> +++ b/gnu/packages/patches/rnp-fix-gnupg-list-packets.patch
> @@ -0,0 +1,37 @@
> +From 4cb5b2c1d3783bfad3c4f77b2ad2ac89921e91f4 Mon Sep 17 00:00:00 2001
> +From: Justus Winter <[email-masked]>
> +Date: Tue, 21 Jul 2020 16:03:32 +0200
> +Subject: [PATCH 4/6] Make invoking GnuPG more robust.
> +
> +GnuPG will try to read its state even for operations that do not
> +require it, e.g. listing packets.  If the state directory does not
> +exist, GnuPG will try to create it.  If this fails, GnuPG errors out.
> +
> +In some build environments, $HOME may not exist or may not be
> +writable (e.g. in Guix and Nix, $HOME does not exist).  This leads to
> +a spurious test failures when GnuPG is invoked to inspect packets.
> +
> +Fix this by using the current directory as GnuPG state directory.
> +
> +Merged upstream as 681e3be65594469f2e6e5912b4371d1af981d7c7.
> +---
> + src/tests/cli_tests.py | 3 ++-
> + 1 file changed, 2 insertions(+), 1 deletion(-)
> +
> +diff --git a/src/tests/cli_tests.py b/src/tests/cli_tests.py
> +index 74b28983..2b7d772a 100755
> +--- a/src/tests/cli_tests.py
> ++++ b/src/tests/cli_tests.py
> +@@ -106,7 +106,8 @@ RNP_TO_GPG_CIPHERS = {'AES' : 'aes128', 'AES192' : 'aes192', 'AES256' : 'aes256'
> +         'IDEA' : 'idea', '3DES' : '3des', 'CAST5' : 'cast5', 'BLOWFISH' : 'blowfish'}
> + 
> + def check_packets(fname, regexp):
> +-    ret, output, err = run_proc(GPG, ['--list-packets', path_for_gpg(fname)])
> ++    ret, output, err = run_proc(GPG, ['--homedir', '.',

For the purposes of the tests, how about simply adding a pre-check phase
that does: (setenv "HOME" (getpwd)) ?  That way we won’t have to carry
another patch.

> +++ b/gnu/packages/patches/rnp-fix-test-setup.patch
> @@ -0,0 +1,36 @@
> +From f544b3e63416f3a824ed2955d119ea0d36c88b36 Mon Sep 17 00:00:00 2001
> +From: Justus Winter <[email-masked]>
> +Date: Tue, 21 Jul 2020 16:00:37 +0200
> +Subject: [PATCH] Make test environment setup more robust.
> +
> +Previously, a failing test leaving RNP or GnuPG state directories
> +behind would cause all tests following it to fail.  Improve this by
> +removing the directories first should they exist.
> +
> +Merged upstream as 203224f0b1505dba17837c03da603e5b98ab125a.

[...]

> +Subject: [PATCH 2/6] Fix possible rare failure in test_key_unlock_pgp() test.
> +
> +Fixed upstream in ba5030620dba3e8684b31ef28687390ca693bf9d.

[...]

> +Subject: [PATCH 3/6] Use 'true' and 'false' instead of 'TRUE' and 'FALSE'.
> +
> +The latter are not guaranteed to be defined.
> +
> +Fixed upstream in 0a28a7e982cb229ba041290af073e6d7ede19955.

Should we just pick a Git snapshot for now instead of carrying these
patches?  I tend to freak out when I see many patches.  ;-)

Thanks,
Ludo’.