<?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>15250</bug_id>
          
          <creation_ts>2023-10-20 08:08:24 +0000</creation_ts>
          <short_desc>bitbake not parsing &quot;addtask binary_patch after do_unpack before do_deploy_deb# this is a comment&quot; correctly</short_desc>
          <delta_ts>2024-09-03 10:54:12 +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>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>x86_64</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>5.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>developerdong</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Don&apos;t know</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>96754</commentid>
    <comment_count>0</comment_count>
    <who name="">developerdong</who>
    <bug_when>2023-10-20 08:08:24 +0000</bug_when>
    <thetext>Overview:

Firstly, there is a snippet of code to split the keyword &apos;before&apos;:
https://github.com/openembedded/bitbake/blob/5419a8473d6d4cd1d01537de68ad8d72cf5be0b2/lib/bb/build.py#L952

1. addtask binary_patch after do_unpack before do_deploy_deb

This code has no problem, because it is split into [&apos;do_deploy_deb&apos;].

2. addtask binary_patch after do_unpack before do_deploy_deb # this is a comment

This code is split into [&apos;do_deploy_deb&apos;, &apos;#&apos;, &apos;this&apos;, &apos;is&apos;, &apos;a&apos;, &apos;comment&apos;].
Though I think the comment should not be in the split result, fortunately &apos;do_deploy_deb&apos; is still a valid function what I want.

3. addtask binary_patch after do_unpack before do_deploy_deb# this is a comment

Unfortunately, this code is split into [&apos;do_deploy_deb#&apos;, &apos;this&apos;, &apos;is&apos;, &apos;a&apos;, &apos;comment&apos;], where &apos;do_deploy_deb#&apos; is not the function I want.

I think the root cause is due to: https://github.com/openembedded/bitbake/blob/5419a8473d6d4cd1d01537de68ad8d72cf5be0b2/lib/bb/parse/parse_py/BBHandler.py#L25

bitbake use regexp to parse addtask, but does not ignore the comment.


Steps to Reproduce: 

1. In your recipe, write a line of code like &quot;addtask A after B before C# comment&quot;. Please pay attention that there is no space between &quot;C&quot; and &quot;#&quot;.
2. Build the target and check the dependencies.


Actual Results:

No dependency is added between A and C.


Expected Results:

There is a before dependency between A and C.


Build Date &amp; Hardware:

Build 2023-10-09 on Debian 11


Additional Information: 

I don&apos;t know the whole procedure of how bitbake parse recipes.
- Maybe the bug is due to bitbake having no step to remove all the comments before parsing other syntaxes.
- Maybe changing the regular expression is one solution. (Other regular expressions may have the same bug.)
- Maybe it is acceptable to just write some hints in the documentation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97002</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-10-26 14:37:36 +0000</bug_when>
    <thetext>Good to fix but you can move the comment around to avoid the error - YP bug board review.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99600</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2024-09-03 10:54:12 +0000</bug_when>
    <thetext>https://git.yoctoproject.org/poky/commit/bitbake?id=5226f46342cae47cb96fafb725dc082ef206f9e8</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>