Skip Menu |

This queue is for tickets about the Shell-EnvImporter CPAN distribution.

Report information
The Basics
Id: 86171
Status: open
Priority: 0/
Queue: Shell-EnvImporter

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

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



Subject: Tests fail w/ Use of uninitialized value $_[1] in read
PERL_DL_NONLAZY=1 /home/kent/perl5/perlbrew/perls/perl-5.18.0/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Shell-EnvImporter.t .. 1/744 Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
t/Shell-EnvImporter.t .. 89/744 Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
Use of uninitialized value $_[1] in read at /home/kent/perl5/perlbrew/perls/perl-5.18.0/lib/5.18.0/x86_64-linux/IO/Handle.pm line 463.
open3: exec of csh -f -c echo "1371326748_331486_4982029 0";source 't/test_script';echo "1371326748_331486_4982029 $status";env;echo "1371326748_331486_4982029 $status" failed at /home/kent/.cpanm/work/1371326725.327976/Shell-EnvImporter-1.07/blib/lib/Shell/EnvImporter/Shell.pm line 175.
Show quoted text
# Looks like you planned 744 tests but ran 135.
# Looks like your test exited with 2 just after 135.
t/Shell-EnvImporter.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 609/744 subtests

Test Summary Report
-------------------
t/Shell-EnvImporter.t (Wstat: 512 Tests: 135 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 744 tests but ran 135.
Files=1, Tests=135,  1 wallclock secs ( 0.03 usr  0.01 sys +  0.17 cusr  0.09 csys =  0.30 CPU)
Result: FAIL
Failed 1/1 test programs. 0/135 subtests failed.
make: *** [test_dynamic] Error 2
FAIL
I keep hitting this bug, not sure what's going wrong.

The code that is failing is:


        $ready->read($buf{$pipename}, BLKSIZE, length($buf{$pipename}));

And its $buf{$pipename} that is undefined.

Oddly, $pipename is STDOUT.

And the code I'm looking at says that should be defined .... weird. Weird weird weird.

It might just be that read() doesn't vivify the output

  $buf{$pipename} = '' if not exists $buf{$pipename}; # less fail.
Ok, even further digging, proves its not the buffer being undef thats the problem, its that the offset to insert is undef!.

because  length(undef) = undef , not zero,

this means:

  ->read( $buf, $size, undef )  # is being called.

And as you'll see here, that appears to be what is happening:

Subject: vivify.pl
#!/usr/bin/env perl use strict; use warnings; use utf8; open my $fh, '<', '/dev/urandom' or die "NO U RANDOM FOR U"; { my $buf = ''; # No warning if( read $fh, $buf, 1024, 0 ) { print "0"; } } { my $buf = ''; # warning if( read $fh, $buf, 1024, undef ) { print "0"; } } { my $buf = undef; # No warning if( read $fh, $buf, 1024, 0 ) { print "0"; } } { my $buf = undef; # warning if( read $fh, $buf, 1024, undef ) { print "0"; } }
Ok, I give up. It looks like it really should be vivifying, but for some reason that I cant reproduce, it is warning instead.

https://gist.github.com/kentfredric/6053134

Ignore that remark about trailing undef, those are only tests vs the read() builtin, and don't apply to IO::Handle::read() because it solves the length problem in there.

From: Martin.vGagern [...] gmx.net
On Mo 22. Jul 2013, 07:25:11, KENTNL wrote: Show quoted text
> Ok, I give up. It looks like it really should be > vivifying, but for some reason > that I cant reproduce, it is warning instead. > > https://gist.github.com/kentfredric/6053134
The problem is that "use warnings" is scoped so it only applies to the main module, not the things you use. Run your example through "perl -w" and you can reproduce the problem. In https://bugs.gentoo.org/show_bug.cgi?id=526188#c1 I've posted a patch to address these warnings.