aacid created this revision.
Herald added a project: Frameworks.
Herald added a subscriber: kde-frameworks-devel.
aacid requested review of this revision.

REVISION SUMMARY
  findOrCreate has some code that tries to recover broken files.
  
  That code will delete an empty file if later it looks like it should be a 
directory.
  
  The problem is that that code, was doing
  
  entry = rootDir->get(path)
  if (entry is not dir and it's 0 size) {
        rootDir->remove(entry)
        delete entry;
  }
  
  But unfortunately get() and remove() are not equally stubborn.
  
  get will try to see if the path lives in a subdir while remove only will 
remove entries in the exact dir.
  
  So it might happen that the old code did call remove() on the root dir but 
that did nothing since the entry didn't belong to the root dir.
  
  This failure would result in a double delete when the dir that actually 
contains the entry would be deleted.
  
  This patch introduces a private get that will also return which directory 
entry exactly lives on so remove succeeds and no double delete happens.

REPOSITORY
  R243 KArchive

BRANCH
  master

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

AFFECTED FILES
  src/karchive.cpp
  src/karchivedirectory.h

To: aacid
Cc: kde-frameworks-devel, michaelh, ngraham, bruns

Reply via email to