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

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>3177</bug_id>
          
          <creation_ts>2012-09-26 14:26:31 +0000</creation_ts>
          <short_desc>String literal parser too greedy</short_desc>
          <delta_ts>2012-10-04 10:27:42 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>BitBake</product>
          <component>bitbake</component>
          <version>1.3</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>1.4</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>jessica.zhang</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>---</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>25780</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2012-09-26 14:26:31 +0000</bug_when>
    <thetext>When the parser parses a string literal, it appears to do so greedily.

For example, consider the following line in my local.conf:

EXTRA_IMAGE_FEATURES = &quot;debug-tweaks&quot; # dev-pkgs dbg-pkgs tools-sdk&quot;

I&apos;d have thought that would set EXTRA_IMAGE_FEATURES to &quot;debug-tweaks&quot; and the rest of a line is a comment.

(removing the trailing quote results in a parse error, so apparently comments have to be on their own line)

But if you run bitbake -e, it actually parsed:

EXTRA_IMAGE_FEATURES=&quot;debug-tweaks\&quot; # dev-pkgs dbg-pkgs tools-sdk&quot;

That is not what I expected!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25801</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-09-26 17:08:35 +0000</bug_when>
    <thetext>Well, yes.

We can make the parser error for this with something like:

__config_regexp__  = re.compile( r&quot;(?P&lt;exp&gt;export\s*)?(?P&lt;var&gt;[a-zA-Z0-9\-_+.${}/]+)(\[(?P&lt;flag&gt;[a-zA-Z0-9\-_+.]+)\])?\s*((?P&lt;colon&gt;:=)|(?P&lt;lazyques&gt;\?\?=)|(?P&lt;ques&gt;\?=)|(?P&lt;append&gt;\+=)|(?P&lt;prepend&gt;=\+)|(?P&lt;predot&gt;=\.)|(?P&lt;postdot&gt;\.=)|=)\s*(?P&lt;apo&gt;[&apos;\&quot;])(?!.*(?P=apo).*(?P=apo)$)(?P&lt;value&gt;.*)(?P=apo)$&quot;)

in ConfParser.py. (Addition of the negative lookahead assertion (?!.*(?P=apo).*(?P=apo)$) ).

The trouble is this will cause parse failures for things like:

MACHINE_FEATURES_append = &quot;${@oe.utils.features_backfill(&quot;MACHINE_FEATURES&quot;,d)}&quot;

since there are four &quot; characters in there. We could try and spot unbalanced quotes but my regexp foo is failing for that at the moment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>25803</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-09-26 17:25:45 +0000</bug_when>
    <thetext>We could detect single extra quotes with:

__config_regexp__  = re.compile( r&quot;(?P&lt;exp&gt;export\s*)?(?P&lt;var&gt;[a-zA-Z0-9\-_+.${}/]+)(\[(?P&lt;flag&gt;[a-zA-Z0-9\-_+.]+)\])?\s*((?P&lt;colon&gt;:=)|(?P&lt;lazyques&gt;\?\?=)|(?P&lt;ques&gt;\?=)|(?P&lt;append&gt;\+=)|(?P&lt;prepend&gt;=\+)|(?P&lt;predot&gt;=\.)|(?P&lt;postdot&gt;\.=)|=)\s*(?!&apos;[^&apos;]*&apos;[^&apos;]*&apos;$)(?!\&quot;[^\&quot;]*\&quot;[^\&quot;]*\&quot;$)(?P&lt;apo&gt;[&apos;\&quot;])(?P&lt;value&gt;.*)(?P=apo)$&quot;)

which would at least catch the most common error with the addition of two lookahead assertions: (?!&apos;[^&apos;]*&apos;[^&apos;]*&apos;$)(?!\&quot;[^\&quot;]*\&quot;[^\&quot;]*\&quot;$)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26031</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-10-02 13:09:42 +0000</bug_when>
    <thetext>I merged http://git.yoctoproject.org/cgit.cgi/poky/commit/bitbake/lib?id=b85c30bb7d47dd8e9bea0e11029c0b08466603b0 which at least catches the one odd quote problem. Its less than ideal but probably as good as we can fix things right now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>26201</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2012-10-04 10:27:42 +0000</bug_when>
    <thetext>Marking this as resolved since I think we&apos;ve done what we can for this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>