Bug 16492

Summary: bitbake: write_variables fails on missing build folder
Product: [Build System, Metadata & Runtime] BitBake Reporter: Mathieu Dubois-Briand <mathieu.dubois-briand>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Undecided CC: poky.bs.watcher, poky.watcher
Version: unspecified   
Target Milestone: 0.0.0   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Mathieu Dubois-Briand 2026-11-10 13:33:33 UTC
I had a bitbake crash after removing the tmp folder while bitbake-resident was still alive:


> ERROR: Command execution failed: Traceback (most recent call last):
>   File "/home/mathieu/projects/swat/gits/bitbake/lib/bb/command.py", line 127, in runAsyncCommand
>     commandmethod(self.cmds_async, self, options)
>     ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/home/mathieu/projects/swat/gits/bitbake/lib/bb/command.py", line 644, in buildTargets
>     command.cooker.buildTargets(pkgs_to_build, task)
>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
>   File "/home/mathieu/projects/swat/gits/bitbake/lib/bb/cooker.py", line 1588, in buildTargets
>     self.eventlog[2].write_variables()
>     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
>   File "/home/mathieu/projects/swat/gits/bitbake/lib/bb/cooker.py", line 116, in write_variables
>     with open(self.eventfile, "a") as f:
>          ~~~~^^^^^^^^^^^^^^^^^^^^^
> FileNotFoundError: [Errno 2] No such file or directory: '/home/mathieu/projects/swat/gits/build/tmp/log/eventlog/20261109164837.json'

This can easily be reproduced with:

> export BB_SERVER_TIMEOUT=600
> bitbake zlib-native
> rm -rf tmp/log/eventlog
> bitbake zlib-native

Now, I feel we are missing an mkdir() somewhere, maybe just in write_variables(). But maybe one should not manipulate the tmp folder while bitbake is still alive.