<?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>13469</bug_id>
          
          <creation_ts>2019-08-06 16:56:18 +0000</creation_ts>
          <short_desc>uboot-extlinux-config uses wrong description</short_desc>
          <delta_ts>2019-11-11 19:14:38 +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>OE-Core</product>
          <component>oe-core other</component>
          <version>unspecified</version>
          <rep_platform>Other</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>3.1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Will Page">wpage</reporter>
          <assigned_to name="Will Page">wpage</assigned_to>
          <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>84588</commentid>
    <comment_count>0</comment_count>
    <who name="Will Page">wpage</who>
    <bug_when>2019-08-06 16:56:18 +0000</bug_when>
    <thetext>U-Boot&apos;s extlinux.conf label generation facilities (defined in meta/classes/uboot-extlinux-config.bbclass) generate incorrect results under some circumstances.

When using non-default labels (e.g. UBOOT_EXTLINUX_LABELS = &quot;default&quot;, replacing the default value of &quot;linux&quot;), user-supplied label descriptions are ignored (e.g. UBOOT_EXTLINUX_MENU_DESCRIPTION_default = &quot;Foo&quot; will always be ignored in favor of the default value supplied in UBOOT_EXTLINUX_MENU_DESCRIPTION).

This behavior results from the class using OVERRIDES to support label-specific definitions, and the default label using an identifier that corresponds to a common ${OS} value, which by default appears in OVERRIDES.

For example:

UBOOT_EXTLINUX_LABELS = &quot;default&quot;
UBOOT_EXTLINUX_MENU_DESCRIPTION = &quot;Foo&quot;

During processing of the &quot;default&quot; label, the OVERRIDES will be updated from &quot;${OS}:...&quot; to &quot;default:${OS}:...&quot;.  Because &quot;linux&quot; will be the most common value for ${OS} in this situation, it will frequently be evaluated as &quot;default:linux:...&quot;.

Later, when writing out the entries for that label, it will request the value of &quot;UBOOT_EXTLINUX_MENU_DESCRIPTION&quot;, at which point it will iterate through the OVERRIDES list, first processing the value for UBOOT_EXTLINUX_MENU_DESCRIPTION_default, then in a later iteration finding UBOOT_EXTLINUX_MENU_DESCRIPTION_linux, and using that value instead.

The OVERRIDE precedence rules essentially guarantee that the default value assigned to the _linux variable will supercede any user-supplied values for any and all labels.

I see three possible fixes:
1. change the provided label from &quot;linux&quot; to &quot;default&quot; or &quot;primary&quot; or similar, something that&apos;s not a commonly used value in OVERRIDES.  If using this solution, documentation changes should probably be made to discourage using OS-, DISTRO-, or MACHINE-related values for labels.
2. in the local copy of the dictionary used for generating label entries, clear out all pre-existing values of OVERRIDES
3. instead of prepending the label to the list of OVERRIDES, append the label to the list, giving it the highest precedence (although properly speaking it should be inserted before forcevariable, if it exists, giving it the second-highest priority).

A related issue exists where values defined for the first label shadow values defined for subsequent labels (when multiple labels are defined), because the dictionary gets re-used between iterations over the labels, and the newly-added label OVERRIDE has lower precedence than the previous labels, which are still present in the OVERRIDES list.

This related issue would be solved by options #2 and #3 above, although solution #2 is likely to result in surprising results where values not set for one label would essentially default to the value used for the previous label.

Alternatively, solution #1 combined with moving the dictionary copy into the loop, giving each label iteration a fresh copy of OVERRIDES (along with everything else) would also solve this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84589</commentid>
    <comment_count>1</comment_count>
    <who name="Will Page">wpage</who>
    <bug_when>2019-08-06 17:33:29 +0000</bug_when>
    <thetext>I misspoke in my original description, where I said

&quot;although solution #2 is likely to result in surprising results where values not set for one label would essentially default to the value used for the previous label&quot;

I meant to say that solution #3 would give the described surprising results.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84591</commentid>
    <comment_count>2</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-08-06 22:12:30 +0000</bug_when>
    <thetext>Reassigning to Marek, the u-boot maintainer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84610</commentid>
    <comment_count>3</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-08-08 14:44:33 +0000</bug_when>
    <thetext>Will, can you send a patch to the email list to fix this issue? Marek may be on vacation for a bit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84612</commentid>
    <comment_count>4</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2019-08-08 14:53:12 +0000</bug_when>
    <thetext>The use of overrides in this way is perhaps unfortunate. What we try to do now is use a prefix with overrides to try and avoid this problem. Perhaps we could adopt some prefix here to avoid these problems?

Will: Would you be willing to send a patch for this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84618</commentid>
    <comment_count>5</comment_count>
    <who name="Will Page">wpage</who>
    <bug_when>2019-08-08 15:16:17 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; The use of overrides in this way is perhaps unfortunate. What we try to do
&gt; now is use a prefix with overrides to try and avoid this problem. Perhaps we
&gt; could adopt some prefix here to avoid these problems?
&gt; 
&gt; Will: Would you be willing to send a patch for this?

Can you point me to an example of prefixed overrides, so that I&apos;m clear on what you&apos;re suggesting and can do it consistently with other places in the project?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84659</commentid>
    <comment_count>6</comment_count>
    <who name="Will Page">wpage</who>
    <bug_when>2019-08-13 17:45:11 +0000</bug_when>
    <thetext>(In reply to comment #5)
&gt; (In reply to comment #4)
&gt; &gt; The use of overrides in this way is perhaps unfortunate. What we try to do
&gt; &gt; now is use a prefix with overrides to try and avoid this problem. Perhaps we
&gt; &gt; could adopt some prefix here to avoid these problems?
&gt; &gt; 
&gt; &gt; Will: Would you be willing to send a patch for this?
&gt; 
&gt; Can you point me to an example of prefixed overrides, so that I&apos;m clear on
&gt; what you&apos;re suggesting and can do it consistently with other places in the
&gt; project?

I think I&apos;ve got it.  I&apos;m working on a solution that follows a similar route to what happens in devtools-source.bbclass.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84661</commentid>
    <comment_count>7</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-08-13 19:56:47 +0000</bug_when>
    <thetext>Reset the target milestone. (2.8 is gone, it&apos;s now known as 3.0)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85492</commentid>
    <comment_count>8</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-11-07 16:06:00 +0000</bug_when>
    <thetext>Will can you work on this or is it already fixed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85513</commentid>
    <comment_count>9</comment_count>
    <who name="Will Page">wpage</who>
    <bug_when>2019-11-11 19:14:38 +0000</bug_when>
    <thetext>This was fixed in master with commit 42b44fdd9e63b8d39cf83baecec08328275558ff.

https://git.openembedded.org/openembedded-core/commit/meta/classes/uboot-extlinux-config.bbclass?id=42b44fdd9e63b8d39cf83baecec08328275558ff</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>