haskell-fswatch / hfsnotify

Unified Haskell interface for basic file system notifications
BSD 3-Clause "New" or "Revised" License
136 stars 40 forks source link

Add traverse path filter for Linux #112

Open gjz010 opened 5 months ago

gjz010 commented 5 months ago

Currently the implementation of FSNotify on Linux traverses through all subdirectories and call INo.addWatch (inotify_add_watch) recursively on all directories. This crashes applications when a really unwanted directory (for example, one containing broken symlinks) is scanned, and may cause performance problems.

(See https://github.com/srid/unionmount/issues/9 , where .direnv and therefore a whole nixpkgs is scanned.)

In this patch, a confPathFilter is added to WatchConfig to allow users to hold the library back from traversing down unwanted directories.