dsoprea / PyInotify

An efficient and elegant inotify (Linux filesystem activity monitor) library for Python. Python 2 and 3 compatible.
GNU General Public License v2.0
245 stars 73 forks source link

Propagate superficial parameter to remove_watch_with_id #57

Closed XaF closed 4 years ago

XaF commented 6 years ago

The remove_watch method takes a superficial parameter but never used it, which made the remove_watch_with_id function set it as False by default. This fixes that behavior by propagating the parameter.

Signed-off-by: Raphaël Beamonte raphael.beamonte@gmail.com

XaF commented 6 years ago

Please note that failing tests are not related...

Elias481 commented 5 years ago

Sure it's related. Otherwise You would not get that error on Your commit normally...

It's not that You did the wrong thing, but another bug has to be fixed if You fix this bug: the superficial argument must be False for the IN_MOVED_FROM handling. A moved directory is not automatically deregistered from inotify. But to be on the safest side the case that the diretory is deleted immediately after rename/remove but before the unregister took place some additional work would be needed to not throw an error then as the delete would have already removed the watch in that case.. I assume this is a rare case, but worth noting and/or to think about. Simple solution: catch exception resulting from library call an ignore - as the library call occurs after the superficial actions the directory is already unregistered from adaptor.

Also note: as You submitted #58 separatly and after this, for this to work You would need to patch this for the correct block and also for the block that should be used for IN_DELETE normally, an patch this back in #58 to re-enable superficial for the IN_DELETE case.