Skip Menu |

This queue is for tickets about the GnuPG-Interface CPAN distribution.

Report information
The Basics
Id: 88963
Status: resolved
Priority: 0/
Queue: GnuPG-Interface

People
Owner: Nobody in particular
Requestors: coolo [...] suse.de
Cc:
AdminCc:

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



Subject: broken test encode.t
When I run make test while building openSUSE package, I get this: [ 6s] gpg: WARNING: unsafe permissions on homedir `test' [ 6s] gpg: test/trustdb.gpg: trustdb created [ 6s] t/encrypt.t ................ [ 6s] Failed 1/3 subtests When I run make test again, I don't get the "trustdb created" anymore and the test succeeds. [ 12s] gpg: WARNING: unsafe permissions on homedir `test' [ 12s] t/encrypt.t ................ ok This is with gpg2-2.0.21 on openSUSE 13.1
I'm not the maintainer of this module, but it seems that this is due to the fact that the maintainer has not shipped a test/trustdb.gpg file with the dist. The trustdb is required for the encrypt action in the first test case. the gpg command is emitting this error on the first test failure: gpg: Fatal: can't open `test/trustdb.gpg': No such file or directory You can replicate this by starting with a clean dist (or remove test/trustdb.gpg alternatively) and run: gpg --home test --recipient 2E854A6B --armor --trust-model=always --encrypt Makefile.PL And you should see something like: gpg: WARNING: unsafe permissions on homedir `test' gpg: Fatal: can't open `test/trustdb.gpg': No such file or directory And "gpg" is exiting with code 2 in this instance. The actions taken by the second test (specifically $gnupg->get_public_keys) cause the trustdb.gpg file to be auto-created which eliminates this problem. Switching the order of the first and second tests fixes "make test" so it works the first time. I've attached a patch that swaps the order of the first two tests, and this fixes the problem for me. An alternative solution for the dist maintainer is to ship a trustdb.gpg file with the dist.
Subject: 0001-work-around-missing-trustdb.gpg-needed-by-encrypt.t.patch
From 2c99c6b8b1275ebea83f0815c61bcca367072737 Mon Sep 17 00:00:00 2001 From: Michael Schout <mschout@gkg.net> Date: Mon, 16 Feb 2015 12:45:18 -0600 Subject: [PATCH] work around missing trustdb.gpg needed by encrypt.t This swaps the order of the tests so that get_public_keys() gets called before encrypt(), which auto-creates the missing trustdb.gpg file --- Changes | 3 +++ t/encrypt.t | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 31e4d36..2c870fd 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,8 @@ Revision history for GnuPG-Interface +{{$NEXT}} + - Work around missing trustdb.gpg needed in some instances by encrypt.t + 0.51 - 2014-12-17 - Update README file - Work around gpg2 bug by omitting --homedir during symmetric diff --git a/t/encrypt.t b/t/encrypt.t index 0c26e7c..831798f 100644 --- a/t/encrypt.t +++ b/t/encrypt.t @@ -14,15 +14,16 @@ TEST { reset_handles(); + my @keys = $gnupg->get_public_keys( '0xF950DA9C' ); $gnupg->options->clear_recipients(); $gnupg->options->clear_meta_recipients_keys(); - $gnupg->options->push_recipients( '0x2E854A6B' ); + $gnupg->options->push_meta_recipients_keys( @keys ); my $pid = $gnupg->encrypt( handles => $handles ); print $stdin @{ $texts{plain}->data() }; close $stdin; - waitpid $pid, 0; + waitpid $pid, 0; return $CHILD_ERROR == 0; }; @@ -32,16 +33,15 @@ TEST { reset_handles(); - my @keys = $gnupg->get_public_keys( '0xF950DA9C' ); $gnupg->options->clear_recipients(); $gnupg->options->clear_meta_recipients_keys(); - $gnupg->options->push_meta_recipients_keys( @keys ); + $gnupg->options->push_recipients( '0x2E854A6B' ); my $pid = $gnupg->encrypt( handles => $handles ); print $stdin @{ $texts{plain}->data() }; close $stdin; - waitpid $pid, 0; + waitpid $pid, 0; return $CHILD_ERROR == 0; }; -- 2.2.1
Subject: Re: [rt.cpan.org #88963] broken test encode.t
Date: Mon, 16 Feb 2015 20:50:24 -0500
To: bug-GnuPG-Interface [...] rt.cpan.org
From: Alex Vandiver <alex [...] chmrr.net>
Show quoted text
> I'm not the maintainer of this module, but it seems that this is due > to the fact that the maintainer has not shipped a test/trustdb.gpg > file with the dist. The trustdb is required for the encrypt action in > the first test case.
It shouldn't be; --trust-model=always should not necessitate the existance of a trustdb. See below. Show quoted text
> the gpg command is emitting this error on the first test failure: > > gpg: Fatal: can't open `test/trustdb.gpg': No such file or directory > > You can replicate this by starting with a clean dist (or remove > test/trustdb.gpg alternatively) and run: > > gpg --home test --recipient 2E854A6B --armor --trust-model=always \ > --encrypt Makefile.PL > > And you should see something like: > > gpg: WARNING: unsafe permissions on homedir `test' > gpg: Fatal: can't open `test/trustdb.gpg': No such file or directory > > And "gpg" is exiting with code 2 in this instance.
GPG 2 does; GPG 1.4 does not. Compare: $ rm Makefile.PL.asc $ gpg --version | head -1 gpg (GnuPG) 1.4.16 $ rm -f test/trustdb.gpg $ gpg --homedir test --recipient 2E854A6B --armor \ --trust-model=always --encrypt Makefile.PL gpg: WARNING: unsafe permissions on homedir `test' $ echo $? 0 $ ls test | grep trustdb $ ls test | grep trustdb | wc -l 0 This is a bug in gpg2, and will be fixed in 2.0.27; see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751266 and http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=commitdiff;h=07006c99 Show quoted text
> The actions taken by the second test (specifically > $gnupg->get_public_keys) cause the trustdb.gpg file to be auto-created > which eliminates this problem.
I've added a preliminary step which explicitly creates the trustdb, as a workaround for the above bug. - Alex