Bug 287593

Summary: "Customize index folders" must handle symlinks specially, as Nepomuk/Strigi doesn't index them
Product: nepomuk Reporter: skierpage <skierpage>
Component: kcmAssignee: Nepomuk Bugs Coordination <nepomuk-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: cfeck, CisBug, me, trueg, _kfj
Priority: NOR    
Version: 4.7   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description skierpage 2011-11-26 09:32:15 UTC
Version:           1.0 (using KDE 4.7.2) 
OS:                Linux

It seems Nepomuk+Strigi will not index a symbolic link to a directory: Nepomuk::IndexScheduler::analyzeDir tests fileInfo.isDir() && !fileInfo.isSymLink().

But System Settings > Desktop Search > Desktop index folders > Customize index folders… > Strigi Index Folders doesn't reflect this limitation. It will let you select (checkmark) a symbolic link to a folder, expand it, select and unselect its subdirectories, etc. But the contents will not be indexed.

Reproducible: Always

Steps to Reproduce:
1. Create a directory outside your home directory, e.g. /tmp/index_this and fill it with files and folders of stuff you want indexed.
2. Create a symlink to it in your home directory, e.g. ln -s /tmp/index_this ~/find_me.
3. In System Settings > Desktop Search > Desktop index folders > Customize index folders… > Strigi Index Folders , navigate to /home/$USER/find_me.

Actual Results:  
You can select/unselect the symlinked folder and its subdirectories and there is no indication that it's a symlink.

However, Dolphin will not be able to find content in ~/find_me, even when it and its subdirectories are checked.

Expected Results:  
System Settings’ Customize index folders… (nepomuk/kcm/folderselectionmodel.cpp ) should:
a) Disallow checkmarks on symlinks.
b) Display symlinks in italics as Dolphin does.
c) Have a tooltip “This is a symbolic link, and is not followed by the index. Instead select the target of the symbolic link if you want it to be indexed.”
d) Disallow expanding subfolders of symlinks; instead maybe if you click on a symlink you jump to their target of the symlink in the directory tree.

I guess never indexing symlinked directories is reasonable behavior, though if you've set up symlinks in your home directory to things you want indexed it means you have to find the actual paths to them.
Comment 1 Sebastian Trueg 2011-11-30 14:25:02 UTC
To me this is a Nepomuk bug. IMHO symlinks to folders should in fact be followed as it is what most users would expect. The only reason it has been disabled is the fear of endless nesting.
Comment 2 skierpage 2011-12-01 23:18:03 UTC
Maybe Nepomuk handling symlinks should be tracked in bug 208602?

Problem is, until symlink handling changes, the current behavior of Customize index folders… > Strigi Index Folder is actively harmful: users can spend time selecting and unselecting folders that will never be indexed.

Displaying symlinks in italics (as Dolphin does) would be a useful improvement regardless of how Nepomuk actually handles them.

I don't have rights to set this to NEW and make it depend on bug 20802, can you? And thanks for all you do!
Comment 3 CisBug 2011-12-30 12:23:11 UTC
I agree, system settings dialog needs to handle symlinks different, and should not show a tooltip "this folder will be indexed".

There is a workaround existing, as long as this nepomuk bug is not fixed. Instead of using symlinks, the folder can be linked to the desired position using "mount --bind src dest" command, and then will be indexed.
Comment 4 Vishesh Handa 2012-12-30 13:49:29 UTC
Git commit 6f4906d8c59e6b27da8ee10b0542f43bd725406f by Vishesh Handa.
Committed on 30/12/2012 at 14:42.
Pushed by vhanda into branch 'KDE/4.10'.

Nepomuk KCM: Do not show system links in the list of directories

Considering that Nepomuk does not follow system links, it does not make
sense for them to be shown in the list of directories. Ideally, one
should show them differently and not allow them to be checked, but that
would require a lot more work.

This is more of a temporary fix.

M  +6    -2    nepomuk/kcm/folderselectionmodel.cpp

http://commits.kde.org/kde-runtime/6f4906d8c59e6b27da8ee10b0542f43bd725406f
Comment 5 Vishesh Handa 2012-12-30 13:51:09 UTC
Marking this bug as "REOPENED" as the commit does not really fix the issue. It just hides the system links. This was a temporary fix for rc2. I hope I get the time to implement it properly.
Comment 6 Christoph Feck 2012-12-30 15:01:37 UTC
Just to clarify: A "symlink" is a "symbolic link", which is different from a hard link in that it allows any path to be followed, instead of referencing a specific filesystem inode. There is nothing that makes them part of the "system", every user can create those for his files.

To me, "system" refers to /dev, /proc, /run, /sys etc.
Comment 7 Gabriel Poesia 2013-01-03 18:33:13 UTC
Git commit 4008739bff2413f2ff77bf4a5f4aecc08fa99067 by Gabriel Poesia.
Committed on 31/12/2012 at 22:13.
Pushed by poesia into branch 'master'.

Nepomuk KCM: Show symlinks in "Customize Folders" as disabled items

Nepomuk currently does not follow symlinks when indexing. When marking
folders to be indexed in the KCM ("Indexing" tab, "Customize Folders"
button), the user now sees the symbolic links are there, but is not
allowed to mark one for indexing, nor its children. Symbolic links
were hidden before this.
REVIEW: 108056

M  +26   -4    nepomuk/kcm/folderselectionmodel.cpp
M  +5    -0    nepomuk/kcm/folderselectionmodel.h

http://commits.kde.org/kde-runtime/4008739bff2413f2ff77bf4a5f4aecc08fa99067
Comment 8 _kfj 2014-04-22 20:55:00 UTC
Maybe this bug has resurfaced?

I could not get Dolphin file search to work at all in trusty. After fiddling about and futilely searching for a long time, I noticed I could get it to work when searching off folders I navigated to directly from their mount point without an intervening symlink.

My home partition is just a slim thing on an SDD containing .xxx files and folders - and symlinks to my data which live on a fat HDD, mounted at /space. So when going via my usual path (/home/<symlink to somewhere>/...) in Dolphin, it wouldn't find anything there. If I went from the HDD's mount point (/space/somewhere/...) it would work as before (12.04)

This is silly. I feel the issue is not resolved. It sould not matter whether I have navigated to a specific location via a symlink or a 'straight path'.
Comment 9 Christoph Feck 2014-04-22 21:08:23 UTC
See bug 333678. If you believe it is a different issue, please report a new bug for product "Baloo" here. Since the desktop search has been mostly rewritten, it is possible that there are still some regressions compared to the old Nepomuk implementation.