Subject: | t/00signature.t fails if pool.sks-keyservers.net can be resolved but cannot be connected to |
I have different build environments, and one allows DNS resolutions but does not allow other TCP connections out of local network. In such environment, t/00signature.t fails:
gpg: new configuration file `/builddir/.gnupg/gpg.conf' created
gpg: WARNING: options in `/builddir/.gnupg/gpg.conf' are not yet active during t
his run
gpgkeys: HTTP fetch error 7: Failed to connect to pool.sks-keyservers.net port 1
1371: Network is unreachable
gpg: Signature made Tue Aug 30 08:30:20 2011 CEST using DSA key ID A317C15D
gpg: requesting key A317C15D from hkp server pool.sks-keyservers.net
gpg: no valid OpenPGP data found.
gpg: Can't check signature: public key not found
==> BAD/TAMPERED signature detected! <==
t/00signature.t ..
Failed 1/1 subtests
Attached patch should fix it. Please consider applying it.
Subject: | 0001-Try-to-connect-to-pool.sks-keyservers.net.patch |
From 341641c72e5c102b37bdaf349cb718f086e0e9c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 3 Apr 2014 09:07:29 +0200
Subject: [PATCH] Try to connect to pool.sks-keyservers.net
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
t/00signature.t fails if pool.sks-keyservers.net can be resolved, but
you cannot connect to it. This patch augments the "Cannot connect to
the keyserver" precheck to do real TCP connect.
Signed-off-by: Petr PÃsaÅ <ppisar@redhat.com>
---
t/00signature.t | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/t/00signature.t b/t/00signature.t
index c7da469..75ae6d4 100644
--- a/t/00signature.t
+++ b/t/00signature.t
@@ -49,7 +49,19 @@ BEGIN {
}
}
unless ($exit_message) {
- if (!eval { require Socket; Socket::inet_aton('pool.sks-keyservers.net') }) {
+ if (!eval {
+ use Socket qw(AF_INET SOCK_STREAM pack_sockaddr_in inet_aton);
+ my $socket;
+ socket($socket, AF_INET, SOCK_STREAM, 0) and
+ connect(
+ $socket,
+ pack_sockaddr_in(
+ scalar getservbyname('hkp', 'tcp'),
+ inet_aton('pool.sks-keyservers.net')
+ )
+ ) and
+ close($socket)
+ }) {
$exit_message = "Cannot connect to the keyserver";
}
}
--
1.9.0