Skip Menu |
 

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

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

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

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



Subject: perlbrew-specific bashrc breaks Linux system upgrade
Download (untitled) / with headers
text/plain 3.2k
Today I upgraded a machine from Ubuntu 13.10 LTS to 14.04 LTS. There were no problems with the upgrade itself whatsoever. However, when I opened the Terminal application to resume Perl 5 development, I immediately encountered problems. 1. I got this error message *immediately* upon opening Terminal: ##### Can't locate App/perlbrew.pm in @INC (you may need to install the App::perlbrew module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/bin/perlbrew line 6. BEGIN failed--compilation aborted at /usr/local/bin/perlbrew line 6. Can't locate App/perlbrew.pm in @INC (you may need to install the App::perlbrew module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/bin/perlbrew line 6. BEGIN failed--compilation aborted at /usr/local/bin/perlbrew line 6. ##### 2. I found that most of the Unix command-line programs could no longer be located. Examples: ##### [~] 4 $ vi .bashrc Command 'vi' is available in '/usr/bin/vi' The command could not be located because '/usr/bin' is not included in the PATH environment variable. vi: command not found [~] 5 $ ls -l . Command 'ls' is available in '/bin/ls' The command could not be located because '/bin' is not included in the PATH environment variable. ls: command not found ##### Repeated inspection of ~/.bashrc showed me that when I had installed perlbrew on this machine back in March, I had had to add the following line: ##### source ~/perl5/perlbrew/etc/bashrc ##### I then inspected this perlbrew-specific bashrc. I believe that the fundamental, system-wide values for the PATH environmental variable -- established (at least in Ubuntu) in /etc/environment -- were *probably* being overwritten by code like this: ##### PATH_WITHOUT_PERLBREW=$(eval $perlbrew_command display-pristine-path) if [ -n "$PERLBREW_PATH" ]; then export PATH=${PERLBREW_PATH}:${PATH_WITHOUT_PERLBREW} else export PATH=${PERLBREW_ROOT}/bin:${PATH_WITHOUT_PERLBREW} fi unset PATH_WITHOUT_PERLBREW ##### Once I commented out that 'source' line in my ~/.bashrc file, I regained access to the PATH values from /etc/environment (as well as those I had manually entered in ~/.bashrc via, e.g., "PATH=$HOME/bin/perl:$HOME/bin/shell:$PATH"). So I now have no problem using vi, ls, etc. But the consequence is that I can no longer use 'perlbrew', since it is that perlbrew-specific bashrc file that establishes 'perlbrew' as a *shell* command. Example: ##### $ perlbrew list Can't locate App/perlbrew.pm in @INC (you may need to install the App::perlbrew module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/bin/perlbrew line 6. BEGIN failed--compilation aborted at /usr/local/bin/perlbrew line 6. ##### I certainly have 'perlbrew' installed; it just can't be located and for some reason throws up that error. This is a serious design flaw in perlbrew. Thank you very much. Jim Keenan
Download (untitled) / with headers
text/plain 1.1k
On Tue May 20 19:43:07 2014, JKEENAN wrote: [snip] Show quoted text
> > I then inspected this perlbrew-specific bashrc. I believe that the > fundamental, system-wide values for the PATH environmental variable -- > established (at least in Ubuntu) in /etc/environment -- were > *probably* being overwritten by code like this: > > ##### > PATH_WITHOUT_PERLBREW=$(eval $perlbrew_command display-pristine-path) > if [ -n "$PERLBREW_PATH" ]; then > export PATH=${PERLBREW_PATH}:${PATH_WITHOUT_PERLBREW} > else > export PATH=${PERLBREW_ROOT}/bin:${PATH_WITHOUT_PERLBREW} > fi > unset PATH_WITHOUT_PERLBREW > ##### >
Indeed, when I inserted the following line immediately below the assignment to PATH_WITHOUT_PERLBREW, it became clear that PATH_WITHOUT_PERLBREW was being assigned an empty string: ##### echo "xxx: $PATH_WITHOUT_PERLBREW" ##### This is consistent with the disappearance of the system-wide values in the PATH string originating in /etc/environment. 'man perlbrew' continues to work, but 'perlbrew' as a shell command no longer does. Thank you very much. Jim Keenan PATH_WITHOUT_PERLBREW=$(eval $perlbrew_command display-pristine-path)
Download (untitled) / with headers
text/plain 1.6k
On Tue May 20 20:01:02 2014, JKEENAN wrote: Show quoted text
> On Tue May 20 19:43:07 2014, JKEENAN wrote: > > [snip]
> > > > I then inspected this perlbrew-specific bashrc. I believe that the > > fundamental, system-wide values for the PATH environmental variable > > -- > > established (at least in Ubuntu) in /etc/environment -- were > > *probably* being overwritten by code like this: > > > > ##### > > PATH_WITHOUT_PERLBREW=$(eval $perlbrew_command display-pristine-path) > > if [ -n "$PERLBREW_PATH" ]; then > > export PATH=${PERLBREW_PATH}:${PATH_WITHOUT_PERLBREW} > > else > > export PATH=${PERLBREW_ROOT}/bin:${PATH_WITHOUT_PERLBREW} > > fi > > unset PATH_WITHOUT_PERLBREW > > ##### > >
> > Indeed, when I inserted the following line immediately below the > assignment to PATH_WITHOUT_PERLBREW, it became clear that > PATH_WITHOUT_PERLBREW was being assigned an empty string: > > ##### > echo "xxx: $PATH_WITHOUT_PERLBREW" > ##### > > This is consistent with the disappearance of the system-wide values in > the PATH string originating in /etc/environment. > > 'man perlbrew' continues to work, but 'perlbrew' as a shell command no > longer does. >
Further data: When I *once again* called: ##### cpanm App::perlbrew ##### ... without un-commenting the '#source ~/perl5/perlbrew/etc/bashrc' line in my ~/.bashrc, then it appeared that the 'perlbrew' command once again became available: ##### $ perlbrew list perl-5.6.2 perl-5.16.3 perl-5.18.2 ##### However, it will take further investigation to see how this can be happening *without* source-ing the perlbrew-specific bashrc file into ~/.bashrc. Thank you very much. Jim Keenan
Download (untitled) / with headers
text/plain 2.2k
On Tue May 20 20:11:59 2014, JKEENAN wrote: Show quoted text
> On Tue May 20 20:01:02 2014, JKEENAN wrote:
> > On Tue May 20 19:43:07 2014, JKEENAN wrote: > > > > [snip]
> > > > > > I then inspected this perlbrew-specific bashrc. I believe that the > > > fundamental, system-wide values for the PATH environmental variable > > > -- > > > established (at least in Ubuntu) in /etc/environment -- were > > > *probably* being overwritten by code like this: > > > > > > ##### > > > PATH_WITHOUT_PERLBREW=$(eval $perlbrew_command display-pristine- > > > path) > > > if [ -n "$PERLBREW_PATH" ]; then > > > export PATH=${PERLBREW_PATH}:${PATH_WITHOUT_PERLBREW} > > > else > > > export PATH=${PERLBREW_ROOT}/bin:${PATH_WITHOUT_PERLBREW} > > > fi > > > unset PATH_WITHOUT_PERLBREW > > > ##### > > >
> > > > Indeed, when I inserted the following line immediately below the > > assignment to PATH_WITHOUT_PERLBREW, it became clear that > > PATH_WITHOUT_PERLBREW was being assigned an empty string: > > > > ##### > > echo "xxx: $PATH_WITHOUT_PERLBREW" > > ##### > > > > This is consistent with the disappearance of the system-wide values > > in > > the PATH string originating in /etc/environment. > > > > 'man perlbrew' continues to work, but 'perlbrew' as a shell command > > no > > longer does. > >
> > Further data: > > When I *once again* called: > > ##### > cpanm App::perlbrew > ##### > > ... without un-commenting the '#source ~/perl5/perlbrew/etc/bashrc' > line in my ~/.bashrc, then it appeared that the 'perlbrew' command > once again became available: > > ##### > $ perlbrew list > perl-5.6.2 > perl-5.16.3 > perl-5.18.2 > ##### > > However, it will take further investigation to see how this can be > happening *without* source-ing the perlbrew-specific bashrc file into > ~/.bashrc. >
Things are not quite right. On the basis of previous use, I would expect 'perlbrew switch' or 'perlbrew use' to change the active perl *in the current shell*. Instead, these commands are *opening sub-shells*: ##### $ perlbrew switch perl-5.16.3 A sub-shell is launched with perl-5.16.3 as the activated perl. Run 'exit' to finish it. bash-4.3$ exit exit $ perlbrew use perl-5.16.3 A sub-shell is launched with perl-5.16.3 as the activated perl. Run 'exit' to finish it. bash-4.3$ exit exit Show quoted text
> Thank you very much. > Jim Keenan

