Skip to content

fix: call transaction_order() to get deterministic install ordering - #596

Open
sshedi wants to merge 1 commit into
vmware:devfrom
sshedi:topic/sshedi/fix-install-order-determinism
Open

fix: call transaction_order() to get deterministic install ordering#596
sshedi wants to merge 1 commit into
vmware:devfrom
sshedi:topic/sshedi/fix-install-order-determinism

Conversation

@sshedi

@sshedi sshedi commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

solver_create_transaction() returns pTrans->steps in an order influenced by the libsolv job-queue, which mirrors CLI argument order. rpmtsOrder() then picks whichever Requires(pre) provider appears closest to the consumer in the RPM transaction as the ordering anchor, making the install sequence non-deterministic across different CLI argument orderings.

Calling transaction_order(pTrans, 0) immediately after solver_create_transaction() sorts pTrans->steps into proper dependency-graph order before it is used to populate the RPM transaction, ensuring a consistent provider is selected as the anchor regardless of CLI order.

Regression: installing 'filesystem linux-tools bash toybox' vs 'filesystem linux-tools toybox bash' could result in either bash or toybox being used to run linux's %pre scriptlet. Toybox sh exits 1 for an if-branch that is never taken (non-POSIX), causing the install to fail.

Add a regression test using four minimal packages that reproduce the non-deterministic ordering with two competing Requires(pre) providers.

@sshedi

sshedi commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

To test the existing issue, use the following commands in 5.0-91 (with Update968 snapshot)

tdnf --releasever 5.0 --installroot $PWD/rootdir install -y filesystem linux-tools toybox bash; rm -rf $PWD/rootdir

tdnf --releasever 5.0 --installroot $PWD/rootdir install -y filesystem linux-tools bash toybox; rm -rf $PWD/rootdir

solver_create_transaction() returns pTrans->steps in an order influenced
by the libsolv job-queue, which mirrors CLI argument order. rpmtsOrder()
then picks whichever Requires(pre) provider appears closest to the
consumer in the RPM transaction as the ordering anchor, making the install
sequence non-deterministic across different CLI argument orderings.

Calling transaction_order(pTrans, 0) immediately after
solver_create_transaction() sorts pTrans->steps into proper
dependency-graph order before it is used to populate the RPM transaction,
ensuring a consistent provider is selected as the anchor regardless of
CLI order.

Regression: installing 'filesystem linux-tools bash toybox' vs
'filesystem linux-tools toybox bash' could result in either bash or toybox
being used to run linux's %pre scriptlet. Toybox sh exits 1 for an
if-branch that is never taken (non-POSIX), causing the install to fail.

Add a regression test using four minimal packages that reproduce the
non-deterministic ordering with two competing Requires(pre) providers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Shreenidhi Shedi <shreenidhi.shedi@broadcom.com>
@sshedi
sshedi force-pushed the topic/sshedi/fix-install-order-determinism branch from 8ecbab0 to ea9d24e Compare August 21, 2026 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant