Bug 410682

Summary: Plasma Add-On Installer deletes plasmoids/ folder entirely when uninstalling a widget if the widget's folder is not present
Product: [Frameworks and Libraries] frameworks-kpackage Reporter: Konstantin L <cupn8dles>
Component: defaultAssignee: Marco Martin <notmart>
Status: RESOLVED FIXED    
Severity: critical CC: admin, alexander.lohnau, kdelibs-bugs-null, nate, sora
Priority: NOR    
Version First Reported In: 5.60.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.74
Sentry Crash Report:

Description Konstantin L 2019-08-07 04:48:14 UTC
SUMMARY

Plasma Add-On Installer deletes ~/.local/share/plasma/plasmoids/ folder entirely when uninstalling a widget if the widget's folder isn't present (i.e. it was renamed/moved/deleted manually by the user).

STEPS TO REPRODUCE

1. Open Plasma Add-On Installer (Add widgets...>Get New Widgets...>Download New Plasma Widgets). 
2. Install any widget.
3. Go to ~/.local/share/plasma/plasmoids/ folder and rename/move/delete the folder of the widget that was just installed.
3a. Create a file inside the plasmoids/ folder to see that it gets deleted later.
4. Click Uninstall in Plasma Add-On Installer.
5. Plasma Add-On Installer removes plasmoids/ folder entirely, even if it contains other widgets and any files.

OBSERVED RESULT

Plasma Add-On Installer removes plasmoids/ folder entirely, even if it contains other widgets and any files.

EXPECTED RESULT

Plasma Add-On Installer marks the widget as uninstalled and does nothing.

SOFTWARE/OS VERSIONS

Linux/KDE Plasma: Manjaro Linux 18.0.4
KDE Plasma Version: 5.16.3
KDE Frameworks Version: 5.60.0
Comment 1 Dan Leinir Turthra Jensen 2019-08-07 08:21:33 UTC
Plasmoids downloaded through KNewStuff are installed and uninstalled using kpackagetool5, which handles all the creation and removal of folders and whatnot, so i'll redirect this to a more appropriate product :)
Comment 2 Alexander Lohnau 2020-08-05 18:51:23 UTC
Confirmed, this is still an issue.
Comment 3 Bug Janitor Service 2020-08-09 08:40:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kpackage/-/merge_requests/2
Comment 4 Alexander Lohnau 2020-08-10 12:10:10 UTC
Git commit b77735be60c07d4a24a2c3c5893ae6bd1bf1303a by Alexander Lohnau.
Committed on 09/08/2020 at 08:34.
Pushed by alex into branch 'master'.

Do not delete package root if package was deleted
FIXED-IN: 5.74

M  +9    -1    src/kpackage/packagestructure.cpp
M  +2    -2    src/kpackage/private/packagejobthread.cpp

https://invent.kde.org/frameworks/kpackage/commit/b77735be60c07d4a24a2c3c5893ae6bd1bf1303a