Bug 482518 - Discover Mislabels Apps that Are no Longer on Flathub as Not Installed when they are still Installed
Summary: Discover Mislabels Apps that Are no Longer on Flathub as Not Installed when t...
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: Flatpak Backend (show other bugs)
Version: 6.0.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords: qt6
Depends on:
Blocks:
 
Reported: 2024-03-06 05:24 UTC by Dashon
Modified: 2024-04-08 14:09 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1


Attachments
Not installed, but it is. (2.38 MB, image/png)
2024-03-06 05:33 UTC, Dashon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dashon 2024-03-06 05:24:17 UTC
SUMMARY
Testing plasma 6 using arch's testing repositories.
After the nintendo's take down of the yuzu and citra emulators? The apps are no longer listed on flathub, but are still installed on my local machine. For some reason discover says they are not installed and asks me if I want to remove the left over files, but it also shows the launch button because the app is installed.

STEPS TO REPRODUCE
1. Download an app that is no longer listed on flathub. At the time of writing you can still install yuzu and citra using flatpak cli. The apps just aren't listed on flathub.
2. Once you have a delisted app installed. Open discover and go to the installed apps section.
3. Search for the delisted app from withing the installed apps section.
4. Click on the app to take you to its page.

OBSERVED RESULT
Discover says the app isn't installed and prompts you to remove its files.

EXPECTED RESULT
The app should still be listed as installed without prompting you to remove its left over files.
Furthermore the status of the flatpak repo should have no effect on installed / uninstalled status.

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS 
KDE Plasma Version: 6.0.0
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.6-zen1-2-zen (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 5800X 8-Core Processor
Memory: 62.7 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3080/PCIe/SSE2
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7C95
System Version: 1.0
Comment 1 Dashon 2024-03-06 05:33:23 UTC
Created attachment 166465 [details]
Not installed, but it is.
Comment 2 ratijas 2024-03-12 10:05:27 UTC
Can you port IDs of the removed apps? In case they are still available for installation via CLI it would be easier to test. I should check what flatpak API has to say about that, because Discover doesn't add much on top of that.
Comment 3 Dashon 2024-03-12 14:09:53 UTC
(In reply to ratijas from comment #2)
> Can you port IDs of the removed apps? In case they are still available for
> installation via CLI it would be easier to test. I should check what flatpak
> API has to say about that, because Discover doesn't add much on top of that.

What do you mean port ids? Do you simply want me to list their application id's? They were still available to be downloaded from the cli the last time I checked. They were simply delisted from the store.
Comment 4 ratijas 2024-03-12 17:23:37 UTC
I meant "post", but made a typo. I googled it and found some articles with `flatpak run org.yuzu_emu.yuzu` command, so there we have it.

So I installed it, opened Discover, and the application page is there, the images are not, and the status (the button in the top right corner) is stuck at "Loading". I can't launch or delete it there.

There is an End-of-Life flag on the package, which I've personally never seen before. This is gonna be interesting.

```
❯ flatpak info org.yuzu_emu.yuzu

yuzu Emulator Team - Nintendo Switch emulator

          ID: org.yuzu_emu.yuzu
         Ref: app/org.yuzu_emu.yuzu/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: mainline-0-1734
     License: GPL-3.0-or-later
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 251.2 MB
     Runtime: org.kde.Platform/x86_64/5.15-23.08
         Sdk: org.kde.Sdk/x86_64/5.15-23.08

      Commit: cb48bfe2bb3ffcdc42c970d67aa2050a5e03c7da74ad45409ffd17dc1dd71fdb
      Parent: 810b9c3f6b2e4b0bd0eaa99a3d1a222c01b1a3813d4ecf4ce9193d686fb1ec07
     Subject: Update yuzu-mainline.git to mainline-0-1734 (4abf1d23)
        Date: 2024-03-04 17:00:01 +0000
 End-of-life: This application is no longer maintained. See https://yuzu-emu.org/ for details.
```
Comment 5 Dashon 2024-03-12 17:37:39 UTC
Yeah, I know about the EOL messages, but I figured that one of the points of flatpak is that stuff keeps working regardless of the base system as long as the runtimes remain available. Anyways, I agree this is an interesting problem. I don't think anyone has yet had to deal with this scenario in the case of flatpaks.
Comment 6 ratijas 2024-03-12 18:28:03 UTC
Funny thing is, Discover has FlatpakEolReason.qml UI component. Yet, when it comes to finally using it, we are stuck at Loading presumably because FlatHub delisted it, so I don't even have AppStream metadata for FlatHub anymore — only the one from Arch Linux appstream-data package. I confirmed this because FlatpakResource object is never created for Flatpak version of Yuzu, and so eolReason() is never queried either. It seems we have slightly different failures (:
Comment 7 ratijas 2024-03-12 19:01:09 UTC
I think I am dealing with some leaking abstractions on my end. The InstallApplicationButton.qml component has the following property:

    readonly property bool isStateAvailable: application.state !== Discover.AbstractResource.Broken

and the button's text depend on it in a way that makes no sense:

       text: {
            if (!root.isStateAvailable) {
                return i18nc("State being fetched", "Loading…")
            }
Comment 8 ratijas 2024-03-12 20:41:44 UTC
I managed to export Yuzu as a .flatpak bundle, and after importing it back (like, via double-clicking — Open with Discover) I got the same state as you did. The bug is fully confirmed at this point.

What's even more interesting: the screenshots are gone with Arch appstream-data, but they still load fine with re-imported FlatHub package.

$ flatpak build-bundle /var/lib/flatpak/repo yuzu.flatpak org.yuzu_emu.yuzu stable
Comment 9 Dashon 2024-03-12 20:51:51 UTC
(In reply to ratijas from comment #8)
> I managed to export Yuzu as a .flatpak bundle, and after importing it back
> (like, via double-clicking — Open with Discover) I got the same state as you
> did. The bug is fully confirmed at this point.
> 
> What's even more interesting: the screenshots are gone with Arch
> appstream-data, but they still load fine with re-imported FlatHub package.
> 
> $ flatpak build-bundle /var/lib/flatpak/repo yuzu.flatpak org.yuzu_emu.yuzu
> stable

Cool. I also exported them as single bundle files as a backup, but haven't actually looked at them in discover.
Comment 10 Bug Janitor Service 2024-03-12 23:17:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/784
Comment 11 Aleix Pol 2024-04-07 18:00:28 UTC
Git commit 7baeaeaa053e3be316c69662b95747698ae08d55 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 07/04/2024 at 17:57.
Pushed by apol into branch 'master'.

flatpak: Check specifically installed files when looking up installed ones

M  +53   -0    libdiscover/backends/FlatpakBackend/FlatpakBackend.cpp
M  +1    -1    libdiscover/backends/FlatpakBackend/qml/FlatpakRemoveData.qml
M  +4    -1    libdiscover/backends/FlatpakBackend/tests/CMakeLists.txt
M  +15   -0    libdiscover/backends/FlatpakBackend/tests/FlatpakTest.cpp
M  +14   -0    libdiscover/utils.h

https://invent.kde.org/plasma/discover/-/commit/7baeaeaa053e3be316c69662b95747698ae08d55