Skip Menu |

This queue is for tickets about the GnuPG CPAN distribution.

Report information
The Basics
Id: 4957
Status: resolved
Priority: 0/
Queue: GnuPG

People
Owner: Nobody in particular
Requestors: malcolm [...] indeterminate.net
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: (no value)
Fixed in: (no value)



Subject: Patch to fix IMPORT_OK bug (includes POSIX_SC_OPEN_MAX fix)
Running GnuPG against versions of gnupg later than 1.0.7 and trying to import keys will cause an error ("protocol error expected IMPORT_RES got IMPORT_OK"). This becomes apparent in the output of tests 2, 3, and 4 when running make test, for example. This is due to a change in the output from gnupg that was introduced in version 1.2.0. import commands now write IMPORT_OK in addition to IMPORT_RES to the --status-fd file descriptor. The attached patch fixes this problem, as well as the POSIX_SC_OPEN_MAX issue previously reported. My environment: GnuPG-0.09 perl 5.8.0 and 5.6.1 Redhat 9 and RedHat Enterprise Linux, 2.1 Malcolm Heath
--- GnuPG.pm 2001-06-08 09:28:53.000000000 -0700 +++ GnuPG.new 2004-01-15 15:27:26.000000000 -0800 @@ -264,7 +264,7 @@ # some ends must be closed in the child. # # Besides this is just plain good hygiene - my $max_fd = POSIX::sysconf( POSIX::_SC_OPEN_MAX ) || 256; + my $max_fd = POSIX::sysconf( &POSIX::_SC_OPEN_MAX() ) || 256; foreach my $f ( 3 .. $max_fd ) { next if $f == fileno $self->{status_fd}; POSIX::close( $f ); @@ -478,8 +478,11 @@ } # We will see one IMPORT_RES for all files processed - $self->abort_gnupg ( "protocol error expected IMPORT_RES got $cmd\n" ) - unless $cmd =~ /IMPORT_RES/; + # If we are using gpg version 1.0.7 or earlier, IMPORT_RES will + # be the next thing we see. If we're using version 1.2.0 or later + # we'll see IMPORT_OK + $self->abort_gnupg ( "protocol error expected IMPORT_RES or IMPORT_OK, got $cmd\n" ) + unless $cmd =~ /IMPORT_(OK|RES)/; $self->end_gnupg; # We return the number of imported keys
Version 0.10 has just been released and should resolve the problem