Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect fatpacked perlbrew from existing INC #387

Merged
merged 1 commit into from
Jul 21, 2014

Conversation

dagolden
Copy link
Contributor

@dagolden dagolden commented Jul 9, 2014

I found I had to modify my perlbrew to add this at the top so that I only had the system libraries (you could add vendor, too, I suppose).

BEGIN {
    use Config;
    @INC = @Config{qw(privlibexp archlibexp sitelibexp sitearchexp)};
}

Otherwise switching to/from a non-threaded perl to a threaded perl would break horribly with errors like this:

dyld: lazy symbol binding failed: Symbol not found: _Perl_xs_apiversion_bootcheck
  Referenced from: /Users/david/.perlbrew/libs/18.2t@std/lib/perl5/darwin-thread-multi-2level/auto/List/Util/Util.bundle
  Expected in: dynamic lookup

@karenetheridge
Copy link
Contributor

It's not just threaded/non-threaded that is a problem - I ended up with older PERL5LIB interfering when I ran perlbrew exec --with $libdir cpanm $modulename.

e.g. see the output of 'perl -V' at http://www.cpantesters.org/cpan/report/9b3fbfa8-b568-11e3-928b-d94f618938b0

@karenetheridge
Copy link
Contributor

The exact code I used to create the lib dir is at https://github.com/karenetheridge/misc/blob/master/install/generic/bin/newperl (around line 121).

@dagolden
Copy link
Contributor Author

dagolden commented Jul 9, 2014

ping. Could this please be fixed? It's a major stumbling block for any serious use of perlbrew.

@dagolden
Copy link
Contributor Author

dagolden commented Jul 9, 2014

I haven't tested this commit as I don't know how to set up a perlbrew for devel/build.sh, but I think it might do what we need.

gugod added a commit that referenced this pull request Jul 21, 2014
Protect fatpacked perlbrew from existing INC
@gugod gugod merged commit bf475f5 into gugod:develop Jul 21, 2014
@gugod
Copy link
Owner

gugod commented Jul 21, 2014

Thanks @dagolden ... I push a build in the develop branch: https://github.com/gugod/App-perlbrew/blob/develop/perlbrew

If you could test it in your scenario, please let us know if it works. Thanks

@dagolden
Copy link
Contributor Author

Thank you. If the only change is adding that line, I've been using it with a locally patched perlbrew for months, so it comes pre-tested. :-)

I remembered to pack it up as a pull request after having to get a co-worker set up with perlbrew.

@karenetheridge
Copy link
Contributor

When I use this code, I experience more problems...

e.g. when starting off in a 5.21.1 perlbrew, and executing perlbrew use 21.2@std, I end up with this in perl -V:

Built under darwin
Compiled at Aug 6 2014 10:59:13
%ENV:
PERL5LIB="/Users/ether/.perlbrew/libs/21.2@std/lib/perl5:/Users/ether/.perlbrew/libs/21.1@std/lib/perl5"
PERLBREW_BASHRC_VERSION="0.69"
PERLBREW_HOME="/Users/ether/.perlbrew"
PERLBREW_LIB="std"
PERLBREW_MANPATH="/Users/ether/.perlbrew/libs/21.2@std/man:/Users/ether/perl5/perlbrew/perls/21.2/man"
PERLBREW_PATH="/Users/ether/.perlbrew/libs/21.2@std/bin:/Users/ether/perl5/perlbrew/bin:/Users/ether/perl5/perlbrew/perls/21.2/bin"
PERLBREW_PERL="21.2"
PERLBREW_ROOT="/Users/ether/perl5/perlbrew"
PERLBREW_VERSION="0.69"
PERLDOC_PAGER="less -sicMr"
PERL_AUTOINSTALL_PREFER_CPAN="1"
PERL_INSTALL_QUIET="1"
PERL_LOCAL_LIB_ROOT="/Users/ether/.perlbrew/libs/21.2@std:/Users/ether/.perlbrew/libs/21.1@std:/Users/ether/.perlbrew/libs/21.1@std"
PERL_MB_OPT="--install_base /Users/ether/.perlbrew/libs/21.2@std"
PERL_MM_OPT="INSTALL_BASE=/Users/ether/.perlbrew/libs/21.2@std"
@inc:
/Users/ether/.perlbrew/libs/21.2@std/lib/perl5
/Users/ether/.perlbrew/libs/21.1@std/lib/perl5/darwin-2level
/Users/ether/.perlbrew/libs/21.1@std/lib/perl5
/Users/ether/perl5/perlbrew/perls/21.2/lib/site_perl/5.21.2/darwin-2level
/Users/ether/perl5/perlbrew/perls/21.2/lib/site_perl/5.21.2
/Users/ether/perl5/perlbrew/perls/21.2/lib/5.21.2/darwin-2level
/Users/ether/perl5/perlbrew/perls/21.2/lib/5.21.2
.

PERL5LIB and PATH are being appended to, with the original perlbrew directories remaining.

@karenetheridge
Copy link
Contributor

I see this just got released in version 0.70? IT IS BROKEN.

: [ether@bourbon ~]$; perlbrew use 20.0@std
: [ether@bourbon ~]$; 
: [ether@bourbon ~]$; echo $PERL5LIB
/Users/ether/.perlbrew/libs/20.0@std/lib/perl5:/Users/ether/.perlbrew/libs/20.0@std/lib/perl5
: [ether@bourbon ~]$; 
: [ether@bourbon ~]$; perlbrew use 21.3@std
: [ether@bourbon ~]$; 
: [ether@bourbon ~]$; echo $PERL5LIB
/Users/ether/.perlbrew/libs/21.3@std/lib/perl5:/Users/ether/.perlbrew/libs/20.0@std/lib/perl5:/Users/ether/.perlbrew/libs/20.0@std/lib/perl5

Now local::lib libraries from other versions of perl are being mixed in, which will cause all kinds of errors, including segmentation faults.

@gugod
Copy link
Owner

gugod commented Sep 2, 2014

@karenetheridge I don't see how the original issue (%INC) is connected to having mixed PERL5LIB content... but that is indeed a breakage.

@karenetheridge
Copy link
Contributor

I'm not sure either, but I initially discovered it when I edited the new code in this patch into my local installation (here: #387 (comment)).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants