Bug 15652

Summary: "bitbake -e" and bitbake-getvar display different variable history
Product: [Build System, Metadata & Runtime] BitBake Reporter: Yoann Congal <yoann.congal>
Component: bitbakeAssignee: Yoann Congal <yoann.congal>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: ccasciato, poky.bs.watcher, poky.watcher, randy.macleod
Version: unspecified   
Target Milestone: 5.2   
Hardware: x86   
OS: Multiple   
See Also: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15638
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Yoann Congal 2024-11-19 16:22:44 UTC
The variable history part of the output of "bitbake -e" (without recipe) for DISTRO_FEATURES is different from "bitbake-getvar DISTRO_FEATURES": Notably, getvar lacks the operation from utils.py:
--- bb_e	2024-11-19 16:55:50.418258203 +0100
+++ getvar	2024-11-19 16:56:09.450228084 +0100
@@ -1,5 +1,5 @@
 #
-# $DISTRO_FEATURES [10 operations]
+# $DISTRO_FEATURES [9 operations]
 #   :remove <SNIP>/poky/build-master/conf/local.conf:323
 #     "ptest"
 #   :append <SNIP>/poky/build-master/conf/local.conf:392
@@ -18,8 +18,6 @@
 #     [doc] "The features enabled for the distribution."
 #   set? <SNIP>/poky/meta/conf/bitbake.conf:904
 #     ""
-#   append utils.py:132 [features_backfill]
-#     " pulseaudio gobject-introspection-data ldconfig"
 # pre-expansion value:
 #   "${DISTRO_FEATURES_DEFAULT} ${POKY_DEFAULT_DISTRO_FEATURES} seccomp polkit pam sysvinit pulseaudio gobject-introspection-data ldconfig"
 DISTRO_FEATURES="acl alsa bluetooth debuginfod ext2 ipv4 ipv6 pcmcia usbgadget usbhost wifi xattr nfs zeroconf pci 3g nfc x11 vfat seccomp opengl  multiarch wayland vulkan seccomp polkit pam sysvinit pulseaudio gobject-introspection-data ldconfig"

Richard saw this bug [0] while reviewing the fix of [1]:
> If you read bitbake-cookerdaemon.log for "bitbake-getvar -r bash" you
> will see disableDataTracking() call before finalizeData(). This means
> the variable history for anything run at finalize time will be missing.
> That may mean the history output for something like DISTRO_FEATURES
> will differ between bitbake -e and bitbake-getvar when a recipe is
> specified.
> 
> The reason for the difference is that the parse_recipe_file turns
> history on and off which ends up disabling it. That would be a bug as
> the tinfoil session already has tracking. This is a separate bug
> though.

NB: From when Richard saw this bug, it moved to the "no recipe is specified" case and I can't see it anymore in bitbake-cookerdaemon.log but the difference in output is there.

[0]: https://lists.openembedded.org/g/bitbake-devel/message/16790
[1]: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15638
Comment 1 Randy MacLeod 2024-11-21 15:39:54 UTC
Values are coming out write but it would be nice if the history was the same as well.
Comment 2 Randy MacLeod 2025-03-13 15:03:38 UTC
Values are coming out *right* but it would be nice if the history was the same as well. ;-)
Comment 3 Yoann Congal 2025-03-13 15:10:17 UTC
From RP during bug triage call:
* enable/disable tracking in finalizeData (like parse_recipe_file)
* implement as a Python context manager
Comment 4 Yoann Congal 2025-03-27 22:23:19 UTC
Fixed by this commit:
tinfoil: Track data during finalizeData - bitbake - Bitbake Development tree
https://git.openembedded.org/bitbake/commit/?id=228979b506f7d0e24c643440bcc7becf684da283