Bug 443615

Summary: Discover fails to uninstall just-installed package until being quit and re-launched
Product: [Applications] Discover Reporter: Nate Graham <nate>
Component: PackageKitAssignee: Dan Leinir Turthra Jensen <leinir>
Status: RESOLVED FIXED    
Severity: normal CC: aleixpol, claudius.ellsel, rdieter
Priority: NOR    
Version: 5.23.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.23.2

Description Nate Graham 2021-10-11 22:17:26 UTC
Fedora 34 with the DNF PackageKit backend, and compiled git master packages on top of it.


STEPS TO REPRODUCE
1. Install Audacious
3. Immediately uninstall it


OBSERVED RESULT
Discover shows a passive notification that says, "Package not found". `pkmon` is a bit more verbose, and says:

Transactions:
 1      /6129_cbbbccab
/6129_cbbbccab  allow_cancel 1
/6129_cbbbccab  percentage   -1
/6129_cbbbccab  role         remove-packages
/6129_cbbbccab  status       setup
/6129_cbbbccab  status       query
/6129_cbbbccab  percentage   0
/6129_cbbbccab  percentage   3
/6129_cbbbccab  percentage   4
/6129_cbbbccab  percentage   5
/6129_cbbbccab  status       finished

** (pkmon:56885): WARNING **: 16:14:18.779: failed to adopt: Failed to find audacious;4.1-2.fc34;x86_64;fedora

If I quit discover and launch it again, I can uninstall the app. 


EXPECTED RESULT
Apps can be uninstalled without having to quit and re-launch Discover after installing them.



ADDITIONAL INFORMATION
Does not reproduce with Flatpak apps.
Comment 1 Nate Graham 2021-10-11 22:27:27 UTC
(oh and it reproduces with all apps provided by packagekit, not just audacious)
Comment 2 Aleix Pol 2021-10-19 17:45:53 UTC
Can you confirm that audacious;4.1-2.fc34;x86_64;fedora is what needed to be uninstalled?
Comment 3 Nate Graham 2021-10-19 18:59:35 UTC
The package name was just "audacious".
Comment 4 Aleix Pol 2021-10-19 21:55:44 UTC
Same thing happens the other way around. If you uninstall then install it fails where it ends with ;installed:fedora
Comment 5 Aleix Pol 2021-10-19 22:24:43 UTC
I've looked into it and it seems like packagekit is giving us the wrong pkgid as it installs.

It should be giving "audacity;3.0.2-5.fc35;x86_64;installed fedora" but it gives "audacity;3.0.2-5.fc35;x86_64;fedora".

So either the packagekit dnf backend becomes smart enough to think they're the same or removing the package should be giving us the new package id, AFAIU.
Comment 6 Bug Janitor Service 2021-10-22 00:51:23 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/196
Comment 7 Aleix Pol 2021-10-22 13:41:58 UTC
Git commit 8eda40a097c088323523d474d1bafd301def8999 by Aleix Pol.
Committed on 22/10/2021 at 00:48.
Pushed by apol into branch 'master'.

pk: Properly resolve package ids after a transactions is done

The Transaction gets us the old package ids which aren't useful to us.

M  +4    -9    libdiscover/backends/PackageKitBackend/PKTransaction.cpp

https://invent.kde.org/plasma/discover/commit/8eda40a097c088323523d474d1bafd301def8999
Comment 8 Aleix Pol 2021-10-22 13:42:24 UTC
Git commit f1d63f7506d0d9186381f3a9bcd87c152ff842f9 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 22/10/2021 at 13:42.
Pushed by apol into branch 'Plasma/5.23'.

pk: Properly resolve package ids after a transactions is done

The Transaction gets us the old package ids which aren't useful to us.


(cherry picked from commit 8eda40a097c088323523d474d1bafd301def8999)

M  +4    -9    libdiscover/backends/PackageKitBackend/PKTransaction.cpp

https://invent.kde.org/plasma/discover/commit/f1d63f7506d0d9186381f3a9bcd87c152ff842f9
Comment 9 Aleix Pol 2022-01-20 12:35:23 UTC
*** Bug 429774 has been marked as a duplicate of this bug. ***