[pkg-horde] Bug#849151: php-horde-crypt: add gnupg as an explicit test dep, update for gnupg2

Nishanth Aravamudan nish.aravamudan at canonical.com
Thu Dec 22 23:50:48 UTC 2016


Package: php-horde-crypt
Version: 2.7.5-1
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu zesty ubuntu-patch

Dear Maintainer,

autopkgtests for php-horde-crypt are currently failing on Ubuntu but
passing on Debian. This appears to be because our images have
/usr/bin/gpg present (with version 2.x) which the current tests fail on.
It seems like gnupg should be listed as a test dep and the tests should
be updated to be compatible with 2.x. I have sent the patch below
upstream in a ticket and verified that the resulting source package does
pass in Unstable.

In Ubuntu, the attached patch was applied to achieve the following:

  * d/t/control: add explicit dependency on gnupg for tests
  * debian/patches/update_tests_gnupg2.patch: Update tests for gnupg2
    changes.  Closes LP: #1652133.

Thanks for considering the patch.

*** /tmp/tmpe2HfZ0/php-horde-crypt_2.7.5-1ubuntu1.debdiff
diff -Nru php-horde-crypt-2.7.5/debian/patches/series php-horde-crypt-2.7.5/debian/patches/series
--- php-horde-crypt-2.7.5/debian/patches/series	1969-12-31 16:00:00.000000000 -0800
+++ php-horde-crypt-2.7.5/debian/patches/series	2016-12-22 10:33:31.000000000 -0800
@@ -0,0 +1 @@
+update_tests_gnupg2.patch
diff -Nru php-horde-crypt-2.7.5/debian/patches/update_tests_gnupg2.patch php-horde-crypt-2.7.5/debian/patches/update_tests_gnupg2.patch
--- php-horde-crypt-2.7.5/debian/patches/update_tests_gnupg2.patch	1969-12-31 16:00:00.000000000 -0800
+++ php-horde-crypt-2.7.5/debian/patches/update_tests_gnupg2.patch	2016-12-22 10:37:12.000000000 -0800
@@ -0,0 +1,64 @@
+Description: Update tests for gnupg2 changes
+ The tests currently rely on gpg1 behavior, so pass parameters to gpg
+ that make gpg2 emulate the behavior of gpg1 as necessary. Thanks to
+ https://github.com/keybase/keybase-issues/issues/1712 for related, but
+ not identical, issues and solution suggestions.
+ .
+ Split testVerifyPassphrase() into two tests: gpg2 always spawns a
+ gpg-agent, which caches passphrases. So the first correct passphrase
+ ends up leading to the second bad passphrase attempt passing.
+Author: Nishanth Aravamudan <nish.aravamudan at canonical.com>
+Bug: https://bugs.horde.org/ticket/14548
+Bug-Ubuntu: https://launchpad.net/bugs/1652133
+Forwarded: https://bugs.horde.org/view.php?actionID=view_file&type=patch&file=update_tests_gnupg2.patch&ticket=14548
+Last-Update: 2016-12-22
+
+--- a/Horde_Crypt-2.7.5/lib/Horde/Crypt/Pgp/Backend/Binary.php
++++ b/Horde_Crypt-2.7.5/lib/Horde/Crypt/Pgp/Backend/Binary.php
+@@ -75,8 +75,15 @@
+             '--no-options',
+             '--no-default-keyring',
+             '--yes',
+-            '--homedir ' . $this->_tempdir
++            '--homedir ' . $this->_tempdir,
++            '--keyid-format short'
+         );
++
++        $result = $this->_callGpg(array('--version'), 'r', null, false, false, true);
++        /* gpg > 1.x requires specifying the pinentry-mode */
++        if (!preg_match('/gpg \(GnuPG\) = (1\.[0-9\.]+)/', $result->stdout, $m)) {
++           $this->_gnupg[] = '--pinentry-mode loopback';
++        }
+     }
+ 
+     /**
+@@ -678,6 +685,7 @@
+         if ($parseable) {
+             putenv('LANGUAGE=C');
+         }
++        putenv('GPG_TTY=$(tty)');
+         if ($mode == 'w') {
+             if ($fp = popen($cmdline, 'w')) {
+                 putenv('LANGUAGE=' . $language);
+--- a/Horde_Crypt-2.7.5/test/Horde/Crypt/Pgp/TestBase.php
++++ b/Horde_Crypt-2.7.5/test/Horde/Crypt/Pgp/TestBase.php
+@@ -511,7 +511,7 @@
+         $this->assertNotEmpty($out->result);
+     }
+ 
+-    public function testVerifyPassphrase()
++    public function testVerifyPassphraseCorrect()
+     {
+         $this->assertTrue(
+             $this->_pgp->verifyPassphrase(
+@@ -520,7 +520,10 @@
+                 'Secret'
+             )
+         );
++    }
+ 
++    public function testVerifyPassphraseIncorrect()
++    {
+         $this->assertFalse(
+             $this->_pgp->verifyPassphrase(
+                 $this->_getPublicKey(),
diff -Nru php-horde-crypt-2.7.5/debian/tests/control php-horde-crypt-2.7.5/debian/tests/control
--- php-horde-crypt-2.7.5/debian/tests/control	2016-12-17 14:04:22.000000000 -0800
+++ php-horde-crypt-2.7.5/debian/tests/control	2016-12-22 10:37:12.000000000 -0800
@@ -1,3 +1,3 @@
 Tests: phpunit
 Restrictions: needs-recommends
-Depends: @, php-cli, php-horde-test
+Depends: @, php-cli, php-horde-test, gnupg


-- System Information:
Debian Release: stretch/sid
  APT prefers yakkety-updates
  APT policy: (500, 'yakkety-updates'), (500, 'yakkety-security'), (500, 'yakkety'), (100, 'yakkety-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-30-generic (SMP w/4 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-- 
Nishanth Aravamudan
Ubuntu Server
Canonical Ltd



More information about the pkg-horde-hackers mailing list