<?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>9762</bug_id>
          
          <creation_ts>2016-06-13 10:11:36 +0000</creation_ts>
          <short_desc>Add support for poisoning of variables</short_desc>
          <delta_ts>2022-06-09 16:11:16 +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>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Low</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>Future</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Igor Stoppa">igor.stoppa</reporter>
          <assigned_to name="Unassigned">unassigned</assigned_to>
          <cc>patrick.ohly</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>62914</commentid>
    <comment_count>0</comment_count>
    <who name="Igor Stoppa">igor.stoppa</who>
    <bug_when>2016-06-13 10:11:36 +0000</bug_when>
    <thetext>As author of a recipe, I would like to have means to ensure that certain variables are set.

The current approach is to initialise the variable to a known value that is outside the range of valid parameters and then perform a check later on.

This is where I think it would be more efficient and robust to have bitbake supporting poisoning.

The approaches could be 2:

a) let the user do something like:

MY_PRE_POISONED_VARIABLE ??= &quot;DEADBEEF&quot;

b) pre-initialize very variable to the poisoned value, like:

AUTO_POISONING=&apos;True&apos; which would be the equivalent of:

RANDOM_VARIABLE ???= &quot;DEADBEEF&quot;


Either way, an error would be triggered whenever accessing a poisoned variable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63044</commentid>
    <comment_count>1</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-06-16 15:26:18 +0000</bug_when>
    <thetext>Could you give a bit more information about what kinds of problems you&apos;re seeing here? There are a few different ways this could possibly be implemented but that really depends on the exact problem which is being addressed.

You can today tell whether a value is set if you use anonymous python by seeing if the return value of getVar is None. If it is None, you know it wasn&apos;t set. I&apos;d much prefer checking for that value rather than adding poisoning support to bitbake.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63045</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2016-06-16 15:26:44 +0000</bug_when>
    <thetext>Assign to Igor for more info.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63050</commentid>
    <comment_count>3</comment_count>
    <who name="Igor Stoppa">igor.stoppa</who>
    <bug_when>2016-06-16 15:32:20 +0000</bug_when>
    <thetext>Yes, I could do as proposed, but what I&apos;m after is to avoid having to add custom code for the check.

The scenario I have in mind would be:

when creating a recipe, I declare one or more variables as poisoned and then I do not have to worry about when they are used.

The first time they are used without being initialised, I get an ERROR.

IOW I would like to move the burden of the verification on the tool, instead than on the author of the recipe.

Does this clarify the rationale?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>63051</commentid>
    <comment_count>4</comment_count>
    <who name="Igor Stoppa">igor.stoppa</who>
    <bug_when>2016-06-16 15:34:23 +0000</bug_when>
    <thetext>Back to original state and assignee.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93458</commentid>
    <comment_count>5</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2022-06-09 16:11:16 +0000</bug_when>
    <thetext>The trouble is we need to have consistent behaviour on how we handle default values. Most class code or similar checks for values and errors if they are unset. Adding in a new mechanism for such values would likely confuse more than it would help and we&apos;re unlikely to want to use poison values for many of our defaults.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>