<?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>184166</bug_id>
          
          <creation_ts>2018-03-29 17:46:06 -0700</creation_ts>
          <short_desc>Xcode prepends line comments from WTF/Compiler.h to *.sb files</short_desc>
          <delta_ts>2018-04-03 11:19:03 -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>Web Template Framework</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=184062</see_also>
          <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>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>commit-queue</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1410462</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-03-29 17:46:06 -0700</bug_when>
    <thetext>Repro:

1. Add a line comment (// not /* */) to the start of a line in this file: https://github.com/WebKit/webkit/blob/master/Source/WTF/wtf/Compiler.h
2. Open Xcode and hit the Play button
=&gt; WebContent process crashes immediately

Cause:

The comment gets prepended to this file, in which C-style comments are invalid:
/Users/.../Library/Developer/Xcode/DerivedData/WebKit-.../Build/Products/Debug/WebKit.framework/Resources/com.apple.WebProcess.sb
(It will also be prepended to com.apple.WebKit.NetworkProcess.sb and com.apple.WebKit.Storage.sb in the same directory.)

This file originates here:
https://github.com/WebKit/webkit/blob/master/Source/WebKit/WebProcess/com.apple.WebProcess.sb.in
It appears to be processed by this script:
https://github.com/WebKit/webkit/blob/master/Source/WebKit/DerivedSources.make


Reason for concern:

This issue is very time-consuming to debug for the following reasons.
- It is completely unexpected, as C, C++, and ObjC all support line comments.
- The issue only occurs from the Xcode UI and not from the `build-webkit` CLI.
- Selecting Product &gt; Clean in Xcode is not a fix -- one must actually delete the DerivedData subdirectory (the existence of which is hardly common knowledge!).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410515</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2018-03-29 20:42:08 -0700</bug_when>
    <thetext>The fix would be two-fold:

1. Add a script step to remove comment lines from processed profiles.
2. Change preprocessor mode to C++.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410521</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-03-29 20:50:26 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #1)
&gt; The fix would be two-fold:
&gt; 
&gt; 1. Add a script step to remove comment lines from processed profiles.
&gt; 2. Change preprocessor mode to C++.

Looks like both parts might be doable all in one step here:
https://github.com/WebKit/webkit/blob/master/Source/WebKit/DerivedSources.make#L220-L227

I wonder if it&apos;s safe to replace all of the above with the following?
&gt; TEXT_PREPROCESSOR_FLAGS=-E -P -x -w</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410522</commentid>
    <comment_count>3</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-03-29 20:53:01 -0700</bug_when>
    <thetext>(In reply to Ross Kirsling from comment #2)
&gt; I wonder if it&apos;s safe to replace all of the above with the following?
&gt; &gt; TEXT_PREPROCESSOR_FLAGS=-E -P -x -w

Sorry, that should have been:
&gt; TEXT_PREPROCESSOR_FLAGS=-E -P -w</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410524</commentid>
    <comment_count>4</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2018-03-29 21:01:16 -0700</bug_when>
    <thetext>The C++ preprocessor would result in breaking comments that contain URLs, so a step to remove semicolon based comments is necessary. 

This is all of course based on an assumption that we will never have two slashes in an actual sandbox rule. I think that it’s an ok assumption to make.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410525</commentid>
    <comment_count>5</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-03-29 21:09:09 -0700</bug_when>
    <thetext>(In reply to Alexey Proskuryakov from comment #4)
&gt; The C++ preprocessor would result in breaking comments that contain URLs, so
&gt; a step to remove semicolon based comments is necessary.
&gt;
&gt; This is all of course based on an assumption that we will never have two
&gt; slashes in an actual sandbox rule. I think that it’s an ok assumption to
&gt; make.

That makes sense. I just discovered your original motivation in https://bugs.webkit.org/show_bug.cgi?id=83827. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410669</commentid>
    <comment_count>6</comment_count>
      <attachid>336872</attachid>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-03-30 11:01:34 -0700</bug_when>
    <thetext>Created attachment 336872
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1410944</commentid>
    <comment_count>7</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2018-03-31 23:03:08 -0700</bug_when>
    <thetext>*** Bug 181309 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1411467</commentid>
    <comment_count>8</comment_count>
    <who name="Ross Kirsling">ross.kirsling</who>
    <bug_when>2018-04-03 10:48:31 -0700</bug_when>
    <thetext>I believe this patch satisfies the desired criteria. It is naive in indiscriminately treating semicolons as comment-openers in *.sb.in files, but it&apos;s a simple fix that&apos;s compatible with the way those files are currently used.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1411469</commentid>
    <comment_count>9</comment_count>
      <attachid>336872</attachid>
    <who name="Brent Fulgham">bfulgham</who>
    <bug_when>2018-04-03 10:50:07 -0700</bug_when>
    <thetext>Comment on attachment 336872
Patch

Looks good. r=me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1411488</commentid>
    <comment_count>10</comment_count>
      <attachid>336872</attachid>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-04-03 11:15:00 -0700</bug_when>
    <thetext>Comment on attachment 336872
Patch

Clearing flags on attachment: 336872

Committed r230213: &lt;https://trac.webkit.org/changeset/230213&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1411489</commentid>
    <comment_count>11</comment_count>
    <who name="WebKit Commit Bot">commit-queue</who>
    <bug_when>2018-04-03 11:15:02 -0700</bug_when>
    <thetext>All reviewed patches have been landed.  Closing bug.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1411494</commentid>
    <comment_count>12</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2018-04-03 11:19:03 -0700</bug_when>
    <thetext>&lt;rdar://problem/39147349&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>336872</attachid>
            <date>2018-03-30 11:01:34 -0700</date>
            <delta_ts>2018-04-03 11:15:00 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-184166-20180330110134.patch</filename>
            <type>text/plain</type>
            <size>2141</size>
            <attacher name="Ross Kirsling">ross.kirsling</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjMwMTA3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L0No
YW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvQ2hhbmdlTG9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