Time flies, sorry for the delay. On samedi 12 septembre 2020 19:44:45 CET Albert Astals Cid wrote: > flatpak mounts all files as if created on January 1st 1970.
Isn't that a bug in itself? Why doesn't it preserve mtimes? > This has the unfortunate effect that when we add new plugins to a flatpak > (i.e. we just added markdown preview support in kate), they are not seen > because ksycoca doesn't feel the need to regenerate itself (the sycoca file > for flatpak is written "outside" flatpak container and thus has a newer > date). > > I remember talking about this probably a year ago at least with Aleix, but i > guess we did not come up with any solution since it's still broken :D > > I don't know much about sycoca, but can we make it so the cache always get > regenerated on app launch when run under flatpak? Is there no way to manually "touch" a directory after adding new files? Otherwise, the hack you have in mind could be implemented as in the attached patch. Untested, except that it compiles. -- David Faure, fa...@kde.org, http://www.davidfaure.fr Working on KDE Frameworks 5
diff --git i/src/sycoca/ksycoca.cpp w/src/sycoca/ksycoca.cpp index 665d8287d4..6f0159ef3f 100644 --- i/src/sycoca/ksycoca.cpp +++ w/src/sycoca/ksycoca.cpp @@ -228,6 +228,19 @@ bool KSycocaPrivate::openDatabase() bool result = true; if (!m_databasePath.isEmpty()) { + // BEGIN flatpak hack + static bool firstTime = true; + if (firstTime) { + firstTime = false; + if (QFileInfo::exists(QStringLiteral("/.flatpak-info"))) { + // We're running inside flatpak, which sets all times to 1970 + // So the first very time, don't use an existing database, recreate it + qCDebug(SYCOCA) << "flatpak detected, ignoring" << m_databasePath; + return false; + } + } + // END flatpak hack + qCDebug(SYCOCA) << "Opening ksycoca from" << m_databasePath; m_dbLastModified = QFileInfo(m_databasePath).lastModified(); result = checkVersion();