Bug 424429 - Can't update Event Calendar with Discover
Summary: Can't update Event Calendar with Discover
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: KNewStuff Backend (show other bugs)
Version: 5.19.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL:
Keywords:
: 355011 417933 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-07-19 15:44 UTC by Bernie Innocenti
Modified: 2020-09-07 18:54 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.20


Attachments
Corrupt index file (2.15 KB, application/octet-stream)
2020-07-19 15:58 UTC, Bernie Innocenti
Details
Screenshot of Discover displaying the installation error (226.19 KB, image/png)
2020-07-19 16:16 UTC, Bernie Innocenti
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernie Innocenti 2020-07-19 15:44:24 UTC
SUMMARY

This is a longstanding bug. I updated Event Calendar by removing it and re-installing it a couple of times, but Discover is still unable to update it.


STEPS TO REPRODUCE
1. Install an older version of Event Calendar (I have v65 currently)
2. Open Discover
3. Click on "Plasma Addons" (or else search won't find anything)
4. Search for "Event Calendar" (often, search gets stuck... different bug)
5. Click on the result

OBSERVED RESULT

The version currently installed is displayed (v65 in my case).
If you click on the "Visit the app's website" link, you'll be taken to
https://store.kde.org/p/998901 , which has v68.


EXPECTED RESULT

Discover should automatically update Event Calendar to v68


SOFTWARE/OS VERSIONS
KDE Plasma Version: 5.19.80
KDE Frameworks Version: 5.73.0
Qt Version: 5.15.0

ADDITIONAL INFORMATION

Everything is built from git head, but the bug also exists in 5.19.3.
Comment 1 Bernie Innocenti 2020-07-19 15:47:43 UTC
This might be the root cause:

bernie@goreboot:~/.local/share/plasma/plasmoids% kpackagetool5 -l
kf.package: No metadata file in the package, expected it at: "/home/bernie/.local/share/plasma/plasmoids/"
kf.package: No metadata file in the package, expected it at: "/home/bernie/.local/share/plasma/plasmoids/"
Listing service types: KPackage/Generic in /home/bernie/.local/share/kpackage/generic/

bernie@goreboot:~/.local/share/plasma/plasmoids% ls -la kpluginindex.json
.rw-r--r-- bernie users 2.1 KB Mon Jul 20 00:04:17 2020   kpluginindex.json
bernie@goreboot:~/.local/share/plasma/plasmoids% file kpluginindex.json
kpluginindex.json: bzip2 compressed data, block size = 500k
Comment 2 Bernie Innocenti 2020-07-19 15:54:54 UTC
On my system, there's a f

kpackagetool5 -t Plasma/Applet --remove-index
kpackagetool5 -t Plasma/Applet --generate-index

Finally, Event Calendar v68 can be found!

So this is some form of index corruption. It has happened multiple times, on two different machines (one with Fedora and one with Arch Linux). The only thing they have in common is using XFS for the root and home partitions.
Comment 3 Bernie Innocenti 2020-07-19 15:58:15 UTC
Created attachment 130256 [details]
Corrupt index file
Comment 4 Bernie Innocenti 2020-07-19 16:06:51 UTC
After regenerating the index file, I opened plasma-discover again and launched the pending Event Calendar update.

Unfortunately, it didn't succeed. I saw an error bubble at the bottom of the Discover window that disappeared before I could take a note (it did not let me select the text).

The error looked something like:

  "plasmoid installation failed with return code 4..."

After this, Discovered remained stuck at 50% of the update, with the task "View Updates - Installing" still pending, and "Event Calendar - Installing" not yet started.

Clicking the "Cancel" button in the top-right of the window didn't do anything.

I tried to quit, and got a message "Could not close Discover, there are tasks that need to be done."

I clicked "Quit anyway", and it worked (I checked, no dangling processes).
Comment 5 Bernie Innocenti 2020-07-19 16:10:00 UTC
After reopening Discover, Event Calendar can't be updated any more.

So it seems we have... Discovered who corrupted kpluginindex.json! 😏
Comment 6 Bernie Innocenti 2020-07-19 16:16:45 UTC
Created attachment 130257 [details]
Screenshot of Discover displaying the installation error
Comment 7 Bernie Innocenti 2020-07-19 16:19:09 UTC
The attached screenshot shows this error message:

plasmoids.knsrc: An error occurred during the installation process:
The installation failed with code 4 while attempting to run the command:
kpackagetool5 --install "/tmp/eventcalendar-v68-plasma5.12.plasmoid" --type Plasma/Applet
Comment 8 Bernie Innocenti 2020-07-19 16:23:24 UTC
Ok, so this is why it fails:

bernie@goreboot:~/kde/src% kpackagetool5 --install "/tmp/eventcalendar-v68-plasma5.12.plasmoid" --type Plasma/Applet
Error: Installation of /tmp/eventcalendar-v68-plasma5.12.plasmoid failed: /home/bernie/.local/share/plasma/plasmoids/org.kde.plasma.eventcalendar already exists

I'd argue that either kpackagetool5 or Discover should try harder to recover from this condition. The error message could include the stdout/stderr output, and allow copy-pasting the command.

As things stand now, users would be stuck with a system that can no longer be updated.
Comment 9 Bernie Innocenti 2020-07-19 16:26:31 UTC
SOLVED:

  rm -rf ~/.local/share/plasma/plasmoids/org.kde.plasma.eventcalendar

After this, Discover is able to install Event Calendar.
Comment 10 Nate Graham 2020-07-23 19:21:10 UTC
Dan and Alexander, any ideas here?
Comment 11 Alexander Lohnau 2020-07-28 15:44:05 UTC
Is this issue in any way affected by https://invent.kde.org/frameworks/knewstuff/-/commit/3f38da8a70d8101d8fda586c28c4c8cd64d68daa?

I know you said it was long standing, but by bringing the kpackage support to KNS we are doing some things differently. With the old variant we failed to update, because KNS tried to install it when updating. Then kpackage was complaining about the entry being already installed.

@Dan, why do we now always use the update operation when installing a kpackage? And the KNSCore::KPackageJob::install method isn't used anywhere. Shouldn't we differentiate between update and install operations?
Comment 12 Bug Janitor Service 2020-08-31 07:40:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/236
Comment 13 Alexander Lohnau 2020-09-01 08:10:17 UTC
Git commit ce920603ea93ae4abf391d477001bb67cd429ed1 by Alexander Lohnau.
Committed on 01/09/2020 at 08:09.
Pushed by alex into branch 'master'.

Fix undetected KPackage installation

This was the last occurrence that didn't get ported/detected.
Because of that the updating did not work and uninstalling
an entry using the "Widget Explorer" did not work.
Related: bug 423055
FIXED-IN: 5.20

M  +2    -2    components/shellprivate/widgetexplorer/plasmoids.knsrc

https://invent.kde.org/plasma/plasma-workspace/commit/ce920603ea93ae4abf391d477001bb67cd429ed1
Comment 14 Alexander Lohnau 2020-09-07 18:46:06 UTC
*** Bug 417933 has been marked as a duplicate of this bug. ***
Comment 15 Alexander Lohnau 2020-09-07 18:54:20 UTC
*** Bug 355011 has been marked as a duplicate of this bug. ***