<?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>15881</bug_id>
          
          <creation_ts>2025-05-28 07:39:14 +0000</creation_ts>
          <short_desc>consecutive bitbake-getvar invocations cause log messages to be sent to stdout</short_desc>
          <delta_ts>2026-10-01 15:47:29 +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>5.2</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>6.2 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Enrico Jorns">ejo</reporter>
          <assigned_to name="Richard Purdie">richard.purdie</assigned_to>
          <cc>ccasciato</cc>
    
    <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>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>102086</commentid>
    <comment_count>0</comment_count>
    <who name="Enrico Jorns">ejo</who>
    <bug_when>2025-05-28 07:39:14 +0000</bug_when>
    <thetext>When using bitbake-getvar for scripting, I have two consecutive calls to get two different variable contents. The output should be stored in a variable, thus, the commands should only emit the value of the queried variable:

  YOCTO_BUILD=$(bitbake-getvar -r busybox --value B -q)
  YOCTO_SOURCE=$(bitbake-getvar -r busybox --value S -q)

While the first call only prints the variable value to stdout, the second call prints:

  NOTE: Reconnecting to bitbake server...
  NOTE: Retrying server connection (#1)... (09:07:49.112555)
  /path/to/tmp/work/../build

which will break the script&apos;s variable.

I&apos;ve noted this only happens when the bitbake from the previous call is still terminating (seems to work fine for still running/memres bitbake).

Digging through the code, I realized this is a somewhat intentional behavior for bitbake that ensures no log messages get lost. It happens in the print_ui_queue() method, registered as an exit handler, which drains all remaining UI LogEvents (if no UI is present) and dumps them using simple stdout/stderr log handlers.

My understanding is that the terminating bitbake still receives and prints these logs before finally exiting.

What&apos;s unclear to me is if this can be avoided for the bitbake-getvar use case.
An option I have thought about is to ensure the previous bitbake is fully shut down before spawning a new one. But maybe there are also options for silencing the log draining? Or something conceptual I haven&apos;t thought of?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>