Bug 316016

Summary: KDirLister does not notice the deletion of a directory that is being watched by KDirWatch
Product: [Frameworks and Libraries] kio Reporter: Frank Reininghaus <frank78ac>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal Keywords: reproducible
Priority: NOR    
Version: 4.10.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.2
Attachments: Unit test

Description Frank Reininghaus 2013-03-02 15:57:16 UTC
If a sub-directory is created in a listed directory and then watched by KDirWatch, KDirLister does not emit its itemsDeleted(KFileItemList) signal if this sub-directory is removed.

I'll attach a unit test in a minute.

This is noticeable in Dolphin in Details View mode: if a directory is removed using a terminal, it does not disappear from the view. The reason is that Dolphin watches all directories in the view for changes because arrows are shown next to a directory if it is not empty, and these arrows must be updated every time the "directory is empty" state changes.

Reproducible steps that trigger this issue were found in the forum:
http://forum.kde.org/viewtopic.php?f=224&t=98940&start=60#p260138

Reproducible: Always
Comment 1 Frank Reininghaus 2013-03-02 15:57:56 UTC
Created attachment 77687 [details]
Unit test
Comment 2 David Faure 2013-03-14 14:19:54 UTC
Git commit 1f6d6cfc44a909a972b974fe4b79c0ef521ddd14 by David Faure.
Committed on 14/03/2013 at 14:20.
Pushed by dfaure into branch 'KDE/4.10'.

Fix KDirWatch to emit dirty on parent dir when watched subdir is deleted

In Inotify mode, there's a special event for the case where a watched
dir is deleted ("IN_DELETESELF"). In the handling of that event, we must
still set the parent directory to dirty, in case another KDirWatch
only cares for the parent.

Excellent unit test by Frank Reininghaus, as usual -- thanks!
FIXED-IN: 4.10.2

M  +8    -0    kdecore/io/kdirwatch.cpp
M  +42   -0    kio/tests/kdirlistertest.cpp
M  +1    -0    kio/tests/kdirlistertest.h

http://commits.kde.org/kdelibs/1f6d6cfc44a909a972b974fe4b79c0ef521ddd14