Skip Menu |

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

Report information
The Basics
Id: 5543
Status: rejected
Priority: 0/
Queue: GnuPG-Interface

People
Owner: ftobin [...] cpan.org
Requestors: ch.koechli [...] intellinet.ch
Cc:
AdminCc:

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



Subject: Size limit for signing?
Distribution: SuSE 9.0 Kernel: 2.6.3 SMP Perl: 5.8.1 I have a problem that the program froze if I try to sign medium data amount (of 2 MB). Here is a part of the code (I hope the responsible one): ======================================================================= sub pgpsign { my $intext = shift; my $signuser = shift; my $signpass = shift; my ( $errtext, $outtext); my $gnupg = GnuPG::Interface->new(); print "Begin signing...\n"; $gnupg->options->hash_init( armor => 1, batch => 1 , always_trust => 1, default_key => $signuser); print "After Initialising.\n"; my ( $pgpin, $pgpout ) = ( IO::Handle->new(), IO::Handle->new() ); my ( $pgperr , $pgppass ) = ( IO::Handle->new(), IO::Handle->new() ); print "After Creating Handles.\n"; my $pgphandles = GnuPG::Handles->new( stdin => $pgpin, stdout => $pgpout, stderr => $pgperr, passphrase => $pgppass ); print "After assigning Handles.\n"; my $pgppid = $gnupg->clearsign( handles => $pgphandles ); print "After clearsign command.\n"; print $pgppass ($signpass); close $pgppass; print "After giving password.\n"; print $pgpin $intext; print "End of intext.\n"; close $pgpin; print "After giving cleartext.\n"; $outtext .= $_ foreach (<$pgpout>); my @gpgerr = <$pgperr>; print "@gpgerr" if @gpgerr; print "End signing...\n"; close $pgpout; waitpid $pgppid, 0; return $outtext; } ======================================================================= If I use this procedure, I get the following printout: ======================================================================= Begin signing... After Initialising. After Creating Handles. After assigning Handles. After clearsign command. After giving password. ======================================================================= And could now wait forever. The process does not need any processor power. Is there a reasonable explanation for that? Thanks a lot in advance. Christof
This is a known issue: when piping a significant amount of data, such as 2MB, you can fill the pipes GnuPG::Interface has setup, and then block. The solution is to write the data to a temporary (unlinked) file, and then use the 'direct' option for your handles as described in the GnuPG::Interface, feeding the handle to the tempfile to for the stdin, and settin the direct option for it.
[FTOBIN - Wed Mar 3 19:52:17 2004]: Show quoted text
> This is a known issue: when piping a significant amount of data, such > as 2MB, you can fill the pipes GnuPG::Interface has setup, and then > block. > > The solution is to write the data to a temporary (unlinked) file, and > then use the 'direct' option for your handles as described in the > GnuPG::Interface, feeding the handle to the tempfile to for the stdin, > and settin the direct option for it.
Another solution is to perform a simple multiplexing algorithm when handling I/O with GnuPG::Interface (with help of IO::Select). I implemented such a thing in Mail::GPG->perform_multiplexed_gpg_io(), which handles arbitrary big entities without creating temporary files. Regards, Joern