Skip Menu |

This queue is for tickets about the Module-Signature CPAN distribution.

Report information
The Basics
Id: 39259
Status: open
Priority: 0/
Queue: Module-Signature

Owner: Nobody in particular
Requestors: PJF [...]

Bug Information
Severity: Normal
Broken in: 0.55
Fixed in: (no value)


Subject: [PATCH] [TEST] Win32 gpg version detection on cygwin fails
Download (untitled) / with headers
text/plain 784b
G'day Audrey and M::S maintainers, The Module::Signature module fails to detect the version of gpg installed when running under cygwin. The _has_gpg routine assumes that the version number appears at the end of the line: sub _has_gpg { `gpg --version` =~ /GnuPG.*?(\S+)$/m or return; return $1; } However the Windows version of GnuPG called from cygwin emits Windows style 'CR LF' linefeeds, rather than unix style 'LF' linefeeds. These end up in the output of backticks, meaning that the regexp can't find the end of the file. Attached are two patches against the 0.55 release on the CPAN. One for a test which detects this condition, and a second for a patch that solves it (by allowing \s* characters after the version). Many thanks, and all the very best, Paul
Subject: 0002-Fix-for-incorrect-gpg-version-detction-under-cygwin.patch
From 7a2ef1253cb7176fd7ccb1019f17654b8f114b54 Mon Sep 17 00:00:00 2001 From: Paul Fenwick <> Date: Sun, 14 Sep 2008 15:00:20 +1000 Subject: [PATCH] Fix for incorrect gpg version detction under cygwin. --- lib/Module/ | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Module/ b/lib/Module/ index f239e3b..1ee53c2 100644 --- a/lib/Module/ +++ b/lib/Module/ @@ -131,7 +131,7 @@ sub _verify { } sub _has_gpg { - `gpg --version` =~ /GnuPG.*?(\S+)$/m or return; + `gpg --version` =~ /GnuPG.*?(\S+)\s*$/m or return; return $1; } --
Subject: 0001-Test-for-failing-gpg-detection-under-cygwin.patch
From 61e4595e0baaeb27ef4d842120c1aa7c832cfc6b Mon Sep 17 00:00:00 2001 From: Paul Fenwick <> Date: Sun, 14 Sep 2008 14:59:15 +1000 Subject: [PATCH] Test for failing gpg detection under cygwin --- t/2-cygwin.t | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 t/2-cygwin.t diff --git a/t/2-cygwin.t b/t/2-cygwin.t new file mode 100644 index 0000000..e9248c0 --- /dev/null +++ b/t/2-cygwin.t @@ -0,0 +1,21 @@ +#!/usr/bin/perl -w +use strict; + +use Module::Signature; +use Test::More; + +if ($^O ne 'cygwin') { + plan skip_all => "Cygwin only tests"; +} +elsif (! $ENV{TEST_CYGWIN_GNUPG} ) { + plan skip_all => 'Set the environment variable TEST_CYGWIN_GNUPG to enable this test'; +} +elsif (! -x '/usr/local/bin/gpg') { + plan skip_all => '/usr/local/bin/gpg not found'; +} + +plan tests => 1; + +my $version = Module::Signature::_has_gpg(); + +like($version, qr/^\d+\.\d+\.\d+$/, "gpg version detected"); --
Your patches have been applied and released with 0.64. Many thanks!
Download (untitled) / with headers
text/plain 841b
On Sat May 08 18:55:56 2010, FLORA wrote: Show quoted text
> Your patches have been applied and released with 0.64.
These patches are misnamed. Default cygwin gpg is in /usr/bin/gpg if installed via setup. The patches and new cygwin test checks for a special /usr/local/bin/gpg which looks like a mingw gpg build which adds of course crlf. I would rename the new check to "check for bogus mingw gpg on cygwin if standard cygwin gpg is not installed". The test itself is horrible. If a user installs a mingw version, it can be anywhere in the path, not just into /usr/local/bin/gpg. So the path should be searched. But we already do that by can_run('gpg'). Changes: Correctly detect a mingw version of gnupg on cygwin and add tests for it (Paul Fenwick) (Closes RT#39258). t/2-cygwin.t: delete it. the version is already checked. -- Reini Urban

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to