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

carton exec fails if kicking another perl not installed local::lib(lib::core::only) #70

Closed
Songmu opened this issue Mar 18, 2013 · 5 comments
Labels

Comments

@Songmu
Copy link

Songmu commented Mar 18, 2013

eg.

% carton exec -- /usr/bin/perl
Can't locate lib/core/only.pm in @INC (...

Because, in Carton::CLI#cmd_exec subroutine, PERL5OPT is set as bellow.

local $ENV{PERL5OPT} = "-Mlib::core::only -Mlib=$lib"; 

Then a Perl not installed local::lib is used in carton exec, and it fails with
error message in front.

I feel difficulty in specific, when my program kicks system command witten
by perl and using system perl.

For example, Test::mysqld kicks mysql_install_db command installed by MySQL
and it's wittern by perl and use /usr/bin/perl in shebang.

I think it is hard to solve (and might not need to be solved), and tentatively
report this issue.

@miyagawa
Copy link
Contributor

This is a known issue but thank you for reporting. I will need to not use PERL5OPT to address this.

On Sun, Mar 17, 2013 at 6:25 PM, Songmu notifications@github.com wrote:

eg.
% carton exec -- /usr/bin/perl
Can't locate lib/core/only.pm in @inc (...
Because, in Carton::CLI#cmd_exec subroutine, PERL5OPT is set as bellow.
local $ENV{PERL5OPT} = "-Mlib::core::only -Mlib=$lib";
Then a Perl not installed local::lib is used in carton exec, and it fails with
error message in front.
I feel difficulty in specific, when my program kicks system command witten
by perl and using system perl.
For example, Test::mysqld kicks mysql_install_db command installed by MySQL
and it's wittern by perl and use /usr/bin/perl in shebang.
I think it is hard to solve (and might not need to be solved), and tentatively

report this issue.

Reply to this email directly or view it on GitHub:
#70

@lestrrat
Copy link

I wrote a simple change to use PERL5LIB instead of PERL5OPT, but I guess it still doesn't allow you to use a different Perl binary than the one carton is running with :/

https://github.com/lestrrat/carton/commit/826e88214df35bbf62adae10537e372f5f2ad2cd

@miyagawa
Copy link
Contributor

I thought changing to PERL5LIB doesn't work correctly since there is a
chance to accidentally load modules from site_perl. If you don't care about
that that would work as well.

@miyagawa
Copy link
Contributor

miyagawa commented Jun 1, 2013

I guess it still doesn't allow you to use a different Perl binary than the one carton is running with :/

I think the fundamental issue here is that, given a code system "./foo.pl" inside a process executed by carton, there's no way to tell if the intention is to run it with Carton managed libraries (most of the case I believe), or with a system perl, such as Test::mysqld.

I think the latter is the exceptional use case, and we should be able to provide a way to localize these PERL5* environment variable so that it won't be affected. At least the shebang is with #!/usr/bin/perl anyway, so I don't think we need to undo $PATH.

miyagawa added a commit that referenced this issue Jun 2, 2013
…PERL5LIB. Re: #82 #70 #60

PERL5LIB isn't perfect since it doesn't eliminate site_perl from @inc
in the child process, which means carton exec could accidentally load
modules from site_perl even when they are not available in the
carton.lock.

We'll address this by either implementing a check-like logic in the
exec (which would add an overhead), or add some additional @inc hooks
in the development, which can detect such errors, a la App::FatPacker
@miyagawa
Copy link
Contributor

miyagawa commented Jun 2, 2013

should be addressed via de2b4d2

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

No branches or pull requests

3 participants