Skip Menu |

This queue is for tickets about the App-perlbrew CPAN distribution.

Report information
The Basics
Id: 111978
Status: open
Priority: 0/
Queue: App-perlbrew

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

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



Subject: [PATCH] perlbew exec reports uninitialized variable
Date: Fri, 12 Feb 2016 10:28:56 -0500
To: bug-App-perlbrew [...] rt.cpan.org
From: Timothe Litt <tlhackque [...] cpan.org>
perlbrew is attempting to localize a variable with an undefined value. It's being too clever. # perlbrew exec --with perl-5.22.1 perl -v Use of uninitialized value in list assignment at /home/tlhackque/perl5/perlbrew/bin/perlbrew line 2000. perl-5.22.1 ========== This is perl 5, version 22, subversion 1 (v5.22.1) built for i686-linux ... # perl -v This is perl, v5.8.8 built for i386-linux-thread-multi perlbrew info Current perl: Using system perl. Shebang: #!/usr/bin/perl perlbrew: version: 0.74 ENV: PERLBREW_ROOT: /home/tlhackque/perl5/perlbrew PERLBREW_HOME: /home/tlhackque/.perlbrew PERLBREW_PATH: /home/tlhackque/perl5/perlbrew/bin PERLBREW_MANPATH: At line 2000: 2000: local @ENV{ keys %env } = values %env; DB<3> x \%env 0 HASH(0x8689104) 'PERL5LIB' => '' 'PERLBREW_LIB' => undef <============== ... Patch (ugly, but works). The first replacement line localizes variables with defined values. The second localizes without assignment, which produces the undefined values. I didn't check for other occurances of the local @{keys } = values idiom, but it would be a good idea to do so. |--- perl5/perlbrew/bin/perlbrew~ 2016-02-12 05:13:34.000000000 -0500|| ||+++ perl5/perlbrew/bin/perlbrew 2016-02-12 10:20:56.000000000 -0500|| ||@@ -1995,11 +1995,12 @@|| || for my $i ( @exec_with ) {|| || next if -l $self->root . '/perls/' . $i->{name}; # Skip Aliases|| || my %env = $self->perlbrew_env($i->{name});|| || next if !$env{PERLBREW_PERL};|| || ||- local @ENV{ keys %env } = values %env;|| ||+ local $ENV{$_} = $env{$_} foreach ( grep defined $env{$_}, keys %env );|| ||+ local $ENV{$_} foreach ( grep !defined $env{$_}, keys %env );|| || local $ENV{PATH} = join(':', $env{PERLBREW_PATH}, $ENV{PATH});|| || local $ENV{MANPATH} = join(':', $env{PERLBREW_MANPATH}, $ENV{MANPATH}||"");|| || local $ENV{PERL5LIB} = $env{PERL5LIB} || "";|| || || print "$i->{name}\n==========\n" unless $self->{quiet};|| |
Download 0xDE15D763.asc
application/pgp-keys 3k

Message body not shown because it is not plain text.

Download signature.asc
application/pgp-signature 834b

Message body not shown because it is not plain text.

Don't know where the vertical bars came from. Here's the patch as an attachment.
Subject: perlbrew.patch
--- perl5/perlbrew/bin/perlbrew~ 2016-02-12 05:13:34.000000000 -0500 +++ perl5/perlbrew/bin/perlbrew 2016-02-12 10:20:56.000000000 -0500 @@ -1995,11 +1995,12 @@ for my $i ( @exec_with ) { next if -l $self->root . '/perls/' . $i->{name}; # Skip Aliases my %env = $self->perlbrew_env($i->{name}); next if !$env{PERLBREW_PERL}; - local @ENV{ keys %env } = values %env; + local $ENV{$_} = $env{$_} foreach ( grep defined $env{$_}, keys %env ); + local $ENV{$_} foreach ( grep !defined $env{$_}, keys %env ); local $ENV{PATH} = join(':', $env{PERLBREW_PATH}, $ENV{PATH}); local $ENV{MANPATH} = join(':', $env{PERLBREW_MANPATH}, $ENV{MANPATH}||""); local $ENV{PERL5LIB} = $env{PERL5LIB} || ""; print "$i->{name}\n==========\n" unless $self->{quiet};