I am experiencing the same issue (Segmentation fault: 11 (core dumped))
with perl 5.12.0 on freebsd8.2 though I am calling read_file in scalar
context.
If I change the "-s _" to "-s $file_name" on lines 116 and 117 it then
works.
I do not seem to have the problem on other perls on that machine
(5.10.1, 5.15.8, 5.17.2).
I attached perl -V and also the output of Devel::Trace where I
consistently have this problem.
Summary of my perl5 (revision 5 version 12 subversion 0) configuration:
Platform:
osname=freebsd, osvers=8.2-release, archname=i386-freebsd
uname='freebsd freebsd82.raptor.local 8.2-release freebsd 8.2-release #0: fri feb 18 02:24:46 utc 2011 root@almeida.cse.buffalo.edu:usrobjusrsrcsysgeneric i386 '
config_args='-de -Dprefix=/home/rando/perl5/perlbrew/perls/perl-5.12.0'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include',
optimize='-O',
cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.2.1 20070719 [FreeBSD]', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-Wl,-E -fstack-protector -L/usr/local/lib'
libpth=/usr/lib /usr/local/lib
libs=-lm -lcrypt -lutil -lc
perllibs=-lm -lcrypt -lutil -lc
libc=, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_LARGE_FILES USE_PERLIO USE_PERL_ATOF
Built under freebsd
Compiled at Dec 6 2012 09:16:24
%ENV:
PERLBREW_BASHRC_VERSION="0.39"
PERLBREW_HOME="/home/rando/.perlbrew"
PERLBREW_MANPATH="/home/rando/perl5/perlbrew/perls/perl-5.12.0/man"
PERLBREW_PATH="/home/rando/perl5/perlbrew/bin:/home/rando/perl5/perlbrew/perls/perl-5.12.0/bin"
PERLBREW_PERL="perl-5.12.0"
PERLBREW_ROOT="/home/rando/perl5/perlbrew"
PERLBREW_VERSION="0.39"
@INC:
/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/i386-freebsd
/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0
/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/5.12.0/i386-freebsd
/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/5.12.0
.
>> -e:1: Parse::CPAN::Packages->new(filename => "t/02packages.details.txt")->_slurp_details
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:10: my $class = shift;
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:11: $class = Scalar::Util::blessed($class) || $class;
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:12: return $class->Moose::Object::new(@_)
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:14: my $params =
>> lib/Parse/CPAN/Packages.pm:23: my ( $class, @args ) = @_;
>> lib/Parse/CPAN/Packages.pm:24: return {@args} if @args > 1;
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:17: my $instance = bless {} => $class;
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:19: if (exists $params->{'data'}) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:26: my $default = $defaults->[0]->($instance);
>> lib/Parse/CPAN/Packages.pm:16: has 'data' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:27: if (! (( do { ref($default) eq "HASH" } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:27: if (! (( do { ref($default) eq "HASH" } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:30: $instance->{"data"} = $default;
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:33: if (exists $params->{'details'}) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:40: my $default = $defaults->[1]->($instance);
>> lib/Parse/CPAN/Packages.pm:15: has 'details' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:41: if (! (( do { ref($default) eq "HASH" } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:41: if (! (( do { ref($default) eq "HASH" } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:44: $instance->{"details"} = $default;
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:47: if (exists $params->{'dists'}) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:54: my $default = $defaults->[2]->($instance);
>> lib/Parse/CPAN/Packages.pm:17: has 'dists' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:55: if (! (( do { ref($default) eq "HASH" } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:55: if (! (( do { ref($default) eq "HASH" } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:58: $instance->{"dists"} = $default;
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:61: if (exists $params->{'filename'}) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:62: if (! (( do { ( do { ( do { defined($params->{'filename'}) } ) && !ref($params->{'filename'}) } ) && (ref(\$params->{'filename'}) eq "SCALAR" || ref(\(my $val = $params->{'filename'})) eq "SCALAR") } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:62: if (! (( do { ( do { ( do { defined($params->{'filename'}) } ) && !ref($params->{'filename'}) } ) && (ref(\$params->{'filename'}) eq "SCALAR" || ref(\(my $val = $params->{'filename'})) eq "SCALAR") } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:62: if (! (( do { ( do { ( do { defined($params->{'filename'}) } ) && !ref($params->{'filename'}) } ) && (ref(\$params->{'filename'}) eq "SCALAR" || ref(\(my $val = $params->{'filename'})) eq "SCALAR") } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:62: if (! (( do { ( do { ( do { defined($params->{'filename'}) } ) && !ref($params->{'filename'}) } ) && (ref(\$params->{'filename'}) eq "SCALAR" || ref(\(my $val = $params->{'filename'})) eq "SCALAR") } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:65: $instance->{"filename"} = $params->{'filename'};
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:68: if (exists $params->{'latestdists'}) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:75: my $default = $defaults->[4]->($instance);
>> lib/Parse/CPAN/Packages.pm:18: has 'latestdists' => ( is => 'rw', isa => 'HashRef', default => sub { {} } );
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:76: if (! (( do { ref($default) eq "HASH" } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:76: if (! (( do { ref($default) eq "HASH" } ))) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:79: $instance->{"latestdists"} = $default;
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:82: if (exists $params->{'mirror_dir'}) {
>> (eval 253)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:88: $instance->Parse::CPAN::Packages::BUILD($params);
>> lib/Parse/CPAN/Packages.pm:29: my $self = shift;
>> lib/Parse/CPAN/Packages.pm:30: my $filename = $self->filename;
>> (eval 245)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:6: if (@_ > 1) {
>> (eval 245)[/home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/Eval/Closure.pm:125]:12: return $_[0]->{"filename"};
>> lib/Parse/CPAN/Packages.pm:33: $self->parse( $filename ) if $filename;
>> lib/Parse/CPAN/Packages.pm:71: my ( $self, $filename ) = @_;
>> lib/Parse/CPAN/Packages.pm:74: my @details = split "\n", $self->_slurp_details( $filename );
>> lib/Parse/CPAN/Packages.pm:48: my ( $self, $filename ) = @_;
>> lib/Parse/CPAN/Packages.pm:49: $filename ||= '02packages.details.txt.gz';
>> lib/Parse/CPAN/Packages.pm:51: return $filename if $filename =~ /Description:/;
>> lib/Parse/CPAN/Packages.pm:52: return Compress::Zlib::memGunzip( $filename ) if $filename =~ /^\037\213/;
>> lib/Parse/CPAN/Packages.pm:54: my @read_params = ( $filename );
>> lib/Parse/CPAN/Packages.pm:55: push @read_params, ( binmode => ':raw' ) if $filename =~ /\.gz/;
>> lib/Parse/CPAN/Packages.pm:57: print STDERR READ_PARAMS => @read_params, "\n";
READ_PARAMSt/02packages.details.txt
>> lib/Parse/CPAN/Packages.pm:58: my $data = read_file( @read_params );
>> /home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/File/Slurp.pm:109: my $file_name = shift ;
>> /home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/File/Slurp.pm:110: my $opts = ( ref $_[0] eq 'HASH' ) ? shift : { @_ } ;
>> /home/rando/perl5/perlbrew/perls/perl-5.12.0/lib/site_perl/5.12.0/File/Slurp.pm:116: if ( !ref $file_name && -e $file_name && -s _ > 0 &&
Segmentation fault: 11 (core dumped)