Bug 448521

Summary: 'Update' page shows the version of the flatpak currently installed instead of the version of the update available
Product: [Applications] Discover Reporter: Patrick Silva <bugseforuns>
Component: Flatpak BackendAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ahmed.com, aleixpol, atlas.sargsyan, heri+kde, jgrulich, MurzNN, nate, pehteimoso-kdebugs
Priority: HI    
Version: 5.23.90   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=411186
https://bugs.kde.org/show_bug.cgi?id=465864
Latest Commit: Version Fixed In: 5.27.6
Sentry Crash Report:
Attachments: before update
after update
screenshot of a Flatpak update
screenshot before updating
screenshot after updating
Version numbers reversed

Description Patrick Silva 2022-01-15 12:05:16 UTC
Created attachment 145490 [details]
before update

SUMMARY
When a update for a flatpak app is available, the 'Update' page shows the version currently installed instead of the version of the update available. Please see the screenshots taken before and after updating my system.

STEPS TO REPRODUCE
1. have flatpaks installed on your system
2. open Discover when updates for flatpaks are available and click on 'Update' in the sidebar
3. obverse 'Update to version...' text of flatpaks updates
4. install all updates
5. open the description page of the just updated flatpaks
6. observe the version of the flatpak currently installed

OBSERVED RESULT
versions observed in the steps 3 and 6 are different

EXPECTED RESULT
versions observed in the 'Update' page and in the description pages should match

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.23.90
KDE Frameworks Version: 5.90.0
Qt Version: 5.15.2)
Graphics Platform: Wayland
Comment 1 Patrick Silva 2022-01-15 12:05:36 UTC
Created attachment 145491 [details]
after update
Comment 2 Nate Graham 2022-01-21 01:50:04 UTC
Can confirm. Seems related to 447937.
Comment 3 Dennis Schridde 2022-07-21 09:24:21 UTC
Created attachment 150785 [details]
screenshot of a Flatpak update

I experience this too (see attached screenshot). Fixing bug #447937 does not seem to have fixed this.

I would also provide the output of `flatpak --system update`, but there apparently the `flatpak` CLI does not show it (cf. https://github.com/flatpak/flatpak/issues/2901).
Comment 4 Dennis Schridde 2022-07-21 09:26:42 UTC
This might be related to bug #411186 or bug #434936, which also deal with wrong version information being displayed.
Comment 5 Aleix Pol 2022-08-25 09:10:58 UTC
Git commit 84624c868c3090e70e15ca9d5686b9f04828d0be by Aleix Pol Gonzalez, on behalf of Aleix Pol i Gonzalez.
Committed on 25/08/2022 at 08:59.
Pushed by apol into branch 'master'.

flatpak: Get the version from the appstream file we are fed

flatpak_installed_ref_get_appdata_version will give us the installed
version.

M  +2    -3    libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
M  +5    -0    libdiscover/backends/FlatpakBackend/FlatpakResource.h

https://invent.kde.org/plasma/discover/commit/84624c868c3090e70e15ca9d5686b9f04828d0be
Comment 6 Patrick Silva 2023-01-30 13:11:43 UTC
Can reproduce again. A few minutes ago I updated mpv 0.35 from flathub to version 0.35.1 and the Update page of Discover
said 'Refresh of version 0.35' instead of 'Update to version 0.35.1'.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Graphics Platform: Wayland
Comment 7 Nate Graham 2023-02-02 21:06:24 UTC
Was just re-fixed, too. :) See https://invent.kde.org/plasma/discover/-/commit/2a7125cbb643daf57beff53fba70d75a86d66c05
Comment 8 Patrick Silva 2023-02-17 12:51:58 UTC
It's still happening on neon unstable.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.27.80
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Graphics Platform: Wayland
Comment 9 Nate Graham 2023-02-17 19:33:38 UTC
Screenshot?
Comment 10 Patrick Silva 2023-02-27 13:01:25 UTC
Created attachment 156785 [details]
screenshot before updating
Comment 11 Patrick Silva 2023-02-27 13:02:27 UTC
Created attachment 156786 [details]
screenshot after updating
Comment 12 Nate Graham 2023-02-27 17:19:08 UTC
Can also reproduce. :/
Comment 13 Nate Graham 2023-03-26 00:30:19 UTC
Created attachment 157581 [details]
Version numbers reversed

