pyinotify icon indicating copy to clipboard operation
pyinotify copied to clipboard

Following symlinks recursively

Open xarg opened this issue 10 years ago • 3 comments

It looks like pynotify doesn't follow symlink directories explicitly. I looked for an explanation, but couldn't find any. Is there a reason for not following symlinks?

For example this doesn't follow symlinks in the /tmp/ dir: watch_manager.add_watch('/tmp/', some_mask, rec=True)

xarg avatar Sep 15 '14 10:09 xarg

Indeed it doesn't follow symlinks recursively. If I recall correctly I didn't implement recursion on symlinks because it opened the door to other problems for instance you have to detect you haven't already iterated a directory otherwise you could be stuck in an infinite loop. Maybe I forget others problems too, but it is certainly possible to do it I think but it was more work.

seb-m avatar Sep 15 '14 10:09 seb-m

@seb-m I see. Detecting an infinite loop should be possible to do. An error could be thrown in that case before setting up the listeners.

But what event is thrown when you modify a file in /tmp/original/ and there is 1 symlink pointing to that dir. Having in mind that both the original dir and the symlink are watched what's the behaviour here?

Throwing 2 events (original path + symlinked path) or only the original?

Example:

/tmp/watched/original
/tmp/watched/sym -> /tmp/watched/original

I perform:

touch /tmp/watched/original/x.

What happens?

xarg avatar Sep 15 '14 10:09 xarg

You have to test it by yourself to be sure but I think only the event on the original path is reported.

seb-m avatar Sep 15 '14 11:09 seb-m