Bug 16288 - Incorrect unihash rewrite on packagedata changes in indirect transitive dependencies
Summary: Incorrect unihash rewrite on packagedata changes in indirect transitive depen...
Status: NEW
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 6.1 M2
Assignee: Unassigned
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2026-05-19 12:24 UTC by Philip Lorenz
Modified: 2026-05-21 14:43 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Recipes to reproduce the issue (build `component` first, then update PKGV in `dep3` and rebuild `component`) (10.00 KB, application/x-tar)
2026-05-19 12:24 UTC, Philip Lorenz
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Lorenz 2026-05-19 12:24:53 UTC
Created attachment 5218 [details]
Recipes to reproduce the issue (build `component` first, then update PKGV in `dep3` and rebuild `component`)

In some scenarios, including the populate_sysroot unihash is not
sufficient to trigger a rebuild when a dependency changes (e.g., when
only the PKGV of a package changes).

One such scenario is

+---------------+
|               |
|   Component   +----------+
|               |          |
+-------+-------+          |
        |                  |
     DEPENDS               |
        |                  |
        v                  |
+---------------+          |
|               |          |
| Dependency 1  |       RDEPENDS
|               |          |
+-------+-------+          |
        |                  |
     DEPENDS               |
        |                  |
        v                  |
+---------------+          |
|               |          |
| Dependency 2  |          |
|               |          |
+-------+-------+          |
        |                  |
     DEPENDS               |
        |                  |
        v                  |
+---------------+          |
|               |          |
| Dependency 3  |<---------+
|               |
+---------------+

i.e., a dependency chain where a component has a runtime dependency to a
transitive dependency which in turn is not depended upon by its
intermediary.

Consider the case where only the PKGV of "Dependency 3” changes thus resulting
in a new `package` and `packagedata` unihash. This will invalidate "Dependency
2”’s `package` task hash and force its reexecution.  However, as "Dependency 2”
does not have a runtime dependency on "Dependency 3”, the output generated by
the task will be equivalent and the unihash will be set to the one before the
change.  This in turn means that “Dependency 1”'s packagedata unihash will get
rewritten to the original value.  As “Component"'s `package` task only has
a dependency to "Dependency 1”'s `packagedata` task it will then get reused
from cache leading to error messages such as

* Solver encountered 1 problem(s):
* Problem 1/1:
*   - conflicting requests
*   - nothing provides Dependency 3 >= x.y.z needed by Component
*
* Solution 1:
*   - do not ask to install a package providing Component

when building an image containing "Component".

This issue could be fixed by making `Dependency 3`'s `packagedata` unihash part
of the outhash of all dependents (similarly to what's done for
`do_populate_sysroot` in `staging.bbclass`). However, this is would be fairly
invasive and eliminate hash equivalence hits when the component does not have a
dependency on the changed dependency after all.

An improved approach to this would be to make recursive dependencies part of
the task hash calculation (similar to `recrdeptask` but only for build time
task dependencies). This would allow hash equivalence to continue to work
correctly while still requiring a rebuild whenever the package data of a
recursive dependency changes.

A reproducer of this issue is attached to this issue. The issue can be
replicated by first building `component`. Once done the `PKGV` of `dep3` shall
be changed and `component` shall be rebuilt. Checking the logs / produced
packages will then show that `component` continues to RDEPEND on the old
version of `dep3` rather than the updated `PKGV`.