Bug 389692

Summary: Changes in xattr metadara (rating, tags, etc) do not appear immediately. Auto-refresh is needed.
Product: [Applications] dolphin Reporter: funkybomber
Component: searchAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: bugseforuns, faure, justin.zobel, kde, meven29, postix, serg, stefan.bruens, tagwerk19
Priority: NOR    
Version: 17.12.1   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=401019
https://bugs.kde.org/show_bug.cgi?id=244163
https://bugs.kde.org/show_bug.cgi?id=387663
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: First example
Second example

Description funkybomber 2018-01-31 14:18:13 UTC
Created attachment 110262 [details]
First example

Reproducible always.
I tested this on the latest KDE Neon Developer edition.

First example with steps to reproduce:
- Open Dolphin and navigate to the parent-folder of our target file (the file we are going to change).
- Select the file so that the "Information Panel" will appear.
- Set a rating to the file through the "Information Panel" of Dolphin
- The new rating will NOT appear immediately in the "Rating" column  <-- PROBLEM
- The new rating will appear in the "Rating" column only after a refresh (F5) occurs.

Please note that this issue applies to both files and folders. 

This issue also seems to affect the results in baloosearch. If the user changes a rating and does not refresh (F5), then the baloosearch displays the old (wrong) results.
If the user refreshes, then baloosearch shows the new (correct) results.

Second example with steps to reproduce:
- Set the "Rating" of a folder to "3"
- Open Dolphin
- Press the Find button to start a baloosearch
- Select "3 or more" from the available options
- The folder should appear in the results
- Right click on the folder and open it in a new window
- Change the rating of the folder through the "Information Panel" of Dolphin. Set it to "1". Do NOT refresh.
- Go back to the baloosearch window. The folder still appears even though we have the "3 or more" selected.  <-- PROBLEM
- Select the "1 or more" from the available options. The folder appears here.  <-- this is correct
- Select again the "3 or more" from the available options. The folder still appears here.  <-- PROBLEM

I would recommend that an auto refresh is invoked after every metadata change.
I think this could be the easiest and smartest solution.
Comment 1 funkybomber 2018-01-31 14:20:00 UTC
Created attachment 110263 [details]
Second example
Comment 2 Kai Uwe Broulik 2018-02-05 14:41:48 UTC
I hoped it was just a matter of adding a bunch of KDirNotify emissions but turns out that KCoreDirLister only emits a change if it considers the KFileItems to be different. Xattr stuff is not known to KFileItem so it never emits a change for these.
Comment 3 Justin Zobel 2020-10-27 01:09:12 UTC
(In reply to Kai Uwe Broulik from comment #2)
> I hoped it was just a matter of adding a bunch of KDirNotify emissions but
> turns out that KCoreDirLister only emits a change if it considers the
> KFileItems to be different. Xattr stuff is not known to KFileItem so it
> never emits a change for these.

Kai did you ever figure out a solution to this issue?
Comment 4 Patrick Silva 2020-10-27 13:03:47 UTC
duplicate of bug 401019 ?
Comment 5 Méven Car 2023-08-11 07:49:18 UTC
This is either a problem in baloo (that provides the xattr reading) but does listen or transmit file updates or KIO that does not provide XAttr, hence neither update them (code in kcoredirlister).
Comment 6 Serg Podtynnyi 2023-09-09 13:52:14 UTC
It might be all wrong, but some time ago I researched a little bit about  XAttr problems in Dolphin/Baloo, and my findings points that Baloo file watcher service  doesn't pick up the changes made by dolphin and don't fire `metadate` update. I attached to dbus monitor and did not saw the events for xattr changes , also it might be some inotify limitations of how many files that can be monitored by file watcher.  Definitely this can be researched more.
Comment 7 Méven Car 2023-09-09 15:29:34 UTC
(In reply to Serg Podtynnyi from comment #6)
> It might be all wrong, but some time ago I researched a little bit about 
> XAttr problems in Dolphin/Baloo, and my findings points that Baloo file
> watcher service  doesn't pick up the changes made by dolphin and don't fire
> `metadate` update. I attached to dbus monitor and did not saw the events for
> xattr changes , also it might be some inotify limitations of how many files
> that can be monitored by file watcher.  Definitely this can be researched
> more.

Baloo watches the directory it is directly configured to index (function FileWatch::watchFolder), but it does not have the capability to watch on whole filesystem ATM or watch for directory creation which would allow it to recursively set watch (it would need to use fanotify, with a dedicated daemon for instance).

KIO/KCoreDirLister does not provide Xattr but monitors all the files dolphin displays. It could be extended with some effort to support them, it does copy them already.

And to add to the knowledge, KFileMetaData has the necessary bits to read/write xattr cross-platform, it is used in baloo.

A possible workaround, would be to relay xattr changes that dolphin receives from KDirLister and the file force-index using baloo.
Not sure if currently dolphin does receive notifications when xattr changes ATM though.