Bug 122378

Summary: Perl SEGV's while running "make test" for perl module Crypt::Random
Product: Red Hat Enterprise Linux 3 Reporter: Sam Kimery <sam.kimery>
Component: perlAssignee: Jason Vas Dias <jvdias>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2006-0294 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-10 21:56:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 187539    

Description Sam Kimery 2004-05-03 20:49:40 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1)
Gecko/20031030

Description of problem:

Running "make test" for the Crypt::Random perl module fails. Digging
deeper reveals that while running the test 't/pari_misfeature', perl
seg faults.

Version-Release number of selected component (if applicable):
perl-5.8.0-88.4

How reproducible:
Always

Steps to Reproduce:
1. perl -MCPAN -e shell
2. install Crypt::Random

    

Actual Results:  Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/generator..........ok
t/makerandom_itv.....ok
t/octet_string.......ok
t/pari_misfeature....dubious
        Test returned status 0 (wstat 11, 0xb)
DIED. FAILED test 1
        Failed 1/1 tests, 0.00% okay
t/random.............ok
Failed Test         Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t/pari_misfeature.t    0    11     1    1 100.00%  1
Failed 1/5 test scripts, 80.00% okay. 1/26 subtests failed, 96.15% okay.
make: *** [test_dynamic] Error 29
  /usr/bin/make test -- NOT OK


Expected Results:  Tests should have all passed.

Additional info:

# strace perl -Mblib t/pari_misfeature.t 1..1

[lots of stuff trimmed for sanity - Sam]

_llseek(4, 0, [0], SEEK_CUR)            = 0
read(4, "package Crypt::Random::Provider:"..., 4096) = 1090
read(4, "", 4096)                       = 0
close(4)                                = 0
read(3, "", 4096)                       = 0
close(3)                                = 0
stat64("/dev/urandom", {st_mode=S_IFCHR|0644, st_rdev=makedev(1, 9),
...}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

Comment 1 Bryn Dyment 2004-05-31 00:47:39 UTC
Also dies on FreeBSD 4.8 with Perl 5.8.3 during 'make install':

Running make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-
e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/generator..........^C  /usr/bin/make test -- NOT OK

Comment 2 Jason Vas Dias 2005-11-10 03:48:40 UTC
Sorry for the delay in processing this bug. 

With the latest perl-5.8.0-90.2, the Crypt::Random tests no longer cause perl
to dump core. 

But all the tests which use the 'Crypt::Random::Provider::devurandom' module
fail - this is because the Class::Loader module fails to load any module in a 
subdirectory of a module directory when UTF-8 is enabled.

Yes, that's right : UTF-8 !!

WORKAROUND: run your cpan installs with :
# LC_ALL=C perl -MCPAN -e shell 

This problem is demonstrated by this simple test module,
which consists of modules pm::p, and pm::p::pm :

--- file pm/p.pm :
#!/usr/bin/perl
package pm::p;
use Class::Loader;
$VERSION     = 0.1;
sub new
{
    bless {};
}
sub f
{
    my $loader = new Class::Loader;
    my $po = $loader->_load ( Module => "pm::p::pm" ) || 
                      die("Unable to load pm:p:pm $!: $?");
    print $po->f, "\n";
}
1;
--- file pm/p/pm.pm :
#!/usr/bin/perl
package pm::p::pm;
sub new
{
    bless {};
}
sub f
{
    return "OK";
}
1;
---

Here's what happens with perl-5.8.0x and Class-Loader-2.0.3 :

$ perl -I. -e 'use pm::p; pm::p::f();'
Unable to load pm::p::pm : 0  at pm/p.pm line 11

$ LC_ALL=C perl -I. -e 'use pm::p; pm::p::f();'
OK

Interestingly, this problem is circumenvented by using Class::Loader to load 
pm::p:
 
$ perl -I. -e 'use Class::Loader; $l = new Class::Loader; 
               $pm = $l->_load(Module=>"pm::p") || 
die ("Unable to load pm::p: $? $! $@"); $pm->f(),"\n";'
OK

I am investigating this - short of backporting 5.8.7's UTF implementation
(which effectively means upgrading perl in RHEL-3 to 5.8.7) I'm not sure
how to fix yet - this could take some time.

Comment 5 Jason Vas Dias 2006-03-24 01:42:01 UTC
This bug is now finally fixed with perl-5.8.0-92.0 .


The problem goes beyond the original bug report :
---
$ cat t.pm
#!/usr/bin/perl
package t;
sub f
{
    my %a = @_;

    for (keys %a){ ${lc($_)} = $a{$_}; print lc($_),' = ',$a{$_},"\n"};

    print "v: $v\n";
}
return 1;
$
$ perl -Mutf8 -I. -e 'use t; t::f(v=>1);'
v = 1
v:
$ perl -I. -e 'use t; t::f(v=>1);'
v = 1
v: 1
---

The problem does not occur if you do not use lc($_), but just $_.

This is because utf8's swash_init() function incorrectly 
changed the active namespace without restoring it,
so that in the example above, "$::v" was set to 1, not "$t::v" .

This problem is now fixed with perl-5.8.0-92.0, shortly available from:
   http://people.redhat.com/~jvdias/perl/RHEL-3

Comment 6 Jason Vas Dias 2006-03-24 17:25:42 UTC
perl-5.8.0-92.0, is now available from:
   http://people.redhat.com/~jvdias/perl/RHEL-3

With this version, the install of Crypt::Random and all module dependencies
(Class::Loader, Math::Pari) complete successfully.


Comment 14 Red Hat Bugzilla 2006-05-10 21:56:29 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2006-0294.html