Re: mod_perl, OpenPGP Math::Pari - Solved
someone coulda told me to RTFM.. 8) then again I've read it before, so it probably wouldn't have helped, but just for those who have doubts... PerlFreshRestart is BAD!! but it's bad in a weird way cos it didn't affect my test server, but when I turned it off on the production server everything was good again... 8) J Jason Galea wrote: Ged Haywood wrote: There's a file in the mod_perl directory called SUPPORT. (That bit about 'perl -V' was taken from there. :) SUPPORT contains detailed instructions about what to do when mod_perl crashes, including what information to provide and how to generate a stack backtrace. 73, Ged. yeh, read that... I guess I shoudn't have used the word crashes as it's really dies when it tries to do a numeric comparison on an alphanumeric string, which is entirely reasonable, so I'm not getting a core dump, and I don't think mod_perl itself is at fault. I suspect the implementation of GP/Pari as I ended up with the worst case as mentioned in the Math::Pari install and manually copied (as instructed) what I guess is a 'C' library file of some description (paricfg.h - I am by no stretch a C programmer..) to the proper location. It all seemed to work ok after that and as I had had troubles prior I already had my test scripts which all ran fine so I thought Hooray! Then I implemented the real system and got the errors mentioned. What I still don't understand is why the test scripts run ok, but the mod_perl implementation doesn't. (But on my dev server everything works as it should..) I'm going to reinstall GP/Pari on the production server using the src.rpm I found on the Pari site, then if that goes ok I might be able to install/update Math::Pari without errors, then maybe it'll all work.. that's the plan anyway.. cheers, -- J Web Developer Eight Degrees Off Centre http://www.eightdegrees.com.au/
Re: mod_perl, OpenPGP Math::Pari - Solved
Hi again, On Fri, 8 Feb 2002, Jason Galea wrote: someone coulda told me to RTFM.. 8) That's what I was trying to tell you. :) 73, Ged.
Re: mod_perl, OpenPGP Math::Pari
[snip] perl -V That's lower case perl, upper case V. [snip] now that's funny! ok, so I was babbling.. try this. A simple perl script useing Crypt::OpenPGP runs fine from the command line while the same subroutine used in a mod_perl module on the same machine crashes. Why? Its nothing to do with global variables, multiple runs, or random occurances. I put a warn statement into Crypt::Primes to show the offending variable $B represented as 'B'. The only line I can find in Crypt::Primes that sets the value of $B is: my $B = floor ( $c_opt * ( $k ** 2 ) ); 'floor' is imported from Math::Pari which according to the docs does not use any enviromental variables. Throughout the run from the commandline $B remains an everchanging integer, while during the mod_perl run it suddenly becomes something else (37e5156f in the example below) subsequently crashing the program when it is involved in a numeric comparison. and, yeh, if no one else has any suggestions this time, I'll drop it. Thanks, Tom, for the nudge I needed to get this far.. cheers, J run from the commandline (test_pgp_gen.pl): my $attrib = { Size = '2048', Identity = 'PGP EzyDVD [EMAIL PROTECTED]', Password = 'a new passphrase for you', }; my $self = { EV_config = { PGPKeyLoc = 'd_main/data/.pgptest', }, }; # test Key Generation ($self) = pgp_keygen($self,$attrib); exit; sub pgp_keygen{ ## my ($self,$attrib) = @_; my $file = time; warn Generating Keys; use Crypt::OpenPGP; warn Creating Keychain; my $keychain = Crypt::OpenPGP-new; warn Generating Keys with:\n\tType = 'RSA'\n\tSize = $attrib-{'Size'}\n\tIdentity = $attrib-{'Identity'}\n\tPassphrase = $attrib-{'Password'}; my ($public, $private) = $keychain-keygen ( Type = 'RSA', Size = $attrib-{'Size'}, Identity = $attrib-{'Identity'}, Passphrase = $attrib-{'Password'}, # Verbosity = 1, ) or die $keychain-errstr(); warn Generating complete. Saving..; $public = $public-save; open(PUBLIC,'',$$self{'EV_config'}{'PGPKeyLoc'}/$file.'.public'); print PUBLIC $public; close(PUBLIC); $private = $private-save; open(PRIVATE,'',$$self{'EV_config'}{'PGPKeyLoc'}/$file.'.private'); print PRIVATE $private; close(PRIVATE); warn Saving complete.; return ($self); } []$ perl test_pgp_gen.pl Generating Keys at test_pgp_gen.pl line 29. Creating Keychain at test_pgp_gen.pl line 31. Generating Keys with: Type = 'RSA' Size = 2048 Identity = PGP EzyDVD [EMAIL PROTECTED] Passphrase = a new passphrase for you at test_pgp_gen.pl line 33. B = 43, r = 0.5, k = 22, q = 5347 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 151, r = 0.506631180276321, k = 41, q = 2267129 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 506, r = 0.53037992595081, k = 75, q = 2196811726937 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 1520, r = 0.562081100800386, k = 130, q = 26428241092041745277471 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 3352, r = 0.667875988226359, k = 193, q = 688430562782715717240302427312908015051 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 9564, r = 0.588637765080919, k = 326, q = 965545119950202842999573881663024114299390132769541041 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 29240, r = 0.56933184524636, k = 570, q = 1079008567477111753397094310847156029079713553247572710822855637214539638256680204084416659 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 94371, r = 0.554913243836389, k = 1024, q = 2738877267722396215978314103886896155676111721678953257651796203192310298619466435015458288033302116849702218709734148499773910739678380930731862293431860017467060796038877 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 60, r = 0.5, k = 26, q = 24359 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 190, r = 0.533359128724712, k = 46, q = 48084667 at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 610. B = 392, r = 0.674066449056276, k = 66, q = 43830135663841 at
Re: mod_perl, OpenPGP Math::Pari
Hi there, On Wed, 6 Feb 2002, Jason Galea wrote: now that's funny! ok, so I was babbling.. try this. A simple perl script useing Crypt::OpenPGP runs fine from the command line while the same subroutine used in a mod_perl module on the same machine crashes. Why? There's a file in the mod_perl directory called SUPPORT. (That bit about 'perl -V' was taken from there. :) SUPPORT contains detailed instructions about what to do when mod_perl crashes, including what information to provide and how to generate a stack backtrace. 73, Ged.
Re: mod_perl, OpenPGP Math::Pari
Ged Haywood wrote: There's a file in the mod_perl directory called SUPPORT. (That bit about 'perl -V' was taken from there. :) SUPPORT contains detailed instructions about what to do when mod_perl crashes, including what information to provide and how to generate a stack backtrace. 73, Ged. yeh, read that... I guess I shoudn't have used the word crashes as it's really dies when it tries to do a numeric comparison on an alphanumeric string, which is entirely reasonable, so I'm not getting a core dump, and I don't think mod_perl itself is at fault. I suspect the implementation of GP/Pari as I ended up with the worst case as mentioned in the Math::Pari install and manually copied (as instructed) what I guess is a 'C' library file of some description (paricfg.h - I am by no stretch a C programmer..) to the proper location. It all seemed to work ok after that and as I had had troubles prior I already had my test scripts which all ran fine so I thought Hooray! Then I implemented the real system and got the errors mentioned. What I still don't understand is why the test scripts run ok, but the mod_perl implementation doesn't. (But on my dev server everything works as it should..) I'm going to reinstall GP/Pari on the production server using the src.rpm I found on the Pari site, then if that goes ok I might be able to install/update Math::Pari without errors, then maybe it'll all work.. that's the plan anyway.. cheers, -- J Web Developer Eight Degrees Off Centre http://www.eightdegrees.com.au/
mod_perl, OpenPGP Math::Pari
OK, this has got me stumped.. so it just has to be something obvious.. I am attemting to use Crypt::OpenPGP to encrypt some data. To do this I need to generate some keys.. (ok that's all obvious too..get to the point, J) On my development server everything runs fine producing useable public private keys. I've added a subroutine to my lil web system (running on mod_perl) that takes the required arguements and feeds them to OpenPGP's keygen method. On our production server this dies with the message [error] PARI: *** incorrect type in comparison. at /usr/lib/perl5/site_perl/5.6.1/Crypt/Primes.pm line 683. Now what's really got me stumped, is feeding the same sub with the same arguements in an independant perl script run from the command line on the production (and development) server runs fine and produces usable public private keys. My only guess is that somehow mod_perl on the production server is using a different library of modules than perl run from the command line is using but I can't believe that I wouldn't have had troubles long ago if that were the case. Anyone? any clues on where to start looking? Development Apache/1.3.20 (Unix) mod_perl/1.25 Production Apache/1.3.20 (Unix) mod_perl/1.26 cheers -- J Web Developer Eight Degrees Off Centre http://www.eightdegrees.com.au/
Re: mod_perl, OpenPGP Math::Pari
Hi there, On Tue, 5 Feb 2002, Jason Galea wrote: [snip] My only guess is that somehow mod_perl on the production server is using a different library [snip] Anyone? any clues on where to start looking? perl -V That's lower case perl, upper case V. 73, Ged.