<?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>137609</bug_id>
          
          <creation_ts>2014-10-10 05:27:15 -0700</creation_ts>
          <short_desc>webkitdirs::isCrossCompilation() cause Perl uninitialized warnings when using native GCC toolchain</short_desc>
          <delta_ts>2016-04-25 21:00:42 -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>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adrien Destugues">pulkomandy</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>commit-queue</cc>
    
    <cc>dbates</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1040899</commentid>
    <comment_count>0</comment_count>
    <who name="Adrien Destugues">pulkomandy</who>
    <bug_when>2014-10-10 05:27:15 -0700</bug_when>
    <thetext>webkitdirs.pm fails when CC is set to native compiler</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1040900</commentid>
    <comment_count>1</comment_count>
      <attachid>239621</attachid>
    <who name="Adrien Destugues">pulkomandy</who>
    <bug_when>2014-10-10 05:32:51 -0700</bug_when>
    <thetext>Created attachment 239621
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1187230</commentid>
    <comment_count>2</comment_count>
      <attachid>239621</attachid>
    <who name="Daniel Bates">dbates</who>
    <bug_when>2016-04-25 21:00:42 -0700</bug_when>
    <thetext>Comment on attachment 239621
Patch

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

&gt; Tools/ChangeLog:12
&gt; +        The perl regexp returns an empty array when there is no match (when
&gt; +        the compiler in CC is not configured with --target or --host). Trying
&gt; +        to test the first element of the array will trigger a warning
&gt; +        &quot;Use of uninitialized value $host[0] in string ne&quot;. Test that the
&gt; +        array is not empty first.

Maybe a better way to describe the issue is to say:

Fixes an issue where webkitdirs::isCrossCompilation() causes Perl uninitialized warnings when the GCC compiler specified by the environment variable CC was not built for cross compilation.

&gt; Tools/Scripts/webkitdirs.pm:1079
&gt;        my @host = $compiler_options =~ m/--host=(.*?)\s/;
&gt;        my @target = $compiler_options =~ m/--target=(.*?)\s/;
&gt;  
&gt; -      return ($host[0] ne &quot;&quot; &amp;&amp; $target[0] ne &quot;&quot; &amp;&amp; $host[0] ne $target[0]);
&gt; +      return (@host &amp;&amp; @target &amp;&amp; $host[0] ne &quot;&quot; &amp;&amp; $target[0] ne &quot;&quot; &amp;&amp; $host[0] ne $target[0]);

We are underutilizing the use of an array for holding the captured output of the regular expressions because the regular expression on lines 1076 and 1077 each have exactly one capture group. Using the fact that a captured group is always a string and the property that the empty string evaluates to false in a boolean context, I would write this code as:

my $host = $1 if $compiler_options =~ /--host=(.*?)\s/;
my $target = $1 if $compiler_options =~ /--target=(.*?)\s/;
return ($host &amp;&amp; $target &amp;&amp; $host ne $target);</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>239621</attachid>
            <date>2014-10-10 05:32:51 -0700</date>
            <delta_ts>2016-04-25 21:00:42 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-137609-20141010143355.patch</filename>
            <type>text/plain</type>
            <size>1622</size>
            <attacher name="Adrien Destugues">pulkomandy</attacher>
            
              <data encoding="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nZXRb
MF0pOwogICB9CiAgIHJldHVybiAwOwogfQo=
</data>
<flag name="review"
          id="264349"
          type_id="1"
          status="+"
          setter="dbates"
    />
          </attachment>
      

    </bug>

</bugzilla>