WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
188392
run-builtins-generator-tests does not correctly handle CRLFs from stderr
https://bugs.webkit.org/show_bug.cgi?id=188392
Summary
run-builtins-generator-tests does not correctly handle CRLFs from stderr
Ross Kirsling
Reported
2018-08-07 14:59:49 PDT
run-builtins-generator-tests does not correctly handle CRLFs from stderr
Attachments
Patch
(1.64 KB, patch)
2018-08-07 15:01 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Patch
(1.93 KB, patch)
2018-08-08 10:59 PDT
,
Ross Kirsling
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Ross Kirsling
Comment 1
2018-08-07 15:01:01 PDT
Created
attachment 346736
[details]
Patch
Ross Kirsling
Comment 2
2018-08-07 15:06:57 PDT
Python's file.write converts '\n' to os.linesep, so if the input string contains "\r\n", we end up with "\r\r\n" written to the file:
https://build.webkit.org/builders/WinCairo%2064-bit%20WKL%20Release%20%28Tests%29/builds/933/steps/builtins-generator-tests/logs/stdio
FWIW, DRT already does the same sort of replacement here:
https://github.com/WebKit/webkit/blob/master/Tools/Scripts/webkitpy/port/base.py#L514
Fujii Hironori
Comment 3
2018-08-07 20:09:09 PDT
Comment on
attachment 346736
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=346736&action=review
> Tools/Scripts/webkitpy/codegen/main.py:72 > with open(output_filepath, "w") as output_file:
This issues happens because run_command retrieves output as binary, but write_error_file opens a file as text mode. I think "w" should be replaced with "wb".
Ross Kirsling
Comment 4
2018-08-07 20:58:54 PDT
(In reply to Fujii Hironori from
comment #3
)
> Comment on
attachment 346736
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=346736&action=review
> > > Tools/Scripts/webkitpy/codegen/main.py:72 > > with open(output_filepath, "w") as output_file: > > This issues happens because run_command retrieves output as binary, but > write_error_file opens a file as text mode. > I think "w" should be replaced with "wb".
That will certainly also work, but I felt like it disguises the actual issue, since the input and output really are text (run_command gets data from subprocess.communicate but it ultimately returns a UTF-8 string), and our concern is simply with normalizing carriage returns.
Fujii Hironori
Comment 5
2018-08-07 22:06:00 PDT
I think the script should generate files in Unix style because otherwise it can't be used for expectations for other platforms. There are two potential issues: 1. run_command doesn't normalize '\r\n' 2. write_error_file converts '\n' to '\r\n' Fortunately, Windows diff.exe normalizes '\r\n', we don't need to fix both, but only one to pass run-builtins-generator-tests. If you don't like (2), I think you should take (1).
Fujii Hironori
Comment 6
2018-08-07 22:11:53 PDT
https://trac.webkit.org/browser/webkit/trunk/Source/JavaScriptCore/Scripts/tests/builtins/expected
This is the directory of expectations.
https://docs.python.org/3/library/functions.html#open
'open' of Python 3 can specify newline='\n'.
Ross Kirsling
Comment 7
2018-08-07 22:39:05 PDT
(In reply to Fujii Hironori from
comment #5
)
> I think the script should generate files in Unix style because otherwise it > can't be used for expectations for other platforms. > > There are two potential issues: > > 1. run_command doesn't normalize '\r\n' > 2. write_error_file converts '\n' to '\r\n' > > Fortunately, Windows diff.exe normalizes '\r\n', we don't need to fix both, but only one to pass run-builtins-generator-tests. > > If you don't like (2), I think you should take (1).
One way or another, the "actual" file needs to contain CRLF on Windows, because the "expected" file will be automatically checked out by Git/SVN with CRLF on Windows. Perhaps the best solution is to address (1) by putting the replace call here instead then:
https://github.com/WebKit/webkit/blob/master/Tools/Scripts/webkitpy/common/system/executive.py#L391
(In reply to Fujii Hironori from
comment #6
)
>
https://docs.python.org/3/library/functions.html#open
> 'open' of Python 3 can specify newline='\n'.
It's true that opening with newline='\r\n' would also solve the problem, but we're still on Python 2...
Fujii Hironori
Comment 8
2018-08-07 22:46:13 PDT
(In reply to Ross Kirsling from
comment #7
)
> One way or another, the "actual" file needs to contain CRLF on Windows, > because the "expected" file will be automatically checked out by Git/SVN > with CRLF on Windows.
Oh, that's right! I forgot that because I'm using Cygwin git.
> Perhaps the best solution is to address (1) by putting the replace call here > instead then: >
https://github.com/WebKit/webkit/blob/master/Tools/Scripts/webkitpy/common/
> system/executive.py#L391
Agreed.
Ross Kirsling
Comment 9
2018-08-08 10:59:56 PDT
Created
attachment 346776
[details]
Patch
WebKit Commit Bot
Comment 10
2018-08-08 14:54:57 PDT
Comment on
attachment 346776
[details]
Patch Clearing flags on attachment: 346776 Committed
r234711
: <
https://trac.webkit.org/changeset/234711
>
WebKit Commit Bot
Comment 11
2018-08-08 14:54:58 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12
2018-08-08 14:55:18 PDT
<
rdar://problem/43065427
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug