Bug 408010 - kbuildsycoca5 doesn't ever rebuild in Flatpak
Summary: kbuildsycoca5 doesn't ever rebuild in Flatpak
Status: REPORTED
Alias: None
Product: Qt/KDE Flatpak Runtime
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Flatpak Linux
: NOR normal
Target Milestone: ---
Assignee: Aleix Pol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-28 01:18 UTC by skierpage
Modified: 2023-12-20 07:33 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description skierpage 2019-05-28 01:18:53 UTC
SUMMARY
(Hi, the nightly builds of kdeapps Flatpaks are fantastically useful!)

I reported in bug 405578 about a missing importer plug-in in the Skrooge Flatpak on kdeapps, the developer fixed it (hooray!), but it remained unavailable for me despite multiple `flatpak update`s and verifying the file was built and present in my Flatpak.

I finally figured out that the ksycoca5_en_blahblah= file in $FLATPAK_SANDBOX_DIR was unchanged for months. In normal Plasma desktop it seems the KDE SYstem COnfiguration CAche gets rebuilt as needed, and I haven't had to run kbuildsycoca5 for over a year, but it seems in a KDE Flatpak it never (??) runs. This may be because the dates of files in a Flatpak are always Jan 1 1970 (see https://github.com/flathub/org.kde.okular/issues/4#issuecomment-396080001), so whatever heuristic KDE uses to rebuild its cache doesn't work in a Flatpak.

I notice that some KDE apps have worked around this by always running kbuildsycoca5, e.g. https://github.com/KDE/flatpak-kde-applications/blob/master/run_kontact.sh . Is this the right approach? Is there a better way?

STEPS TO REPRODUCE
1. Install the old Skrooge flatpak as of 2019-04-12
2. flatpak run org.kde.skrooge
3. Note File > Import > Import... is missing OFX/QFX import
4. flatpak update
5. flatpak run org.kde.skrooge
6. Note File > Import > Import... is still missing OFX/QFX import
or maybe 
a) install latest Skrooge flatpak
b) manually remove /var/lib/flatpak/app/org.kde.skrooge/x86_64/master/active/files/lib/plugins/skrooge_import_ofx.so
c) flatpak run org.kde.skrooge
d) Note File > Import > Import... is missing OFX/QFX import
e) restore the missing plug-in?
...

OBSERVED RESULT
The newly-present plugin isn't reflected in the KSycoca cache, so it's not available to the program.

EXPECTED RESULT
I'm not sure. Start using proper timestamps? Tell KDE Flatpak recipe writers how and when to trigger rebuilds?

ADDITIONAL INFORMATION

WORKAROUND:
Once you realize caching is the problem, you can force a rebuild by removing the KSycoca cache file $HOME/.var/app/<APPID>/cache/ksycoca5_en_BLAHBLAH=

I believe a better workaround is to run kbuildsycoca5 within the flatpak, e.g.
  flatpak run --command=kbuildsycoca5 org.kde.skrooge 
and I mentioned this in https://userbase.kde.org/KDE_System_Administration/Caches#Caches_and_Rebuilding_KSycoca_in_a_flatpak , corrections welcome.