You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Yes, I know it looks like copy of #459 but it is actually a bit different problem):
I set-up notify for given directory (recursively) using PollSystem (every 1 second)
Now, if I remove directory completely, PollSystem will correctly report that all files inside (and the directory itself) were removed
If I re-create directory during the same session, PollSystem will correctly report that new files/directories were added
But! If I run exactly the same PollSystem for non-existing directory, it will return error and not install a watch whatsoever (even if the directory is set to be created one second later).
This is inconsistent behavior in my opinion - removing and re-creating directory for existing notifier is completely OK operation but watching non-existing and then re-created directory fails at initialization
The text was updated successfully, but these errors were encountered:
The problem here is that pollwatcher just accidentally reports this, as it just checks periodically for paths. You could say this is undefined behaviour in the wild.
Let's see what is happening globally: For inotify we tell the kernel to report us changes per inode, for windows we get changes recursively for a whole folder.
If you would try to do the same here, you would get an error, as inotify can't report anything for non existing inodes, and windows won't work the same. You would have to watch the parent folder. Now one could change this to watch the parent folder of a path, if it doesn't exist. But that is kind of a chicken / egg problem: When do we error out ? After recursing to / and still failing to watch it ? And we would have to conceal that we're actually getting events for much more than the intended path. Which for linux isn't free, as we'll eventually reach the inotify limits based on watched inodes.
If we would change pollwatcher to allow watching a non existent path, it would be inconsistent with the other backends. And thus any code using the recommended backend may fail the moment the OS leads to a change from the pollwatcher to any other backend by chance.
(Yes, I know it looks like copy of #459 but it is actually a bit different problem):
But! If I run exactly the same PollSystem for non-existing directory, it will return error and not install a watch whatsoever (even if the directory is set to be created one second later).
This is inconsistent behavior in my opinion - removing and re-creating directory for existing notifier is completely OK operation but watching non-existing and then re-created directory fails at initialization
The text was updated successfully, but these errors were encountered: