Bug 16121

Summary: AB-INT: BitbakeSetupTest.test_setup: Directory not empty
Product: [QA/Testing] Functional (self) Testing Reporter: Mathieu Dubois-Briand <mathieu.dubois-briand>
Component: bitbake-selftestAssignee: Alexander Kanavin <alex.kanavin>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: ccasciato, paul, randy.macleod, richard.purdie
Version: unspecified   
Target Milestone: 6.0 M2   
Hardware: x86   
OS: Multiple   
Whiteboard: AB-INT
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Mathieu Dubois-Briand 2026-01-05 09:42:00 UTC
Another new AB-INT, only happened on my branch so far. I did not find any obvious reason in the patches in there, but there is a lot of them, so it's still a possibility.

ERROR: test_setup (bb.tests.setup.BitbakeSetupTest.test_setup)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/lib/bb/tests/setup.py", line 483, in test_setup
    out = self.runbbsetup("update --update-bb-conf='yes'")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/lib/bb/tests/setup.py", line 90, in runbbsetup
    return bb.process.run("{} --global-settings {} {}".format(bbsetup, os.path.join(self.tempdir, 'global-config'), cmd))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/lib/bb/process.py", line 189, in run
    raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
bb.process.ExecutionError: Execution of '/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/bin/bitbake-setup --global-settings /tmp/bitbake-fetch-7z9xt1_o/global-config update --update-bb-conf='yes'' failed with exit code 1:
Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/bin/bitbake-setup", line 1075, in <module>
    main()
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/bin/bitbake-setup", line 1068, in main
    args.func(top_dir, all_settings, args, d)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/bin/bitbake-setup", line 700, in build_update
    build_status(top_dir, settings, args, d, update=True)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/bin/bitbake-setup", line 693, in build_status
    update_build(current_upstream_config, confdir, setupdir, layerdir,
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/bin/bitbake-setup", line 376, in update_build
    setup_bitbake_build(bitbake_config, layerdir, setupdir, thisdir, update_bb_conf)
  File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/bin/bitbake-setup", line 276, in setup_bitbake_build
    os.rename(bitbake_confdir, backup_bitbake_confdir)
OSError: [Errno 39] Directory not empty: '/tmp/bitbake-fetch-7z9xt1_o/bitbake-builds/test-config-1-gadget/build/conf' -> '/tmp/bitbake-fetch-7z9xt1_o/bitbake-builds/test-config-1-gadget/build/conf-backup.20260104112101'
Comment 1 Mathieu Dubois-Briand 2026-01-05 09:48:25 UTC
oe-selftest-debian debian12-vk-7 mathieu/master-next completed at 2026-01-04 12:48:01+00:00
https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2955/steps/12/logs/stdio
Comment 2 Paul Barker 2026-01-07 19:56:27 UTC
Names for conf-backup or conf-upstream directories created by bitbake-setup use a timestamp accuracy of 1 second. That's probably ok 99% of the time, but when running tests we might run bitbake-setup multiple times in one second.

We should modify bitbake-setup to handle the case where the conf-backup or conf-upstream directory already exists, or add some randomness to the names.
Comment 3 Mathieu Dubois-Briand 2026-01-09 09:12:26 UTC
oe-selftest-debian debian12-vk-7 mathieu/master-next completed at 2026-01-08 16:45:35+00:00
https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2987/steps/12/logs/stdio
Comment 4 Alexander Kanavin 2026-01-09 10:09:53 UTC
This is triggered by 'bitbake-setup: correct (and test) several scenarios in layer checkout' in testing, so that should be dropped until I submit a fixed revision.
Comment 5 Mathieu Dubois-Briand 2026-01-09 10:30:26 UTC
Noted, thanks. I will remove it from my branch.
Comment 6 Alexander Kanavin 2026-01-09 13:42:25 UTC
Fixed in https://patchwork.yoctoproject.org/project/bitbake/list/?series=42094