Bug 374736

Summary: balooctl clear doesn't clear deleted files
Product: [Frameworks and Libraries] frameworks-baloo Reporter: Lukas Ba. <kdeu>
Component: balooctlAssignee: Pinak Ahuja <pinak.ahuja>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nate, simgunz
Priority: NOR    
Version: 5.29.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Lukas Ba. 2017-01-08 08:48:35 UTC
It is not possible to clear deleted files from the db, baloo returns the error:
"Could not stat file"

This is because of line 243 in main.cpp, where non-existing files are skipped.

We should be happy that we found a wrong record referring to a non-existing file in our db of files, and remove the wrong file record instead.

https://github.com/KDE/baloo/compare/master...vitamins:patch-1

I haven't compiled this, but it's only deleting 4 lines, so i'm positive.
Comment 1 Lukas Ba. 2017-01-08 11:59:37 UTC
Hmm it's not that simple, since the next check also fails if id is 0, and we seem to need the id to remove the record, but it is 0 for non-existing files.

tr.removeDocument(id)

Can we remove using only the url instead?
Comment 2 Lukas Ba. 2017-01-13 10:24:40 UTC
Clearing an existing file which is in an indexed path is also problematic, since it will get added back later on automatically, reverting the clear action.
Comment 3 Lukas Ba. 2017-02-03 14:41:20 UTC
Still happening in version 5.30.
Comment 4 Lukas Ba. 2017-02-19 22:24:21 UTC
Still happening in version 5.31.0-1.
Can someone at least confirm this bug?
Comment 5 Nate Graham 2017-10-27 20:16:52 UTC
Definitely confirmed, though I'm marking this as a duplicate of an older bug where the same thing was reported.

Lukas, can you add your findings to https://bugs.kde.org/show_bug.cgi?id=353874?

If you're still interested in poking at this code, I encourage you to submit a patch to https://phabricator.kde.org/!

*** This bug has been marked as a duplicate of bug 353874 ***