Bug 417985 - Addons from KDE Store removed via KCMs are still listed as installed in respective GHNS window
Summary: Addons from KDE Store removed via KCMs are still listed as installed in respe...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-knewstuff
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Jeremy Whiting
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-21 11:36 UTC by Patrick Silva
Modified: 2020-09-02 12:30 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.74


Attachments
GHNS window listing already uninstalled icon themes as installed (246.33 KB, image/png)
2020-02-21 11:36 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2020-02-21 11:36:31 UTC
Created attachment 126255 [details]
GHNS window listing already uninstalled icon themes as installed

STEPS TO REPRODUCE
1. open system settings > Icons
2. click on "Get new icons..." button and install some icon theme
3. close "Get new icons..." windpw
4. hover over the just installed icon theme and click on its "Remove icon theme" button
3. open "Get new icons..." window and set the second dropdown on bottom to "Installed only"

OBSERVED RESULT
As we can see in the attached screenshot, icon theme already uninstalled
is still listed as installed.

EXPECTED RESULT
already uninstalled icon themes should not be listed as installed in "Get new icons..." window.

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.18.80
KDE Frameworks Version: 5.68.0
Qt Version: 5.14.1
Comment 1 Patrick Silva 2020-02-21 12:19:58 UTC
The icon themes case is just an example.
The same occurs with cursor themes and color schemes at least.
Comment 2 Alexander Lohnau 2020-07-19 18:50:07 UTC
Can confirm, if we have a look at the implementation (plasma-desktop/kcms/icons/main.cpp line 180) we see:
>auto *job = KIO::del(QUrl::fromLocalFile(theme.dir()), KIO::HideProgressInfo);
So we just delete the theme dir, but KNS does not know that the entry was deleted.
Comment 3 Dan Leinir Turthra Jensen 2020-07-20 09:55:19 UTC
This is partly what the intention of the functionality that clears the cache for KPackage things was intended to help with. I guess we probably want to actually have a setting in knsrc to enable that for things which don't use KPackage as well (see core/engine.cpp:186)
Comment 4 Alexander Lohnau 2020-07-20 16:52:16 UTC
> I guess we probably want to actually have a setting in knsrc to enable that for things which don't use KPackage as well

But that will only work for items where the downloaded location is the same as the location where the addon is installed. For instance if we use packagekit or an install script we would need to do the same as if we were going to uninstall the addon with the KNS dialog. Otherwise we can't be sure if the addon is properly removed.
Comment 5 Dan Leinir Turthra Jensen 2020-07-21 09:55:06 UTC
Sure, it wouldn't work for things where there is more knowledge required than a file disappearing, but it /would/ fix it for those situations where that's the problem. Since the former would require massive interventions throughout the stack, i feel like a smaller patch to fix a bunch of situations would be time well spent :)
Comment 6 Dan Leinir Turthra Jensen 2020-08-05 13:02:45 UTC
Just opened two relevant merge requests (as mentioned in comments above):
https://invent.kde.org/frameworks/knewstuff/-/merge_requests/23 which exposes an option to turn on the cleanup for any knsrc which wants that functionality
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/190 which uses said option to clean up icons (as described in #c0)
Comment 7 Dan Leinir Turthra Jensen 2020-08-06 08:03:35 UTC
Git commit c83c377ff82aab27172699cdc7da5d4e28d54d27 by Dan Leinir Turthra Jensen.
Committed on 06/08/2020 at 08:02.
Pushed by leinir into branch 'master'.

Add a RemoveDeadEntries option for knsrc files

If you set RemoveDeadEntries=true, entries whose installed files
have all been deleted without going through KNewStuff will be removed
from the cache. The removal will happen if, and only if, all listed
files were removed, which means that if, for example, an entry was
installed from archive, which was decompressed to yield multiple
installed files, if even one of those files remains, the entry will
remain marked as installed.

This is to help work around people deleting files from underneath
KNewStuff, which turns out to happen a lot with e.g. wallpapers and icons.

Only CCBUGing this one, as it is an imcomplete fix for the issue,
and requires intervention in the icons.knsrc file for the fix to
be applied to the issue mentioned in that bug.

M  +8    -0    src/core/engine.cpp
M  +9    -0    src/downloaddialog.h

https://invent.kde.org/frameworks/knewstuff/commit/c83c377ff82aab27172699cdc7da5d4e28d54d27
Comment 8 Dan Leinir Turthra Jensen 2020-08-06 08:05:08 UTC
Git commit 84401e094669bf9322659f4423a8d8972c9de52b by Dan Leinir Turthra Jensen.
Committed on 06/08/2020 at 08:04.
Pushed by leinir into branch 'master'.

Request that KNS cleans up its cache if there are dead entries

This requires (though not hard) the code found in
https://invent.kde.org/frameworks/knewstuff/-/merge_requests/23 and the
idea behind this is to clean up KNewStuff's knowledge of entries which
have been deleted without telling KNewStuff about it first. This is a
further step towards fixing the bug below.

M  +1    -0    kcms/icons/icons.knsrc

https://invent.kde.org/plasma/plasma-workspace/commit/84401e094669bf9322659f4423a8d8972c9de52b
Comment 9 Nate Graham 2020-08-06 13:47:29 UTC
Thank for your work on this, Dan! Good stuff.
Comment 10 Patrick Silva 2020-08-30 17:25:48 UTC
it's still reproducible.

1. open system settings > Icons
2. click on "Get new icons..." button and install some icon theme
3. close "Get new icons..." window
4. hover over the just installed icon theme, click on its "Remove icon theme" button and click on "Apply" button
5. open "Get new icons..." window and set the first dropdown on bottom to "Installed only"

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.74.0
Qt Version: 5.14.2
Comment 11 Alexander Lohnau 2020-08-30 18:29:59 UTC
Can confirm. This is because the engine is reused and the removed entries are only deleted when initializing. So we would need to do this whenever the dialog gets shown.
Comment 12 Bug Janitor Service 2020-09-02 09:59:27 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/knewstuff/-/merge_requests/48
Comment 13 Alexander Lohnau 2020-09-02 12:30:11 UTC
Git commit 7453b03a4ecce6f51de366f84e04ddadae19a68b by Alexander Lohnau.
Committed on 02/09/2020 at 12:30.
Pushed by alex into branch 'master'.

Fix cache sync issues with QtQuick dialog

The engine is reused for the QtQuick dialog, consequently
the cache gets only updated once the dialog is initialized.
Now the cache is updated if the RemoveDeadEntries option is selected
every time every time the dialog is about to show.

Also the state of the entries gets updated and with
8531bbcc
the current filter rev-alidates these entries properly.
FIXED-IN: 5.74

M  +28   -4    src/core/engine.cpp
M  +9    -0    src/core/engine.h
M  +1    -0    src/qtquick/qml/Button.qml

https://invent.kde.org/frameworks/knewstuff/commit/7453b03a4ecce6f51de366f84e04ddadae19a68b