From e83ff0ca8515ca4db4f9acfcb2be6052de22efdf Mon Sep 17 00:00:00 2001 From: Matthew Leeds Date: Tue, 9 Jun 2020 19:08:50 -0700 Subject: [PATCH] transaction: Don't add deps or related for skipped ops Currently in the FlatpakTransaction implementation we add dependencies and related refs for each operation in the transaction regardless of if it's skipped or not. This is an issue in the case of an end-of-life-rebased ref because in that case if the user agrees a new install operation is added for the new ref, an uninstall operation is added for the end-of-lifed ref, and the update operation for the end-of-lifed one is marked as to be skipped. Then the dependencies of the end-of-lifed ref get added to the transaction and ultimately after all the sorting is done you end up with duplicate operations. In the case of having org.gnome.tetravex installed, "flatpak update" yields a transaction which uninstalls org.gnome.tetravex.Locale twice and errors out on the second time (in addition to uninstalling org.gnome.tetravex and installing org.gnome.Tetravex and org.gnome.Tetravex.Locale). Fix the issue by skipping operations marked as to be skipped when adding dependencies and related refs to the transaction. --- common/flatpak-transaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/flatpak-transaction.c b/common/flatpak-transaction.c index 502602b3..cff57556 100644 --- a/common/flatpak-transaction.c +++ b/common/flatpak-transaction.c @@ -3982,7 +3982,7 @@ flatpak_transaction_real_run (FlatpakTransaction *self, { FlatpakTransactionOperation *op = l->data; - if (!add_deps (self, op, error)) + if (!op->skip && !add_deps (self, op, error)) return FALSE; } @@ -3995,7 +3995,7 @@ flatpak_transaction_real_run (FlatpakTransaction *self, { FlatpakTransactionOperation *op = l->data; - if (!add_related (self, op, error)) + if (!op->skip && !add_related (self, op, error)) return FALSE; }