Saw it recently; see attached screenshot. What I'm seeing is that *sometimes* it will say "Refresh of version X", and sometimes it will say "Version X -> version X-1".

It seems like two different wrong things are happening. In the first scenario, the "old" and "new" versions are both set to the same thing. In the second one, their order ire reversed.
Comment 14 Ismael Asensio 2023-04-08 23:02:03 UTC
Git commit 8859aa1c64442a5165e17e94df455f2162a0cb38 by Ismael Asensio, on behalf of l10n daemon script.
Committed on 08/04/2023 at 16:49.
Pushed by iasensio into branch 'master'.

flatpak: Report latest available version

It is not guaranteed that the release list returned by AppStream
will be ordered, so let's check for the latest one to avoid showing
an older version number on the updates page.
Related: bug 465864
FiXED-IN: 5.27

M  +7    -1    libdiscover/backends/FlatpakBackend/FlatpakResource.cpp

https://invent.kde.org/plasma/discover/commit/8859aa1c64442a5165e17e94df455f2162a0cb38
Comment 15 Nate Graham 2023-04-09 14:40:02 UTC
Git commit f68e0d42c001f9716550e062f9e55213aac92d28 by Nate Graham, on behalf of l10n daemon script.
Committed on 09/04/2023 at 14:37.
Pushed by ngraham into branch 'Plasma/5.27'.

flatpak: Report latest available version

It is not guaranteed that the release list returned by AppStream
will be ordered, so let's check for the latest one to avoid showing
an older version number on the updates page.
Related: bug 465864
FiXED-IN: 5.27


(cherry picked from commit 8859aa1c64442a5165e17e94df455f2162a0cb38)

M  +7    -1    libdiscover/backends/FlatpakBackend/FlatpakResource.cpp

https://invent.kde.org/plasma/discover/commit/f68e0d42c001f9716550e062f9e55213aac92d28
Comment 16 Nate Graham 2023-05-14 23:37:18 UTC
Fixed again even harder with https://invent.kde.org/plasma/discover/-/commit/7b5cc5afa74b4c217a6643ef1cf395676fb25518 by Aleix Pol Gonzales for Plasma 5.27.6.
Comment 17 Nate Graham 2023-05-14 23:37:33 UTC
*** Bug 469296 has been marked as a duplicate of this bug. ***
Comment 18 Ismael Asensio 2023-06-09 23:30:35 UTC
Git commit b03673bc3d317032f41d7153a36a7ede51b5d2d0 by Ismael Asensio.
Committed on 09/06/2023 at 23:26.
Pushed by iasensio into branch 'master'.

FlatpakBackend: Update appstream cache before initializing

We were launching the job to update the appstream cache after
initializing the backend. As a result, the updated versions
were not used until the next launch of discover.

This should finally fix the version numbers shown for flatpaks
on the Updates page

M  +2    -5    libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp

https://invent.kde.org/plasma/discover/-/commit/b03673bc3d317032f41d7153a36a7ede51b5d2d0
Comment 19 Ismael Asensio 2023-06-09 23:42:27 UTC
Git commit 48f40d6e22cba9f03af3195b0acb4be2575b0793 by Ismael Asensio.
Committed on 09/06/2023 at 23:37.
Pushed by iasensio into branch 'Plasma/5.27'.

FlatpakBackend: Update appstream cache before initializing

We were launching the job to update the appstream cache after
initializing the backend. As a result, the updated versions
were not used until the next launch of discover.

This should finally fix the version numbers shown for flatpaks
on the Updates page
(cherry picked from commit b03673bc3d317032f41d7153a36a7ede51b5d2d0)

M  +2    -5    libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp

https://invent.kde.org/plasma/discover/-/commit/48f40d6e22cba9f03af3195b0acb4be2575b0793
Comment 20 Nate Graham 2023-09-21 16:08:20 UTC
*** Bug 474763 has been marked as a duplicate of this bug. ***
Comment 21 Nate Graham 2023-10-12 20:17:54 UTC
*** Bug 475497 has been marked as a duplicate of this bug. ***
Comment 22 Zach Saunders 2024-06-07 01:19:24 UTC
*** Bug 488119 has been marked as a duplicate of this bug. ***