>
> #####
> $ perlbrew switch perl-5.16.3
>
> A sub-shell is launched with perl-5.16.3 as the activated perl. Run
> 'exit' to finish it.
>
> bash-4.3$ exit
> exit
>
> $ perlbrew use perl-5.16.3
>
> A sub-shell is launched with perl-5.16.3 as the activated perl. Run
> 'exit' to finish it.
>
> bash-4.3$ exit
> exit
>
> > Thank you very much.
> > Jim Keenan

The causes of those 2 problems usually indicates that for whatever reason, the perlbrew helper is not in your current bash session.

ie: after you "fix" whatever was previously wrong with perlbrew, you will need to possibly subsequently spawn a new shell that consumes the relevant bashrc to ensure the bash hook that makes this behaviour work is in place.
 

Download (untitled) / with headers
text/plain 3.2k
On Tue May 20 20:15:20 2014, JKEENAN wrote: Show quoted text
> On Tue May 20 20:11:59 2014, JKEENAN wrote:
> > On Tue May 20 20:01:02 2014, JKEENAN wrote:
> > > On Tue May 20 19:43:07 2014, JKEENAN wrote: > > > > > > [snip]
> > > > > > > > I then inspected this perlbrew-specific bashrc. I believe that > > > > the > > > > fundamental, system-wide values for the PATH environmental > > > > variable > > > > -- > > > > established (at least in Ubuntu) in /etc/environment -- were > > > > *probably* being overwritten by code like this: > > > > > > > > ##### > > > > PATH_WITHOUT_PERLBREW=$(eval $perlbrew_command display-pristine- > > > > path) > > > > if [ -n "$PERLBREW_PATH" ]; then > > > > export PATH=${PERLBREW_PATH}:${PATH_WITHOUT_PERLBREW} > > > > else > > > > export PATH=${PERLBREW_ROOT}/bin:${PATH_WITHOUT_PERLBREW} > > > > fi > > > > unset PATH_WITHOUT_PERLBREW > > > > ##### > > > >
> > > > > > Indeed, when I inserted the following line immediately below the > > > assignment to PATH_WITHOUT_PERLBREW, it became clear that > > > PATH_WITHOUT_PERLBREW was being assigned an empty string: > > > > > > ##### > > > echo "xxx: $PATH_WITHOUT_PERLBREW" > > > ##### > > > > > > This is consistent with the disappearance of the system-wide values > > > in > > > the PATH string originating in /etc/environment. > > > > > > 'man perlbrew' continues to work, but 'perlbrew' as a shell command > > > no > > > longer does. > > >
> > > > Further data: > > > > When I *once again* called: > > > > ##### > > cpanm App::perlbrew > > ##### > > > > ... without un-commenting the '#source ~/perl5/perlbrew/etc/bashrc' > > line in my ~/.bashrc, then it appeared that the 'perlbrew' command > > once again became available: > > > > ##### > > $ perlbrew list > > perl-5.6.2 > > perl-5.16.3 > > perl-5.18.2 > > ##### > > > > However, it will take further investigation to see how this can be > > happening *without* source-ing the perlbrew-specific bashrc file into > > ~/.bashrc. > >
> > Things are not quite right. On the basis of previous use, I would > expect 'perlbrew switch' or 'perlbrew use' to change the active perl > *in the current shell*. Instead, these commands are *opening sub- > shells*: > > ##### > $ perlbrew switch perl-5.16.3 > > A sub-shell is launched with perl-5.16.3 as the activated perl. Run > 'exit' to finish it. > > bash-4.3$ exit > exit > > $ perlbrew use perl-5.16.3 > > A sub-shell is launched with perl-5.16.3 as the activated perl. Run > 'exit' to finish it. > > bash-4.3$ exit > exit >
In addition to help from KENTNL above, I also received help from David Golden on the cpan-workers mailing list. It appears that when I was trying to fix the problem yesterday, I was saying "cpanm App::perlbrew", which was failing to place the "fatpacked" version of 'perlbrew' into ~/perl5/perlbrew/bin. (The only thing I had in that directory was 'patchperl'.) Once I did the following: 1. curl -kL http://install.perlbrew.pl | bash 2. Uncomment 'source ~/perl5/perlbrew/etc/bashrc' in ~/.bashrc 3. 'source ~/.bashrc' Then 'perlbrew' returned to its expected behavior, i.e., 'perlbrew use perl-5.16.3' caused 5.16.3 to be activated in the same shell; no sub-shell was opened. The documentation for App::perlbrew should be modified so that people know how to work around this problem in the future. Thank you very much. Jim Keenan


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.