On Wed Jul 16 16:26:20 2014, ETHER wrote:
Show quoted text
Revisiting due to request from mohawk.
https://github.com/Leont/devel-findperl/commit/d5d4cb17a339a7a48ec6d8be7edd6a5ae1c6eeda
commit is evil. It wipes %PATH% on win32. Without C:/WINDOWS/System32 in %PATH%, if perl's core's system() function retries running the command with "cmd.exe" (
http://perl5.git.perl.org/perl.git/blob/ff36bb50a704e1926451063369ace915b3074f06:/win32/win32.c#l588 ) for shell processing, it needs to have System32 (note it may not be in "C:" on all system) in %PATH% to work.
See picture of 11-tainted.t running on Strawberry 5.18. It doesn't search any other dirs other than ., since PATH is empty.
Here are 2 Dumpers of the args passed to system() and %ENV, made in IPC::Open3::spawn_with_handles right before system() executes, when perl_is_same() runs from 11-tainted.t.
t/11-tainted.t .. $VAR1 = [
'C:\\sperl\\perl\\bin\\perl.exe',
'-MConfig=myconfig',
'-e',
'print',
'-e',
'myconfig'
];
$VAR2 = {
'PROGRAMFILES' => 'C:\\Program Files',
'USERDOMAIN' => 'OWNER-5D26B85EE',
'SESSIONNAME' => 'Console',
'PROCESSOR_IDENTIFIER' => 'x86 Family 6 Model 15 Stepping 13, GenuineI
ntel',
'USERNAME' => 'Owner',
'COMMONPROGRAMFILES' => 'C:\\Program Files\\Common Files',
'PROCESSOR_REVISION' => '0f0d',
'PATHEXT' => '.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH',
'VSINSTALLDIR' => 'C:\\Program Files\\Microsoft Visual Studio .NET 200
3\\Common7\\IDE',
'FRAMEWORKVERSION' => 'v1.1.4322',
'IFS' => '',
'WINDIR' => 'C:\\WINDOWS',
'PATH' => '',
'PROMPT' => '$P$G',
'SVN_SSH' => 'C:\\Program Files\\PuTTY\\plink.exe',
'NUMBER_OF_PROCESSORS' => '2',
'GIT_SSH' => 'C:\\Program Files\\PuTTY\\plink.exe',
'CLIENTNAME' => 'Console',
'INCLUDE' => 'C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC
7\\ATLMFC\\INCLUDE;C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\IN
CLUDE;C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\PlatformSDK\\in
clude\\prerelease;C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\Pla
tformSDK\\include;C:\\Program Files\\Microsoft Visual Studio .NET 2003\\SDK\\v1.
1\\include;',
'COMSPEC' => 'C:\\WINDOWS\\system32\\cmd.exe',
'SYSTEMROOT' => 'C:\\WINDOWS',
'HOMEDRIVE' => 'C:',
'LIB' => 'C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\A
TLMFC\\LIB;C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\LIB;C:\\Pr
ogram Files\\Microsoft Visual Studio .NET 2003\\VC7\\PlatformSDK\\lib\\prereleas
e;C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC7\\PlatformSDK\\lib;C:
\\Program Files\\Microsoft Visual Studio .NET 2003\\SDK\\v1.1\\lib;',
'VS71COMNTOOLS' => 'C:\\Program Files\\Microsoft Visual Studio .NET 20
03\\Common7\\Tools\\',
'HARNESS_VERBOSE' => '1',
'OS' => 'Windows_NT',
'HOMEPATH' => '\\Documents and Settings\\Owner',
'PERL_JSON_BACKEND' => 'Cpanel::JSON::XS',
'FP_NO_HOST_CHECK' => 'NO',
'CLASSPATH' => 'C:\\Program Files\\Common Files\\Compuware\\DLM40JNI.j
ar',
'FRAMEWORKSDKDIR' => 'C:\\Program Files\\Microsoft Visual Studio .NET
2003\\SDK\\v1.1',
'SYSTEMDRIVE' => 'C:',
'USERPROFILE' => 'C:\\Documents and Settings\\Owner',
'HARNESS_VERSION' => '3.28',
'FTP_PASSIVE' => '1',
'COMPUTERNAME' => 'OWNER-5D26B85EE',
'ACROSDKPIDIR' => 'C:\\Program Files\\Adobe\\Acrobat 8.0\\Acrobat\\plu
g_ins',
'FRAMEWORKDIR' => 'C:\\WINDOWS\\Microsoft.NET\\Framework',
'VS80COMNTOOLS' => 'C:\\Program Files\\Microsoft Visual Studio 8\\Comm
on7\\Tools\\',
'LOGONSERVER' => '\\\\OWNER-5D26B85EE',
'VCINSTALLDIR' => 'C:\\Program Files\\Microsoft Visual Studio .NET 200
3',
'ALLUSERSPROFILE' => 'C:\\Documents and Settings\\All Users',
'_NT_SYMBOL_PATH' => 'srv*C:\\windows\\symbols
*
http://msdl.microsoft.com/download/symbols',
'TAP_VERSION' => '13',
'TEMP' => 'C:\\WINDOWS\\TEMP',
'PERL_YAML_BACKEND' => 'YAML::XS',
'DEVENVDIR' => 'C:\\Program Files\\Microsoft Visual Studio .NET 2003\\
Common7\\IDE',
'OPENSSL_CONF' => 'C:\\sources\\OpenSSL-Win32\\bin\\openssl.cfg',
'HARNESS_ACTIVE' => '1',
'TERM' => 'dumb',
'PROCESSOR_ARCHITECTURE' => 'x86',
'APPDATA' => 'C:\\Documents and Settings\\Owner\\Application Data',
'ZIP' => '1',
'TMP' => 'C:\\WINDOWS\\TEMP',
'CDPATH' => '',
'MSVCDIR' => 'C:\\Program Files\\Microsoft Visual Studio .NET 2003\\VC
7',
'BASH_ENV' => '',
'PROCESSOR_LEVEL' => '6',
'ENV' => ''
};
Can't spawn "cmd.exe": No such file or directory at C:/sperl/perl/lib/IPC/Open3.
pm line 405.
t/11-tainted.t .. skipped: Perl not in perlpath 'C:\sperl\perl\bin\perl.exe'
Test Summary Report
--------------------------------------------------------------
If I remove the empty stringing of PATH a different error comes up
--------------------------------------------------------------
cp lib/Devel/FindPerl.pm blib\lib\Devel\FindPerl.pm
C:\perl512\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib\lib', 'blib\arch')" t/*.t
t/00-compile.t .. ok
t/10-basics.t ... ok
t/11-tainted.t .. Can't spawn "cmd.exe": No such file or directory at C:/perl512
/lib/IPC/Open3.pm line 364.
t/11-tainted.t .. skipped: Perl not in perlpath 'c:\perl512\bin\perl.exe'
All tests successful.
Files=3, Tests=2, 2 wallclock secs ( 0.06 usr + 0.13 sys = 0.19 CPU)
Result: PASS
C:\Documents and Settings\Owner\.cpan\build\Devel-FindPerl-0.012-_mjr4k>nmake te
st
Microsoft (R) Program Maintenance Utility Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
C:\perl512\bin\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0,
'blib\lib', 'blib\arch')" t/*.t
t/00-compile.t .. ok
t/10-basics.t ... ok
t/11-tainted.t .. open2: IO::Pipe: Can't spawn-NOWAIT: Bad file descriptor at C:
\Documents and Settings\Owner\.cpan\build\Devel-FindPerl-0.012-_mjr4k\blib\lib/D
evel/FindPerl.pm line 118.
t/11-tainted.t .. Dubious, test returned 9 (wstat 2304, 0x900)
No subtests run
Test Summary Report
-------------------
t/11-tainted.t (Wstat: 2304 Tests: 0 Failed: 0)
Non-zero exit status: 9
Parse errors: No plan found in TAP output
Files=3, Tests=2, 1 wallclock secs ( 0.14 usr + 0.06 sys = 0.20 CPU)
Result: FAIL
Failed 1/3 test programs. 0/2 subtests failed.
NMAKE : fatal error U1077: 'C:\perl512\bin\perl.exe' : return code '0x9'
Stop.
--------------------------------------------------------------------
So emptying PATH is one bug, the other next one needs more research by me,