rschupp / PAR-Packer

(perl) Generate stand-alone executables, perl scripts and PAR files https://metacpan.org/pod/PAR::Packer
Other
48 stars 13 forks source link

unintended glob expansion on strawberry win32? #5

Closed LorenzoTa closed 6 years ago

LorenzoTa commented 6 years ago

Hello, I dunno if this is an inconsitency or a minor bug, but recently I noticed with some surprise, that on my strawberry a packed small program globbed * received as argument: if we read the source in the right manner this should not happen.

while in plain perl perl -we "print join qq(\n), @ARGV" * just * is printed the packed version expands the glob:

pp -e "print join qq(\n), @ARGV" -o printargv.exe

Calling printargv.exe * all plain files and dirs in current dire are returned (no dot files in the list..)

And calling printargv.exe *.pl all .pl file in current directory are returned.

I've asked at perlmonks: see this thread for many other details about my version of perl.

thanks for looking

rschupp commented 6 years ago

Hi, _CRT_glob is the prime suspect. Please try the following: in myldr/boot.c (around line 80) remove the #if and #endif lines from

/* turn off automatic globbing of process arguments when using MingW */
#if defined(WIN32) && defined(__MINGW32__)
int _CRT_glob = 0;
#endif

then rebuild PAR::Packer and rerun your test.

rschupp commented 6 years ago

If that doesn't work, it's not the bootstrap executable, but the custom Perl interpreter that actually runs your packed scripts. Try to add this line to myldr/main.c (e.g. before line 55)

#include "mktmpdir.c"
#include "internals.c"

int _CRT_glob = 0;
int main ( int argc, char **argv, char **env )
{
    int i;

again rebuild PAR::Packer and rerun your test. Actually, this is more likely the cause of the problem as fallout from 4cd9683fab1cd0839 where I removed passing the bootstrap's argv via environment variables to the custom interpreter.

rschupp commented 6 years ago

Fixed in 8c7ee4b52