<?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>15685</bug_id>
          
          <creation_ts>2024-12-09 10:32:38 +0000</creation_ts>
          <short_desc>??= behaves as = for variable flags</short_desc>
          <delta_ts>2025-02-18 10:10:09 +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>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>5.2 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ola Nilsson">ola.x.nilsson</reporter>
          <assigned_to name="Louis Rannou">louis.rannou</assigned_to>
          <cc>louis.rannou</cc>
    
    <cc>louis.rannou</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>richard.purdie</cc>
    
    <cc>yoann.congal</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>100387</commentid>
    <comment_count>0</comment_count>
    <who name="Ola Nilsson">ola.x.nilsson</who>
    <bug_when>2024-12-09 10:32:38 +0000</bug_when>
    <thetext>VARIABLE[flag] ??= &quot;value&quot;
behaves as 
VARIABLE[flag] = &quot;value&quot;

while the docs say that &quot;All the standard syntax operations previously mentioned work for variable flags except for override style syntax&quot;.

I _think_ it&apos;s because in DataNode::eval 

        flag = None
        if &apos;flag&apos; in groupd and groupd[&apos;flag&apos;] is not None:
            flag = groupd[&apos;flag&apos;]
        elif groupd[&quot;lazyques&quot;]:
            flag = &quot;_defaultval&quot;

will leave op = &quot;set&quot; even if groupd[&apos;op&apos;] == &apos;lazyques&apos;. 
But I can&apos;t find the code that cares about op, so I could be wrong.

If ??= is not supported for flag assignments, we should at least get an error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100392</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2024-12-09 17:49:46 +0000</bug_when>
    <thetext>I think this is a bug and ??= should work for flags as expected.

We should probably add a test case to lib/bb/tests/ and then fix the code, you&apos;re probably on the right track with the code fix but I need to look in more detail. The test case will help test before/after the fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100423</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2024-12-12 15:40:20 +0000</bug_when>
    <thetext>Should fix but not urgent. Yoann will work on this next year!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100599</commentid>
    <comment_count>3</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-01-09 23:00:16 +0000</bug_when>
    <thetext>Reproducer:

#local.conf:
TEST = &quot;good value&quot;
TEST ??= &quot;bad value&quot;
TEST[flag] = &quot;good flag&quot;
TEST[flag] ??= &quot;bad flag&quot;

Then:

 $ bitbake-getvar TEST ; echo -n &quot;TEST[flag] = &quot; ; bitbake-getvar TEST -f flag --value 
#
# $TEST [4 operations]
#   set /home/yocon/Documents/projets/yocto/poky_bb_intero_flag/build/conf/local.conf:291
#     &quot;good value&quot;
#   set /home/yocon/Documents/projets/yocto/poky_bb_intero_flag/build/conf/local.conf:292
#     [_defaultval] &quot;bad value&quot;
#   set /home/yocon/Documents/projets/yocto/poky_bb_intero_flag/build/conf/local.conf:293
#     [flag] &quot;good flag&quot;
#   set /home/yocon/Documents/projets/yocto/poky_bb_intero_flag/build/conf/local.conf:294
#     [flag] &quot;bad flag&quot;
# pre-expansion value:
#   &quot;good value&quot;
TEST=&quot;good value&quot;
TEST[flag] =bad flag

