Skip Menu |

This queue is for tickets about the PAR CPAN distribution.

Report information
The Basics
Id: 48614
Status: resolved
Priority: 0/
Queue: PAR

People
Owner: RSCHUPP [...] cpan.org
Requestors: ynnor [...] mm.st
Cc:
AdminCc:

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



Subject: PAR must NOT evaluate PERL5OPT
If I execute an exe file created by PAR, in an environment which happens the variable PERL5OPT set to a string containing -Mxxx for any module xxx, the program aborts with "Can not find xxx in @INC", even if xxx is a standard module (such as strict, warnings, or File::Basename). The reason can be explained in that by creating the EXE file, @INC is set to the empty list, and when PERL5OPT is evaluated, the module can't be resolved. IMO, it doesn't make sense to honor PERL5OPT in a compiled program, because most Perl command line switches are meaningless in this context anyway. We create EXE files out of Perl files, not only to hide the sources, but also to make them insensitive to the environment they are running in, and oblivious to whether or not a Perl version is installed on the target host, and which version it is. If execution of the exe file can easily be broken by just setting PERL5OPT, we are loosing the flexibility which we hoped to gain from PAR. A fix would be to have the EXE file ignore PERL5OPT. It seems that perl2exe is doing it in that way, because if I compile my Perl program with perl2exe, the error does not occur.
I concur, pp'ed executables should ignore PERL5OPT. The patch below implements that. Note: I only tested that on Linux. Also, it may now ignore PERL5OPT where it shouldn't. Cheers, Roderich diff -ubr PAR-Packer-0.991/myldr/utils.c PAR-Packer-0.991-ignore-PERL5OPT/myldr/utils.c --- PAR-Packer-0.991/myldr/utils.c 2009-03-21 11:45:48.000000000 +0100 +++ PAR-Packer-0.991-ignore-PERL5OPT/myldr/utils.c 2009-08-11 12:31:08.000000000 +0200 @@ -220,6 +220,7 @@ char par_clean[] = "__ENV_PAR_CLEAN__ \0"; char *buf; + par_unsetenv("PERL5OPT"); par_unsetenv("PAR_INITIALIZED"); par_unsetenv("PAR_SPAWNED"); par_unsetenv("PAR_TEMP");
Subject: Re: [rt.cpan.org #48614] PAR must NOT evaluate PERL5OPT
Date: Tue, 11 Aug 2009 13:29:10 +0200
To: bug-PAR [...] rt.cpan.org
From: Steffen Mueller <smueller [...] cpan.org>
Hi, RSCHUPP via RT wrote: Show quoted text
> Queue: PAR > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=48614 > > > I concur, pp'ed executables should ignore PERL5OPT. > The patch below implements that. > Note: I only tested that on Linux. Also, it may now ignore > PERL5OPT where it shouldn't.
I agree as well. It also seems unlikely that the change is unportable or otherwise problematic. Roderich, could you apply it to trunk? Cheers, Steffen
Committed to SVN. We now clear PERL5OPT, PERL5LIB, PERLLIB, and PERLIO for packed executables.