Bug 407530 - Impossible to delele tags while baloo indexes files
Summary: Impossible to delele tags while baloo indexes files
Status: CONFIRMED
Alias: None
Product: baloo-widgets
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: baloo-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-14 15:59 UTC by Patrick Silva
Modified: 2021-07-23 20:55 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
screen recording (1.04 MB, video/webm)
2019-05-14 15:59 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2019-05-14 15:59:51 UTC
Created attachment 120063 [details]
screen recording

SUMMARY
Baloo was disabled on my system. I ran "balooctl enable", immediately I created a new
tag. While baloo was indexing files, I tried to delete the newly created tag together another tag that already was present on my system before I enable baloo. The attached screen recording shows what happened when I tried to delete the tags while baloo was indexing files.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.15.5
KDE Frameworks Version: 5.58.0
Qt Version: 5.13.0 beta3
Comment 1 Patrick Silva 2019-11-28 14:25:46 UTC
Currently we apparently can delete tags while baloo indexes files.
But all them are back after Dolphin to be restarted.

Operating System: Arch Linux 
KDE Plasma Version: 5.17.3
KDE Frameworks Version: 5.64.0
Qt Version: 5.13.2
Comment 2 tagwerk19 2021-07-20 08:30:19 UTC
(In reply to Patrick Silva from comment #1)
> Currently we apparently can delete tags while baloo indexes files.
> But all them are back after Dolphin to be restarted.
Are the tags removed "on disc" and baloo (and dolphin) are having to catch up or has the delete action not worked?

My understanding of the process (from observation) is:

Dolphin is showing a cached view of tagged files, derived from baloo

    ... It would be nice to know how to get this list of "indexed tags"
    from the command line. 

The tags exist "at source" in extended attributes on disc (you can see them for a particular file with "getfattr -d filename")

When you delete a tag, dolphin finds all the files that include that tag and updates the extended attributes for each file in turn to remove it. I think it also immediately "drops" that tag from the display; say that it is "hoping" that the remove will be successful.

You should be able to check that the tag has gone "at source" with getfattr...

In the mean time, baloo will have been told of the changes via iNotify and know that it has to update its index. When this has gone "full circle" the tags have gone at source, the index no longer includes them, the cacheing tags.so processes have caught up with the change and they have "really gone" from Dolphin

If baloo is busy, the job of reindexing the extended attributes is "in the queue" and the tags folders will only disappear when the reindexing is done (I see this behaviour in Neon Testing, so flagging as "Confirmed")

If you look at:

    balooshow -x filename

you should see whether baloo still has the tags listed as "XAttr Terms:" (and the Ctime, or the time the file properties were changed - as far as baloo knows).

It's possible that things can go wrong.

    If you have read-only files that have tags, dolphin will not be able
    to remove the tags "on disc" (but it seemingly does not give an error)

    If "too much is happening" and baloo does not pick up the changes (there
    is an iNotify limit of "max_queued_events") then  "balooctl check"
    prompts baloo to go back and check for changes (see Bug 353874)
Comment 3 Patrick Silva 2021-07-20 11:34:54 UTC
On neon unstable, the behavior seen in my screen recording occurs when
I try to delete tags while baloo indexes files, and the behavior mentioned
in comment 1 occurs when I try to delete tags while baloo is enabled but
indexing is not in progress.

After deleting a tag (regardless indexing is in progress at the moment or not),
getfattr -d <filename> command shows no output.


Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.22.80
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.3
Graphics Platform: Wayland
Comment 4 tagwerk19 2021-07-20 20:27:03 UTC
(In reply to Patrick Silva from comment #3)
> ... and the behavior mentioned
> in comment 1 occurs when I try to delete tags while baloo is enabled but
> indexing is not in progress ...
Hmmm. So maybe there's a file "stuck somewhere" that still has the tag or that baloo has a "stuck record" of the tag on a file that no longer exists.

If you are indexing your $HOME, try searching through all the extended attributes. Something like:

    getfattr -Rd ~ | grep -B1 test

(not sure, you were using "test" and "teste" tags?).

For the "stuck record", see what baloosearch returns:

    baloosearch 'tags:/test$'
    baloosearch 'tags:/teste$'

There's a chance you've tagged a file and moved it to the wastebasket... I think it's worth a look...
Comment 5 tagwerk19 2021-07-21 07:32:22 UTC
I'm able to replicate this with files that have been moved to the wastebasket. There may also be a second issue lurking here but I'm having trouble pinning it down.

    Configure baloo indexing to include hidden files

    Create testfile.txt

    Assign a tag to it; "mytag"

    Confirm, with "getfattr -d testfile.txt", that the tag has been added.

    Make sure, with "getfattr -Rd ~ | grep -B1 mytag", that it's not
    been used elsewhere.

    Confirm, with "baloosearch tags:/mytag/", that it has been indexed.

    Soft delete the file in Dolphin.

    Check, with "baloosearch tags:/mytag/", that it has been moved
    to .local/share/Trash

    Move to the "All Tags" list of tags in Dolphin and delete the
   "mytag" folder.

    Refresh the Dolphin display with an F5, the "mytag" folder reappears.

    Clear the Wastebasket - "baloosearch tags:/mytag/" still sees the
    files and an F5 on dolphin shows the tag folders

It's possible to manually clear the entry in the baloo index with:

    balooctl clear ~/.local/share/Trash/files/testfile.txt
Comment 6 Patrick Silva 2021-07-22 11:58:48 UTC
(In reply to tagwerk19 from comment #4)
> (In reply to Patrick Silva from comment #3)
> > ... and the behavior mentioned
> > in comment 1 occurs when I try to delete tags while baloo is enabled but
> > indexing is not in progress ...
> Hmmm. So maybe there's a file "stuck somewhere" that still has the tag or
> that baloo has a "stuck record" of the tag on a file that no longer exists.
> 
> If you are indexing your $HOME, try searching through all the extended
> attributes. Something like:
> 
>     getfattr -Rd ~ | grep -B1 test
> 
> (not sure, you were using "test" and "teste" tags?).
> 
> For the "stuck record", see what baloosearch returns:
> 
>     baloosearch 'tags:/test$'
>     baloosearch 'tags:/teste$'
> 
> There's a chance you've tagged a file and moved it to the wastebasket... I
> think it's worth a look...

wastebasket was not involved in my steps/tests.

Currently I'm unable to reproduce the behavior mentioned in comment 1.
A tag deleted while baloo is enabled but indexing is not in progress no longer reappears after restarting Dolphin. However, newly created tag does not appear
immediately in Places panel. I need to restart Dolphin.
Comment 7 tagwerk19 2021-07-22 13:52:52 UTC
(In reply to Patrick Silva from comment #6)
> Currently I'm unable to reproduce the behavior mentioned in comment 1.
> A tag deleted while baloo is enabled but indexing is not in progress no
> longer reappears after restarting Dolphin.
In that case, have to wait until it reappears...

We can say that it's possible to create a "stuck record"; there may be different ways of doing it. I'd suggest the troubleshooting steps to try when it does reappear are the "baloosearch tags:/whatevertag/", looking at the listed files and trying a "balooctl clear filename" for files that don't exist on the filesystem...

> ... However, newly created tag does not appear
> immediately in Places panel. I need to restart Dolphin ...
I've noticed this, it does seem to be something that takes a while.
Comment 8 Patrick Silva 2021-07-23 20:25:20 UTC
(In reply to tagwerk19 from comment #7)
> (In reply to Patrick Silva from comment #6)
> > Currently I'm unable to reproduce the behavior mentioned in comment 1.
> > A tag deleted while baloo is enabled but indexing is not in progress no
> > longer reappears after restarting Dolphin.
> In that case, have to wait until it reappears...
> 
I waited ~5 minutes and the deleted tag did not reappear.
Comment 9 tagwerk19 2021-07-23 20:55:47 UTC
(In reply to Patrick Silva from comment #8)
> I waited ~5 minutes and the deleted tag did not reappear.
*Chuckle*

I was meaning more that at some time in the future you'll trip over the bug again, probably when you are not expecting it, and we can have another go at tracking it down.