Hi,
this is strictly speaking a problem in Apache mod_perl2, but as it seems
very easy to work around it in Mail::GnuPG, I'm submitting it here.
Mail::GnuPG::verify uses GnuPG::Interface in a way that doesn't work
with mod_perl2. The problem is that GnuPG::Interface::verify is called
without a separate handle for stdout. In my understanding,
GnuPG::Interface then uses the real stdout for this and wants to call
fileno() on it (in fork_attach_exec() around line 228 of
GnuPG/Interface.pm, version 0.33)
Unfortunately mod_perl2 doesn't support fileno() (it always returns -1)
and the result is
Can't open(IO::Handle=GLOB(0xd595ec4), >&-1): Invalid argument at
/usr/share/perl5/Mail/GnuPG.pm line 425
The attached patch works around the problem by creating a new handle for
verify() stdout, in line with the other GnuPG::Interface method calls.
Please consider including it.
I'm also attaching a crude CGI script that hopefully demonstrates the
problem. It works fine as an ordinary CGI program and under mod_perl
(ie. version 1) on Apache 1. The problem only occurs with mod_perl2 on
Apache2.
The system is Debian GNU/Linux unstable, with Perl 5.8.8,
GnuPG::Interface 0.33, Mail::GnuPG 0.08, mod_perl 2.0.2.
(This originally showed up as a problem with Request Tracker, which can
optionally use Mail::GnuPG to verify incoming emails.)
Thanks for your work on Mail::GnuPG.
Cheers,
--
Niko Tyni
ntyni@iki.fi