Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.96k stars 555 forks source link

on Win32 exec LIST does not quote first argument #14536

Open p5pRT opened 9 years ago

p5pRT commented 9 years ago

Migrated from rt.perl.org#123907 (status was 'open')

Searchable as RT123907$

p5pRT commented 9 years ago

From @wchristian

I tested this with AP 5.16\, and SP 5.20.2\, and as such assume the behavior to be present in all Perl versions\, on Win7-64.

I tested it by running oneliners in a cmd shell and capturing the kernel events with procmon. As follows are the oneliners run\, their truncated output and their respective event attributes. Please note the lack of quotes on the exec call​:

--

perl -e "my @​call = ('d​:/s p/perl/bin/perl' \,'-v'); system(@​call)"

This is perl 5\, version 20\, subversion 2 (v5.20.2) built for MSWin32-x86-multi-thread-64int [...]

--

Operation​: Process Create Path​: d​:\s p\perl\bin\perl.exe Command line​: "d​:/s p/perl/bin/perl" -v

Operation​: Process Start Path​:
Command line​: "d​:/s p/perl/bin/perl" -v Current directory​: C​:\Windows\System32\

--

perl -e "my @​call = ('d​:/s p/perl/bin/perl' \,'-v'); exec(@​call)"

Can't open perl script "p/perl/bin/perl"​: No such file or directory

--

Operation​: Process Create Path​: d​:\s p\perl\bin\perl.exe Command line​: d​:/s p/perl/bin/perl -v

Operation​: Process Start Path​:
Command line​: d​:/s p/perl/bin/perl -v Current directory​: C​:\Windows\System32\

p5pRT commented 9 years ago

From @ikegami

On Mon\, Feb 23\, 2015 at 5​:00 AM\, Christian Walde \perlbug\-followup@​perl\.org wrote​:

# New Ticket Created by Christian Walde # Please include the string​: [perl #123907] # in the subject line of all future correspondence about this issue. # \<URL​: https://rt-archive.perl.org/perl5/Ticket/Display.html?id=123907 >

I tested this with AP 5.16\, and SP 5.20.2\, and as such assume the behavior to be present in all Perl versions\, on Win7-64.

I tested it by running oneliners in a cmd shell and capturing the kernel events with procmon. As follows are the oneliners run\, their truncated output and their respective event attributes. Please note the lack of quotes on the exec call​:

I can't replicate. AP 5.16.3 x86\, Win7-64.

perl -e "my @​call = ('c​:/s p/perl/bin/perl' \,'-v'); system(@​call) and die $?"

This is perl 5\, version 16\, subversion 3 (v5.16.3) built for MSWin32-x86-multi-thread (with 1 registered patch\, see perl -V for more detail)

Copyright 1987-2012\, Larry Wall

Binary build 1603 [296746] provided by ActiveState http​://www.ActiveState.com Built Mar 13 2013 11​:29​:21

Perl may be copied only under the terms of either the Artistic License or the GNU General Public License\, which may be found in the Perl 5 source kit.

Complete documentation for Perl\, including FAQ lists\, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet\, point your browser at http​://www.perl.org/\, the Perl Home Page.

p5pRT commented 9 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 9 years ago

From @ikegami

ah. nevermind. system works\, but not exec.

p5pRT commented 9 years ago

From @tonycoz

On Mon Feb 23 02​:00​:00 2015\, Mithaldu wrote​:

I tested this with AP 5.16\, and SP 5.20.2\, and as such assume the behavior to be present in all Perl versions\, on Win7-64.

I tested it by running oneliners in a cmd shell and capturing the kernel events with procmon. As follows are the oneliners run\, their truncated output and their respective event attributes. Please note the lack of quotes on the exec call​:

Unlike system() and now list pipe open\, Perl just calls the C run-time _exec() for the non-threaded case.

So we could fix exec() by re-implementing it for Win32 (not for 5.22) but there might be some back-compat issues.

Tony