^ this should display &quot;good flag&quot; (like it does for &quot;good value&quot;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100605</commentid>
    <comment_count>4</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-01-10 19:11:37 +0000</bug_when>
    <thetext>Patch v1 sent:
bitbake-devel@lists.openembedded.org | [PATCH 1/2] tests/parse: add test for ?= and ??= operators for variable flags
https://lists.openembedded.org/g/bitbake-devel/topic/patch_1_2_tests_parse_add/110541105
bitbake-devel@lists.openembedded.org | [PATCH 2/2] data_smart: fix ??= operator for variable flags
https://lists.openembedded.org/g/bitbake-devel/topic/patch_2_2_data_smart_fix/110541106</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100609</commentid>
    <comment_count>5</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-01-10 23:01:37 +0000</bug_when>
    <thetext>Patch v2:
bitbake-devel@lists.openembedded.org | [PATCH v2 1/2] tests/parse: add test for ?= and ??= operators for variable flags
https://lists.openembedded.org/g/bitbake-devel/topic/patch_v2_1_2_tests_parse/110545216
bitbake-devel@lists.openembedded.org | [PATCH v2 2/2] data_smart: fix ??= operator for variable flags
https://lists.openembedded.org/g/bitbake-devel/topic/patch_v2_2_2_data_smart/110545217</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100657</commentid>
    <comment_count>6</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-01-15 23:01:58 +0000</bug_when>
    <thetext>Merged:
tests/parse: add test for ?= and ??= operators for variable flags - bitbake - Bitbake Development tree
https://git.openembedded.org/bitbake/commit/?id=d12c80125d810df54379cc4f019a95ab9064ad2c
data_smart: fix ??= operator for variable flags - bitbake - Bitbake Development tree
https://git.openembedded.org/bitbake/commit/?id=0329a7e3ac694737f2d2c1861f65492551360663</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100896</commentid>
    <comment_count>7</comment_count>
      <attachid>5096</attachid>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-02-11 17:10:38 +0000</bug_when>
    <thetext>Created attachment 5096
Failing test case for getVarFlags()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100897</commentid>
    <comment_count>8</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-02-11 17:14:00 +0000</bug_when>
    <thetext>Louis Rannou found a bug with the current fix:
* default varflags are excluded from d.getVarFlags() dict but should be (at least I would expect it)
* https://bugzilla.yoctoproject.org/attachment.cgi?id=5096 attached patch to trigger the bug
* Simpler version: In the current testcase:
  self.assertTrue(&quot;flag_default&quot; in d.getVarFlags(&quot;A&quot;))</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100898</commentid>
    <comment_count>9</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-02-11 18:00:43 +0000</bug_when>
    <thetext>I guess we need to act on &quot;_defaultval_flag_*&quot; variables in getVarFlags() instead of skipping them currently: https://git.openembedded.org/bitbake/tree/lib/bb/data_smart.py?id=93059aad13a12cd69d86368795c88e5349197d5d#n952</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100899</commentid>
    <comment_count>10</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2025-02-11 22:30:57 +0000</bug_when>
    <thetext>you may need to pass internalflags=True to getVarFlags()?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100915</commentid>
    <comment_count>11</comment_count>
    <who name="Louis Rannou">louis.rannou</who>
    <bug_when>2025-02-13 13:46:35 +0000</bug_when>
    <thetext>Hello,

I&apos;m quite ready for a v2 patch but I&apos;m having some incoherences.

First of all, I found that calling delVar(&quot;A&quot;) will blow out all flags. Is that expected ? Perhaps we can have an extra argument to say if we want flags to be deleted or not.

Second, delVarFlag(&quot;A&quot;, &quot;flag1&quot;) will erase the flag1 but not its weak default. I suppose the default must be removed too ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100939</commentid>
    <comment_count>12</comment_count>
    <who name="Yoann Congal">yoann.congal</who>
    <bug_when>2025-02-13 16:01:28 +0000</bug_when>
    <thetext>Louis sent a v2:
[PATCH v2 0/2] bitbake: fix ??= operator for variable flags and test
https://lists.openembedded.org/g/bitbake-devel/topic/patch_v2_0_2_bitbake_fix/111163809
[PATCH v2 1/2] bitbake: data_smart: fix ??= operator for variable flags
https://lists.openembedded.org/g/bitbake-devel/topic/patch_v2_1_2_bitbake/111163810
[PATCH v2 2/2] bitbake: tests/data: add tests for variable flags
https://lists.openembedded.org/g/bitbake-devel/topic/patch_v2_2_2_bitbake/111163811</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101131</commentid>
    <comment_count>13</comment_count>
    <who name="Louis Rannou">louis.rannou</who>
    <bug_when>2025-02-18 09:03:35 +0000</bug_when>
    <thetext>Merged:
bitbake: data_smart: fix ??= operator for variable flags
https://git.openembedded.org/bitbake/commit?id=2ee079fc1b7cf6d384ca17bd034b0a40461d9d18
bitbake: tests/data: add tests for variable flags
https://git.openembedded.org/bitbake/commit?id=ff8cae735cf489373af1aac7ee233d7b82d483d3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101132</commentid>
    <comment_count>14</comment_count>
    <who name="Louis Rannou">louis.rannou</who>
    <bug_when>2025-02-18 09:04:39 +0000</bug_when>
    <thetext>Closing, but reoppen if delVar is not supposed to erase all variable flags</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101135</commentid>
    <comment_count>15</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2025-02-18 10:10:09 +0000</bug_when>
    <thetext>I did mean to comment, delVar is supposed to remove all varflags so that behaviour is correct, thanks!</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>5096</attachid>
            <date>2025-02-11 17:10:38 +0000</date>
            <delta_ts>2025-02-11 17:10:38 +0000</delta_ts>
            <desc>Failing test case for getVarFlags()</desc>
            <filename>0001-bitbake-tests-parse-add-test-for-getVarFlags.patch</filename>
            <type>text/plain</type>
            <size>3198</size>
            <attacher name="Yoann Congal">yoann.congal</attacher>
            
              <data encoding="base64">RnJvbSAyNzFjODc0NTYzZjdkZjI4NDk4ZGVmY2VmZjZlZGRhNjgyYWRjMmY4IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBMb3VpcyBSYW5ub3UgPGxvdWlzLnJhbm5vdUBub24uc2UuY29t
PgpEYXRlOiBUdWUsIDExIEZlYiAyMDI1IDE2OjI0OjAzICswMTAwClN1YmplY3Q6IFtQQVRDSF0g
Yml0YmFrZTogdGVzdHMvcGFyc2U6IGFkZCB0ZXN0IGZvciBnZXRWYXJGbGFncwoKUnVuIHRoZSB0
ZXN0IHdpdGg6CiAgICAkIGJpdGJha2Utc2VsZnRlc3QgYmIudGVzdHMucGFyc2UuUGFyc2VUZXN0
LnRlc3RfcGFyc2VfZGVmYXVsdHRlc3QKICAgIEYKICAgID09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KICAgIEZBSUw6
IHRlc3RfcGFyc2VfZGVmYXVsdHRlc3QgKGJiLnRlc3RzLnBhcnNlLlBhcnNlVGVzdC50ZXN0X3Bh
cnNlX2RlZmF1bHR0ZXN0KQogICAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQogICAgVHJhY2ViYWNrIChtb3N0IHJl
Y2VudCBjYWxsIGxhc3QpOgogICAgICBGaWxlICIvaG9tZS9sb3Vpcy9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orICAgICAgICAgICAgICAgICJm
bGFnX3F1ZXN0aW9uX3R3aWNlIjogInF1ZXN0aW9uIGZsYWcgZmlyc3QiLAorICAgICAgICAgICAg
ICAgICJmbGFnX2RlZmF1bHRfdHdpY2UiOiAiZGVmYXVsdCBmbGFnIHNlY29uZCIsCisgICAgICAg
ICAgICB9CisgICAgICAgICkKIAogICAgIGV4cG9ydHRlc3QgPSAiIiIKIEEgPSAiYSIKLS0gCjIu
NDMuMAoK
</data>

          </attachment>
      

    </bug>

</bugzilla>