cuttenweiler has asked for the wisdom of the Perl Monks concerning the following question:

So I'm working with Perl 2.20.2, against Gnupg2 (2.0.22) on CentOS 7. I'm trying to us cpan / cpanm, to install the module GnuPG, and it fails MANY tests after compile: 1 - gen_key_test - "protocol error: expected GET_XXX got ERROR\x{a}" 10 -pipe_decrypt - "protocol error: expected ENC_TO got NODATA: \x{a}" 11 - encrypt_sign_test - "Protocol error: expected NEED_PASSPHRASE.* got INV_SGNR\x{a}" and lots more. Thing is that gpg2 is working fine. I can encode / keygen / decode all day long on the command line. Only GnuPG spits up via perl. Any ideas? It's not just filling the tests - the module doesn't work if forced either.

Replies are listed 'Best First'.
Re: GnuPG module doesn't pass tests
by 1nickt (Canon) on Jan 10, 2017 at 00:33 UTC

    Hi cuttenweiler,

    I haven't used GnuPG myself, but the docs state:

    • The API is accessed through methods on a GnuPG object which is a wrapper around the gpg program.

    ... whereas you apparently have gpg2?

    Maybe this helps.


    The way forward always starts with a minimal test.
      Indeed - gpg2 is installed and operating correctly. When I run all of the tests in the test.pl from the command line using the native tools, I succeed. (Get key, encode, decode, import, export, etc etc.)

        "gpg2 is installed and operating correctly"

        ... whereas the docs for GnuPG begin with:

        GnuPG - Perl module interface to the GNU Privacy Guard (v1.x.x series)


        The way forward always starts with a minimal test.
        PS -> GnuPG does work with gpg2. Verified on a Gentoo box, and a few other distros. Am I the only guy working with the GnuPG module on CentOS 7? 'Cause I just tested it with a fresh out of the box CentOS 7 image and Vendor perl (5.16.3) and it fails the exact same way as 5.20.2. Severe weirdness!
Re: GnuPG module doesn't pass tests
by hippo (Archbishop) on Jan 10, 2017 at 11:05 UTC

    This might be the same as RT 117002 and/or the test failures to which it refers.

    So I'm working with Perl 2.20.2

    I assume here that should be 5.20.2. If you aren't using the stock CentOS7 perl (5.16.3), why install such an old one? Or are you using an update/respin of CentOS7?

      Typo's make life more interesting... yes indeed it's 5.20.2. I'm locked into that at the moment because of a very very large confederated perl legacy application that uses / is verified on that version. I'm using perlbrew to overlay the vendor perl. I've verified my paths and libs are correct. I also reverted back to vendor perl and still have the same issue. I'm about to launch a fresh CentOS 7 and try to install the module there to see if there is something about perlbrew that could be causing the issue. I don't have high hopes for that... but we'll see.
Re: GnuPG module doesn't pass tests
by codiac (Beadle) on Jan 13, 2017 at 11:37 UTC

    Looks like this was addressed on Debian by forcing the module to use GPG1, perhaps other distros have done the same? https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=834522

    Perhaps try setting gnupg_path to point to GPG1 binary and see if that works.