rjeczalik / notify

File system event notification library on steroids.
MIT License
902 stars 128 forks source link

Add option to skip first symlink or all symlinks #170

Closed wavvs closed 3 years ago

wavvs commented 5 years ago

Motivation

On my project I need to track filesystem changes inside a container from the outside. In Linux this can be done by tracking /proc/<pid>/root path. Since we are in /proc filesystem, we have "special" symlinks.

lrwxrwxrwx   1 root root 0 Jan  7 01:51 root -> /

It points to / root, which is not host's root. Notify follows this trap and watches host's root instead of /proc/<pid>/root/... path.

My suggestions:

  1. Option to disable the ability to follow symlinks.
  2. Option (or permanent solution) to disable the ability to follow symlink on path itself, which is passed to notify.Watch()
  3. ....?

For now, I just comment out canonical function in cleanpath, but it is just temporary solution.