<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>188392</bug_id>
          
          <creation_ts>2018-08-07 14:59:49 -0700</creation_ts>
          <short_desc>run-builtins-generator-tests does not correctly handle CRLFs from stderr</short_desc>
          <delta_ts>2018-08-08 14:55:18 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Kirsling">ross.kirsling</reporter>
          <assigned_to name="Ross Kirsling">ross.kirsling</assigned_to>
          <cc>achristensen</cc>
    
    <cc>bburg</cc>
    
    <cc>commit-queue</cc>
    
    <cc>don.olmstead</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>fujii</cc>
    
    <cc>glenn</cc>
    
    <cc>saam</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1448598</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-08-07 14:59:49 -0700</bug_when>
    <thetext>run-builtins-generator-tests does not correctly handle CRLFs from stderr</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448599</commentid>
    <comment_count>1</comment_count>
      <attachid>346736</attachid>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-08-07 15:01:01 -0700</bug_when>
    <thetext>Created attachment 346736
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448600</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-08-07 15:06:57 -0700</bug_when>
    <thetext>Python&apos;s file.write converts &apos;\n&apos; to os.linesep, so if the input string contains &quot;\r\n&quot;, we end up with &quot;\r\r\n&quot; 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448671</commentid>
    <comment_count>3</comment_count>
      <attachid>346736</attachid>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2018-08-07 20:09:09 -0700</bug_when>
    <thetext>Comment on attachment 346736
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=346736&amp;action=review

