tags 735536 patch
thanks

Hi,

the attached patch created the trustdb gpg is missing.
It might make sense to fix the while loop to stop in case import_key fails, but
fixing the issue behind this bug was more important for me.

The patch also fixes a warning about defined being deprecated.

Cheers,

Bernd

-- 
 Bernd Zeimetz                            Debian GNU/Linux Developer
 http://bzed.de                                http://www.debian.org
 GPG Fingerprint: ECA1 E3F2 8E11 2432 D485  DD95 EB36 171A 6FF9 435F
--- /usr/bin/caff	2011-11-01 20:01:39.000000000 +0100
+++ caff	2014-01-26 22:46:39.626878889 +0100
@@ -596,7 +596,7 @@
 			}
 		}
 
-		next unless (defined(@$readyr)); # Wait some more.
+		next unless ($readyr); # Wait some more.
 
 		for my $rfd (@$readyr) {
 			$readwrote_stuff_this_time = 1;
@@ -732,11 +732,31 @@
 };
 
 ######
+# create trustdb in $gnupghome
+######
+sub create_trustdb($) {
+	my ($gnupghome) = @_;
+
+	my $gpg = GnuPG::Interface->new();
+	$gpg->call( $CONFIG{'gpg'} );
+	$gpg->options->hash_init(
+		'homedir' => $gnupghome,
+		'extra_args' => [ qw{ --import-ownertrust } ] );
+	$gpg->options->meta_interactive( 0 );
+	my ($inputfd, $stdoutfd, $stderrfd, $statusfd, $handles) = make_gpg_fds();
+        my $pid = $gpg->wrap_call(handles => $handles);
+        my ($stdout, $stderr, $status) = readwrite_gpg('#\n', $inputfd, $stdoutfd, $stderrfd, $statusfd);
+        waitpid $pid, 0;
+};
+
+######
 # import a key from the scalar $asciikey into a gpg homedirectory in $tempdir
 ######
 sub import_key($$) {
 	my ($gnupghome, $asciikey) = @_;
 
+        create_trustdb($gnupghome);
+
 	my $gpg = GnuPG::Interface->new();
 	$gpg->call( $CONFIG{'gpg'} );
 	$gpg->options->hash_init(

Reply via email to