<table><tr><td style="">poboiko created this revision.<br />poboiko added reviewers: Frameworks, Baloo, bruns.<br />Herald added projects: Frameworks, Baloo.<br />Herald added a subscriber: kde-frameworks-devel.<br />poboiko requested review of this revision.
</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/D21427">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>I've encountered weird regression. Here is the description:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">Since some time, <tt style="background: #ebebeb; font-size: 13px;">config->includeFolders()</tt> contains folders with trailing slashes.</li>
<li class="remarkup-list-item">First entry that <tt style="background: #ebebeb; font-size: 13px;">QDirIterator::path()</tt> returns matches exactly its argument, i.e. if we feed it with path with trailing slash,</li>
</ol>
<p>it will return exactly it. All the other paths don't have trailing slashes though.</p>
<ol class="remarkup-list" start="3">
<li class="remarkup-list-item">Because of that, inside <tt style="background: #ebebeb; font-size: 13px;">UnindexedFileIndexer::run()</tt>, when we check whether path has changed, we perform comparison <tt style="background: #ebebeb; font-size: 13px;">it.filePath() == tr.documentUrl(id)</tt>,</li>
</ol>
<p>and it fails becaue <tt style="background: #ebebeb; font-size: 13px;">documentUrl()</tt> always returns path without trailing slash.</p>
<ol class="remarkup-list" start="4">
<li class="remarkup-list-item">So we call <tt style="background: #ebebeb; font-size: 13px;">DocumentUrlDB::replace()</tt>, which removes old entry and calls <tt style="background: #ebebeb; font-size: 13px;">DocumentUrlDB::put()</tt>.</li>
<li class="remarkup-list-item">Finally, for some reason, <tt style="background: #ebebeb; font-size: 13px;">IdTreeDB</tt> don't want to work with paths with trailing slashes.</li>
</ol>
<p>So in the end of the day we get entry for <tt style="background: #ebebeb; font-size: 13px;">includeFolder</tt> removed from DB. Which corrupts <tt style="background: #ebebeb; font-size: 13px;">IdTreeDB</tt> --- it can no longer resolve paths.<br />
The simplest solution proposed here is to make sure our <tt style="background: #ebebeb; font-size: 13px;">DirIterator</tt> always returns paths without trailing slash, including first call.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>It compiles. As far as I can see, it also fixes the regression.<br />
Although, for some reason, this regression it's not always reproducible, so I cannot be completely sure. Would appreciate if someone else looked into it.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R293 Baloo</div></div></div><br /><div><strong>BRANCH</strong><div><div>trailingSlash</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D21427">https://phabricator.kde.org/D21427</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/file/filtereddiriterator.cpp</div></div></div><br /><div><strong>To: </strong>poboiko, Frameworks, Baloo, bruns<br /><strong>Cc: </strong>kde-frameworks-devel, gennad, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams<br /></div>