poboiko created this revision.
poboiko added reviewers: Frameworks, Baloo, bruns.
Herald added projects: Frameworks, Baloo.
Herald added a subscriber: kde-frameworks-devel.
poboiko requested review of this revision.

REVISION SUMMARY
  I've encountered weird regression. Here is the description:
  
  1. Since some time, `config->includeFolders()` contains folders with trailing 
slashes.
  2. First entry that `QDirIterator::path()` returns matches exactly its 
argument, i.e. if we feed it with path with trailing slash,
  
  it will return exactly it. All the other paths don't have trailing slashes 
though.
  
  3. Because of that, inside `UnindexedFileIndexer::run()`, when we check 
whether path has changed, we perform comparison `it.filePath() == 
tr.documentUrl(id)`,
  
  and it fails becaue `documentUrl()` always returns path without trailing 
slash.
  
  4. So we call `DocumentUrlDB::replace()`, which removes old entry and calls 
`DocumentUrlDB::put()`.
  5. Finally, for some reason, `IdTreeDB` don't want to work with paths with 
trailing slashes.
  
  So in the end of the day we get entry for `includeFolder` removed from DB. 
Which corrupts `IdTreeDB` --- it can no longer resolve paths.
  The simplest solution proposed here is to make sure our `DirIterator` always 
returns paths without trailing slash, including first call.

TEST PLAN
  It compiles. As far as I can see, it also fixes the regression.
  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.

REPOSITORY
  R293 Baloo

BRANCH
  trailingSlash

REVISION DETAIL
  https://phabricator.kde.org/D21427

AFFECTED FILES
  src/file/filtereddiriterator.cpp

To: poboiko, #frameworks, #baloo, bruns
Cc: kde-frameworks-devel, gennad, domson, ashaposhnikov, michaelh, astippich, 
spoorun, ngraham, bruns, abrahams

Reply via email to