-
Notifications
You must be signed in to change notification settings - Fork 6
GnuPG::Interface::_version does not work under mod_perl #8
Copy link
Copy link
Open
Description
When trying to sign a mail message from mod_perl using Mail::GnuPG I get these errors:
Can't open(IO::Handle=GLOB(0x563c07e781e0), <&-1): Invalid argument at (eval 276) line 55.
and
Use of uninitialized value $line in pattern match (m//) at /usr/lib64/perl5/vendor_perl/5.32/GnuPG/Interface.pm line 830.
Argument "xnovosa1" isn't numeric in numeric comparison (<=>) at /usr/lib64/perl5/vendor_perl/5.32/GnuPG/Interface.pm line 849.
Argument "xnovosa1" isn't numeric in numeric comparison (<=>) at /usr/lib64/perl5/vendor_perl/5.32/GnuPG/Interface.pm line 849.
GnuPG Version 1.4 or 2.2+ required at (eval 276) line 55.
Under mod_perl, fileno(STDIN) == -1 and the code in GnuPG::Interface::fork_attach_exec doesn't cope with this possibility. This patch seems to be a simple way of avoiding the problem:
diff --git a/lib/GnuPG/Interface.pm b/lib/GnuPG/Interface.pm
index 905ae30..a8d5aba 100644
--- a/lib/GnuPG/Interface.pm
+++ b/lib/GnuPG/Interface.pm
@@ -821,7 +821,10 @@ sub _version {
my ( $self ) = @_;
my $out = IO::Handle->new;
- my $handles = GnuPG::Handles->new( stdout => $out );
+ my $handles = GnuPG::Handles->new(
+ stdout => $out,
+ stdin => IO::Handle->new,
+ );
my $pid = $self->wrap_call( commands => [ '--no-options', '--version' ], handles => $handles );
my $line = $out->getline;
$line =~ /(\d+\.\d+\.\d+)/;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels