Bug 316016 - KDirLister does not notice the deletion of a directory that is being watched by KDirWatch
Summary: KDirLister does not notice the deletion of a directory that is being watched ...
Alias: None
Product: kio
Classification: Unclassified
Component: general (show other bugs)
Version: 4.10.0
Platform: Compiled Sources Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: David Faure
Keywords: reproducible
Depends on:
Reported: 2013-03-02 15:57 UTC by Frank Reininghaus
Modified: 2013-03-14 14:19 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 4.10.2

Unit test (2.21 KB, patch)
2013-03-02 15:57 UTC, Frank Reininghaus

Note You need to log in before you can comment on or make changes to this bug.
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:

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