Bug 342224

Summary: Indexing inside a diretory fails if the directory was created in a blacklisted symlinked place then moved to a symlinked directory
Product: [Frameworks and Libraries] frameworks-baloo Reporter: Anthony Vital <anthony.vital>
Component: Baloo File DaemonAssignee: baloo-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: nate
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 5.56
Sentry Crash Report:
Attachments: baloofilerc

Description Anthony Vital 2014-12-26 15:16:53 UTC
My setup is like this:
~/videos  is a symlink to /mnt/data/videos/
~/torrent is a symlink to /mnt/data/torrent/
/mnt/data/torrent/ is blacklisted in the desktop search kcm.

Say a directory is created in ~/torrent (manually or by an application) and this directory contains a file.
So we have ~/torrent/testbaloo/file1.
Then with dolphin, I move this directory to ~/videos.

The result of this is that Baloo indexes the testbaloo directory, but not file1.
If I create new files in ~/torrent/testbaloo/, they are not indexed neither.

Reproducible: Always
Comment 1 Vishesh Handa 2015-05-20 16:04:52 UTC
Hey Anthony. System Link handling has always been a problem with Baloo. I'm trying to improve the situation for the next release.

Could you please paste the contents of the `~/.config/baloofilerc` file.
Comment 2 Anthony Vital 2015-05-20 17:53:20 UTC
Created attachment 92737 [details]
baloofilerc

Running baloo master from today:
> The result of this is that Baloo indexes the testbaloo directory, but not file1.
This now works.
> If I create new files in ~/torrent/testbaloo/, they are not indexed neither.
This still doesn't work.
Comment 3 Igor Poboiko 2019-02-15 15:42:13 UTC
Git commit 5e1add922ab2a1d6b4a2131b846c5a9d964c43a2 by Igor Poboiko.
Committed on 15/02/2019 at 15:41.
Pushed by poboiko into branch 'master'.

[baloo/KInotify] Notify if folder was moved from unwatched place

Summary:
If a folder was moved from an unwatched place, `KInotify` will receive an `EventMoveTo` event,
which doesn't have an `EventMoveFrom` counterpart, and thus it will emit only `created` signal
for the moved directory, but not its contents.
It also won't install watches for the directory (as it does in `EventCreate`).

Instead use FilteredDirIterator to emit created() signal for all the contents as well, and add inotify watches.

It should also now handle the race condition if a directory was created
and files were moved inside it before an inotify watch for this directory was installed.

Note that it's not really realted to symbolic links, one just has to move a folder from excluded place to included.

Test Plan:
Added a test case for `KInotifyTest`, similar to one described in Bug 342224.
It passes now.

Reviewers: #baloo, #frameworks, ngraham, bruns

Reviewed By: #baloo, ngraham, bruns

Subscribers: bruns, ngraham, kde-frameworks-devel, #baloo

Tags: #frameworks, #baloo

Differential Revision: https://phabricator.kde.org/D18698

M  +37   -0    autotests/unit/file/kinotifytest.cpp
M  +24   -4    src/file/kinotify.cpp
M  +8    -0    src/file/kinotify.h

https://commits.kde.org/baloo/5e1add922ab2a1d6b4a2131b846c5a9d964c43a2