Bug 458490

Summary: When opening a .flatpak file, Discover displays "app has installed data" message, and if you click the Delete button, it deletes the whole ~/.var folder!
Product: [Applications] Discover Reporter: dtcowbg
Component: Flatpak BackendAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: critical CC: aleixpol, bugseforuns, jgrulich, nate, travier
Priority: VHI    
Version: 5.25.4   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 5.26
Sentry Crash Report:
Attachments: screenshoot

Description dtcowbg 2022-08-29 22:09:14 UTC
Created attachment 151692 [details]
screenshoot

I have downloaded a .flatpak file (not .flatpakref file) and opened with Discover, then it prompted message "xx.xx.xx(flatpak app dns name) is not installed but it still has data present" with a button "Delete settings and user data" , if click that button then Discover will delete the ~/.var folder. I was lucky that I had regular backups of my data so I didn't suffer a huge loss.

I think the message is told me that there is already a data directory in my ~/.var/app for the opened .flatpak app, but in fact my ~/.var/app didn't have.The whole prompt and button misled me into thinking it was just deleting the data for a specific flatpak app under ~/.var/app, but then I pressed the button and realized it was deleting the entire ~/.var folder.

Fedora36 , Plasma5.25.4 , KDE framework 5.97.0 , QT 5.15.5 , Kernel 5.19.4-200.fc36.x86_64
Comment 1 Nate Graham 2022-08-30 21:27:29 UTC
Yikes. Can you point me to where I can find a .flatpak file to test this with?

In other news, your buttons look messed up because you have qt5ct installed (delete it) or you don't have the qqc2-desktop-style frameworks installed (install it).
Comment 2 Nate Graham 2022-08-30 21:28:06 UTC
.
Comment 3 Bug Janitor Service 2022-08-30 22:18:42 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/364
Comment 4 Aleix Pol 2022-08-30 23:01:35 UTC
Sent a MR to make sure this never happens, granted it should never happen that we remove information we are not meant to.

Please still send us the information Nate requested above.
Comment 5 dtcowbg 2022-08-31 04:29:46 UTC
(In reply to Nate Graham from comment #1)
> Yikes. Can you point me to where I can find a .flatpak file to test this
> with?
> 
> In other news, your buttons look messed up because you have qt5ct installed
> (delete it) or you don't have the qqc2-desktop-style frameworks installed
> (install it).

(In reply to Aleix Pol from comment #4)
> Sent a MR to make sure this never happens, granted it should never happen
> that we remove information we are not meant to.
> 
> Please still send us the information Nate requested above.

https://github.com/upscayl/upscayl/releases/tag/v1.2.0       (Upscayl-1.2.0-x86_64.flatpak   133MB )

That screenshot was took I opened Discover on gnome, on Plasma the behavior of bug still happen (In reply to Aleix Pol from comment #4)
Comment 6 Aleix Pol 2022-08-31 10:54:33 UTC
Git commit 14cc791d32c4fba6eeaaaf7c4b9d2bd4fc84ae27 by Aleix Pol Gonzalez, on behalf of Aleix Pol.
Committed on 31/08/2022 at 10:53.
Pushed by apol into branch 'master'.

flatpak: Make sure we don't uninstall what we shouldn't

M  +15   -4    libdiscover/backends/FlatpakBackend/FlatpakResource.cpp

https://invent.kde.org/plasma/discover/commit/14cc791d32c4fba6eeaaaf7c4b9d2bd4fc84ae27