SUMMARY When indexing, the file indexer stops every few hours and needs to be restarted. Reviewing the logs, the problem appears to be this: ----8<---- Mar 29 23:26:33 vesho baloo_file[2071207]: ASSERT: "!url.endsWith('/')" in file [...]src/file/filewatch.cpp, line 100 ----8<---- STEPS TO REPRODUCE 1. Stop the file indexer 2. Clear the baloo database 3. Start the file indexer OBSERVED RESULT After a while the indexer stops. Running $ journalctl --user -u $(systemctl --user list-units | grep app-kcm_fileindexermonitor | awk '{print$1}') | grep ASSERT shows the assertion from the log. EXPECTED RESULT Baloo should not crash SOFTWARE/OS VERSIONS Linux/KDE Plasma: KDE Plasma Version: 5.21.80 KDE Frameworks Version: 5.81 Qt Version: 5.15.2 ADDITIONAL INFORMATION The problematic code seems to be this: ----8<---- // Directories must always end with a trailing slash '/' QString url = urlString; if (isDir) { Q_ASSERT(!url.endsWith('/')); url.append(QLatin1Char('/')); } ----8<---- which seems weird to me - wouldn't it be better to no crash the program in case the URL ends with '/', especially if you're going to tack it on anyway? Why not just say: if its a directory, add a slash if is missing, and just continue?
While I already had the source code open, maybe this simple change will be acceptable: https://invent.kde.org/frameworks/baloo/-/merge_requests/47
Git commit 96284739b4b63110113af0ba7dedfd18c4459063 by Nate Graham, on behalf of Oded Arbel. Committed on 21/04/2021 at 17:46. Pushed by ngraham into branch 'master'. Do not crash when a dir is move/delete is detected by kinotify It appears that sometimes with kinotify sends a directory move or delete event, it may be sent with a trailing slash on the path - and this causes filewatch to fire an assertion. Instead we might expect that things like that happen and just avoid tacking on the required trailing slash ourselves. M +2 -4 src/file/filewatch.cpp https://invent.kde.org/frameworks/baloo/commit/96284739b4b63110113af0ba7dedfd18c4459063
(In reply to Nate Graham from comment #2) > https://invent.kde.org/frameworks/baloo/commit/ > 96284739b4b63110113af0ba7dedfd18c4459063 If the idea is: // Directories must always end with a trailing slash '/' then I think you are probably not meaning this: if (isDir && url.endsWith(QLatin1Char('/'))) { url.append(QLatin1Char('/')); }
(In reply to tagwerk19 from comment #3) > then I think you are probably not meaning this: > > if (isDir && url.endsWith(QLatin1Char('/'))) { > url.append(QLatin1Char('/')); > } You are correct. This has also been pointed out by other people. I'm working on fixing this.
The last issue was fixed in https://invent.kde.org/frameworks/baloo/-/commit/dc04879f058dd1eab72e4bd4c80bdc1ea3c06c9b @tagwerk19, thanks for noticing.