&gt; Tools/Scripts/webkitpy/codegen/main.py:72
&gt;          with open(output_filepath, &quot;w&quot;) 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 &quot;w&quot; should be replaced with &quot;wb&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448678</commentid>
    <comment_count>4</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-08-07 20:58:54 -0700</bug_when>
    <thetext>(In reply to Fujii Hironori from comment #3)
&gt; Comment on attachment 346736 [details]
&gt; Patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=346736&amp;action=review
&gt; 
&gt; &gt; Tools/Scripts/webkitpy/codegen/main.py:72
&gt; &gt;          with open(output_filepath, &quot;w&quot;) as output_file:
&gt; 
&gt; This issues happens because run_command retrieves output as binary, but
&gt; write_error_file opens a file as text mode.
&gt; I think &quot;w&quot; should be replaced with &quot;wb&quot;.

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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448685</commentid>
    <comment_count>5</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2018-08-07 22:06:00 -0700</bug_when>
    <thetext>I think the script should generate files in Unix style because otherwise it can&apos;t be used for expectations for other platforms.

There are two potential issues:

1. run_command doesn&apos;t normalize &apos;\r\n&apos;
2. write_error_file converts &apos;\n&apos; to &apos;\r\n&apos;

Fortunately, Windows diff.exe normalizes &apos;\r\n&apos;, we don&apos;t need to fix both, but only one to pass run-builtins-generator-tests.

If you don&apos;t like (2), I think you should take (1).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448686</commentid>
    <comment_count>6</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2018-08-07 22:11:53 -0700</bug_when>
    <thetext>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
&apos;open&apos; of Python 3 can specify newline=&apos;\n&apos;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448691</commentid>
    <comment_count>7</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-08-07 22:39:05 -0700</bug_when>
    <thetext>(In reply to Fujii Hironori from comment #5)
&gt; I think the script should generate files in Unix style because otherwise it
&gt; can&apos;t be used for expectations for other platforms.
&gt; 
&gt; There are two potential issues:
&gt; 
&gt; 1. run_command doesn&apos;t normalize &apos;\r\n&apos;
&gt; 2. write_error_file converts &apos;\n&apos; to &apos;\r\n&apos;
&gt; 
&gt; Fortunately, Windows diff.exe normalizes &apos;\r\n&apos;, we don&apos;t need to fix both, but only one to pass run-builtins-generator-tests.
&gt; 
&gt; If you don&apos;t like (2), I think you should take (1).

One way or another, the &quot;actual&quot; file needs to contain CRLF on Windows, because the &quot;expected&quot; 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)
&gt; https://docs.python.org/3/library/functions.html#open
&gt; &apos;open&apos; of Python 3 can specify newline=&apos;\n&apos;.

It&apos;s true that opening with newline=&apos;\r\n&apos; would also solve the problem, but we&apos;re still on Python 2...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448692</commentid>
    <comment_count>8</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2018-08-07 22:46:13 -0700</bug_when>
    <thetext>(In reply to Ross Kirsling from comment #7)
&gt; One way or another, the &quot;actual&quot; file needs to contain CRLF on Windows,
&gt; because the &quot;expected&quot; file will be automatically checked out by Git/SVN
&gt; with CRLF on Windows.

Oh, that&apos;s right! I forgot that because I&apos;m using Cygwin git.

&gt; Perhaps the best solution is to address (1) by putting the replace call here
&gt; instead then:
&gt; https://github.com/WebKit/webkit/blob/master/Tools/Scripts/webkitpy/common/
&gt; system/executive.py#L391

Agreed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448784</commentid>
    <comment_count>9</comment_count>
      <attachid>346776</attachid>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-08-08 10:59:56 -0700</bug_when>
    <thetext>Created attachment 346776
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448857</commentid>
    <comment_count>10</comment_count>
      <attachid>346776</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-08-08 14:54:57 -0700</bug_when>
    <thetext>Comment on attachment 346776
Patch

Clearing flags on attachment: 346776

Committed r234711: &lt;https://trac.webkit.org/changeset/234711&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448858</commentid>
    <comment_count>11</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-08-08 14:54:58 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1448859</commentid>
    <comment_count>12</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-08-08 14:55:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/43065427&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>346736</attachid>
            <date>2018-08-07 15:01:01 -0700</date>
            <delta_ts>2018-08-08 10:59:55 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-188392-20180807150100.patch</filename>
            <type>text/plain</type>
            <size>1681</size>
            <attacher name="Ross Kirsling">ross.kirsling</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjM0NjcwCmRpZmYgLS1naXQgYS9Ub29scy9DaGFuZ2VMb2cg
Yi9Ub29scy9DaGFuZ2VMb2cKaW5kZXggY2IwZTVjYjFmYTA2N2U5NWQwNWZmM2U4ZDZlYjVlNTU1
ZmNjM2IyNC4uN2Q3OWZiNTMyNzAzZjc2YjIwZmQ2NGEwYzYxZThjNDk4MDM1ZDQ0ZSAxMDA2NDQK
LS0tIGEvVG9vbHMvQ2hhbmdlTG9nCisrKyBiL1Rvb2xzL0NoYW5nZUxvZwpAQCAtMSwzICsxLDEz
IEBACisyMDE4LTA4LTA3ICBSb3NzIEtpcnNsaW5nICA8cm9zcy5raXJzbGluZ0Bzb255LmNvbT4K
KworICAgICAgICBydW4tYnVpbHRpbnMtZ2VuZXJhdG9yLXRlc3RzIGRvZXMgbm90IGNvcnJlY3Rs
eSBoYW5kbGUgQ1JMRnMgZnJvbSBzdGRlcnIKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5v
cmcvc2hvd19idWc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vbW1vbi5zeXN0ZW0uZXhlY3V0aXZlIGltcG9ydCBTY3JpcHRFcnJvcgpAQCAtNjUsNiArNjYs
OSBAQCBjbGFzcyBCdWlsdGluc0dlbmVyYXRvclRlc3RzOgogICAgIGRlZiB3cml0ZV9lcnJvcl9m
aWxlKHNlbGYsIGlucHV0X2ZpbGVwYXRoLCBvdXRwdXRfZGlyZWN0b3J5LCBlcnJvcl9vdXRwdXQp
OgogICAgICAgICBvdXRwdXRfZmlsZXBhdGggPSBvcy5wYXRoLmpvaW4ob3V0cHV0X2RpcmVjdG9y
eSwgb3MucGF0aC5iYXNlbmFtZShpbnB1dF9maWxlcGF0aCkgKyAnLWVycm9yJykKIAorICAgICAg
ICBpZiBzeXMucGxhdGZvcm0gPT0gJ3dpbjMyJzoKKyAgICAgICAgICAgIGVycm9yX291dHB1dCA9
IGVycm9yX291dHB1dC5yZXBsYWNlKCdcclxuJywgJ1xuJykKKwogICAgICAgICB3aXRoIG9wZW4o
b3V0cHV0X2ZpbGVwYXRoLCAidyIpIGFzIG91dHB1dF9maWxlOgogICAgICAgICAgICAgb3V0cHV0
X2ZpbGUud3JpdGUoZXJyb3Jfb3V0cHV0KQogCg==
</data>

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>346776</attachid>
            <date>2018-08-08 10:59:56 -0700</date>
            <delta_ts>2018-08-08 14:54:57 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-188392-20180808105955.patch</filename>
            <type>text/plain</type>
            <size>1980</size>
            <attacher name="Ross Kirsling">ross.kirsling</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjM0Njk4CmRpZmYgLS1naXQgYS9Ub29scy9DaGFuZ2VMb2cg
Yi9Ub29scy9DaGFuZ2VMb2cKaW5kZXggNWJlYWUyYTMxYmQzN2YyY2ZkZGY1MThlYjg2ODRiYWUx
YjMwNjEyOC4uZGRlNGMzNTI2ZGY2YWM3Yjk3Nzgx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5fY2hpbGRfcHJvY2Vzc19lbmNv
ZGluZygpKQorICAgICAgICAgICAgb3V0cHV0ID0gb3V0cHV0LmRlY29kZShzZWxmLl9jaGlsZF9w
cm9jZXNzX2VuY29kaW5nKCkpLnJlcGxhY2UoJ1xyXG4nLCAnXG4nKQogCiAgICAgICAgICMgd2Fp
dCgpIGlzIG5vdCB0aHJlYWRzYWZlIGFuZCBjYW4gdGhyb3cgT1NFcnJvciBkdWUgdG86CiAgICAg
ICAgICMgaHR0cDovL2J1Z3MucHl0aG9uLm9yZy9pc3N1ZTE3MzE3MTcK
</data>

          </attachment>
      

    </bug>

</bugzilla>