<table><tr><td style="">poboiko added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D16878">View Revision</a></tr></table><br /><div><div><p>I believe can do something better here. <br />
I think if we stick to canonical paths everywhere, and resolve symlinks ASAP (but still follow them), that might solve all the problems.</p>

<blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D16878#359864" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D16878#359864</a>, <a href="https://phabricator.kde.org/p/bruns/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@bruns</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>Because it can never be consistent.<br />
 What happens when I create two symlinks to the same folder, and put one link into includeFolders, the other one in excludeFolders?</p></div>
</blockquote>

<p>Here the behavior would be the same as if user just add the same folder to both lists. Not quite sure how it works now (I guess, one of two rules will just pop first). <br />
But here the undefined behavior would be acceptable, because it seems like user tried to shoot his leg intentionally :)</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>What really should happen, the indexer should <strong>never</strong> follow symlinks, but only add files by their canonical path. This avoids a bunch of problems, symlink loops, nondeterministic pathes for files when these are added to the index, ...</p></blockquote>

<p>As for symlink loops, <tt style="background: #ebebeb; font-size: 13px;">QDirIterator</tt> with <tt style="background: #ebebeb; font-size: 13px;">FollowSymlinks</tt> seems to be able to handle this nicely (at least according to Qt docs).<br />
As for nondeterministic pathes - just add canonical path, and that's it.</p>

<p>The only problem I see here is that if we try <tt style="background: #ebebeb; font-size: 13px;">baloosearch -d folder/</tt> and inside there will be symlink <tt style="background: #ebebeb; font-size: 13px;">folder/subfolder -> /somewhere/else</tt>, we won't find any results inside <tt style="background: #ebebeb; font-size: 13px;">subfolder</tt>. <br />
This is less trivial, to work with it we need to store the whole FS graph (which is not tree anymore) with symlinks. But for now we can live without it, I suppose.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R293 Baloo</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D16878">https://phabricator.kde.org/D16878</a></div></div><br /><div><strong>To: </strong>poboiko, Frameworks, Baloo<br /><strong>Cc: </strong>bruns, kde-frameworks-devel, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams<br /></div>