RESOLVED FIXED 199900
[webkitperl] runCommand doesn't work in Windows Perl
https://bugs.webkit.org/show_bug.cgi?id=199900
Summary [webkitperl] runCommand doesn't work in Windows Perl
Fujii Hironori
Reported 2019-07-18 02:10:59 PDT
runCommand doesn't work in Windows Perl https://build.webkit.org/builders/WinCairo%2064-bit%20WKL%20Release%20%28Tests%29/builds/4540 > Tools/Scripts/webkitperl/VCSUtils_unittest/removeEOL.pl ............................................ ok > '-' is not recognized as an internal or external command, > operable program or batch file. > > # Failed test 'runCommand(): Simple: comparing return value.' > # at Tools/Scripts/webkitperl/VCSUtils_unittest/runCommand.pl line 74. > # Structures begin differing at: > # $got->{stdout} = Does not exist > # $expected->{stdout} = 'hello > # ' > '-' is not recognized as an internal or external command, > operable program or batch file. > > # Failed test 'runCommand(): Multiple commands: comparing return value.' > # at Tools/Scripts/webkitperl/VCSUtils_unittest/runCommand.pl line 74. > # Structures begin differing at: > # $got->{stdout} = Does not exist > # $expected->{stdout} = 'first-command;echo second-command > # ' > '-' is not recognized as an internal or external command, > operable program or batch file. > > # Failed test 'runCommand(): Non-existent command: comparing return value.' > # at Tools/Scripts/webkitperl/VCSUtils_unittest/runCommand.pl line 74. > # Structures begin differing at: > # $got->{exitStatus} = '1' > # $expected->{exitStatus} = '2' > # Looks like you failed 3 tests of 3. > Tools/Scripts/webkitperl/VCSUtils_unittest/runCommand.pl ...........................................
Attachments
Patch (3.83 KB, patch)
2019-07-18 03:05 PDT, Fujii Hironori
no flags
Patch (3.83 KB, patch)
2019-07-18 04:09 PDT, Fujii Hironori
no flags
Archive of layout-test-results from ews116 for mac-highsierra (3.10 MB, application/zip)
2019-07-18 05:58 PDT, EWS Watchlist
no flags
Patch (3.86 KB, patch)
2019-07-22 00:22 PDT, Fujii Hironori
no flags
Patch (3.86 KB, patch)
2019-07-23 18:45 PDT, Fujii Hironori
no flags
Fujii Hironori
Comment 1 2019-07-18 03:05:14 PDT
Daniel Bates
Comment 2 2019-07-18 03:37:23 PDT
Comment on attachment 374369 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374369&action=review > Tools/Scripts/VCSUtils.pm:-2419 > - # FIXME: Consider further hardening of this function, including sanitizing the environment. Isn't this FIXME still relevant?
Fujii Hironori
Comment 3 2019-07-18 04:04:07 PDT
Comment on attachment 374369 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374369&action=review >> Tools/Scripts/VCSUtils.pm:-2419 >> - # FIXME: Consider further hardening of this function, including sanitizing the environment. > > Isn't this FIXME still relevant? Hmm, I don't know. OK, I will keep it.
Fujii Hironori
Comment 4 2019-07-18 04:09:51 PDT
EWS Watchlist
Comment 5 2019-07-18 05:58:21 PDT
Comment on attachment 374374 [details] Patch Attachment 374374 [details] did not pass mac-debug-ews (mac): Output: https://webkit-queues.webkit.org/results/12765515 New failing tests: storage/indexeddb/dont-wedge.html
EWS Watchlist
Comment 6 2019-07-18 05:58:23 PDT
Created attachment 374379 [details] Archive of layout-test-results from ews116 for mac-highsierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-highsierra Platform: Mac OS X 10.13.6
Fujii Hironori
Comment 7 2019-07-22 00:22:07 PDT
Fujii Hironori
Comment 8 2019-07-22 23:13:03 PDT
https://perldoc.perl.org/functions/open.html In Windows, 'echo' is a internal command of 'cmd.exe'. So, there is no 'echo.exe'. As the result, 'open' fails as 'No such file or directory' in "list form" of 'open'. There are two ways to use 'echo' in Win32 Perl. One is using three-argument form to execute the string in shell. Another is explicitly using 'cmd' in "list form". test.pl: > use Data::Dumper; > > my $ret = open(my $fh, "-|", "echo", "a", "b"); > my @out = <$fh>; > print Dumper($ret, \@out, $!); > > my $ret = open(my $fh, "-|", "echo a b"); > my @out = <$fh>; > print Dumper($ret, \@out, $!); > > my $ret = open(my $fh, "-|", "cmd", "/C", "echo", "a", "b"); > my @out = <$fh>; > print Dumper($ret, \@out, $!); Win32 Perl Output: > $VAR1 = undef; > $VAR2 = []; > $VAR3 = 'No such file or directory'; > $VAR1 = 14764; > $VAR2 = [ > 'a b > ' > ]; > $VAR3 = ''; > $VAR1 = 5668; > $VAR2 = [ > 'a b > ' > ]; > $VAR3 = '';
Stephan Szabo
Comment 9 2019-07-23 15:20:56 PDT
Comment on attachment 374589 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374589&action=review > Tools/Scripts/webkitperl/VCSUtils_unittest/runCommand.pl:38 > + inputArgs => ["perl", "-e", "print \@ARGV", "hello"], Should we potentially use $^X here and below rather than always trying to search for perl in the path?
Fujii Hironori
Comment 10 2019-07-23 18:22:36 PDT
Comment on attachment 374589 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=374589&action=review >> Tools/Scripts/webkitperl/VCSUtils_unittest/runCommand.pl:38 >> + inputArgs => ["perl", "-e", "print \@ARGV", "hello"], > > Should we potentially use $^X here and below rather than always trying to search for perl in the path? Good idea. Will do so.
Fujii Hironori
Comment 11 2019-07-23 18:45:09 PDT
Fujii Hironori
Comment 12 2019-07-24 19:01:10 PDT
Comment on attachment 374750 [details] Patch Clearing flags on attachment: 374750 Committed r247808: <https://trac.webkit.org/changeset/247808>
Fujii Hironori
Comment 13 2019-07-24 19:01:14 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 14 2019-07-24 19:03:34 PDT
Note You need to log in before you can comment on or make changes to this bug.