Skip to content

[Windows] No events reported from symlinked subdirectories when watching recursively #629

@Bash-09

Description

@Bash-09

System details

  • OS/Platform name and version: Windows 11 23H2
  • Rust version (if building from source): rustc --version: 1.79.0
  • Notify version (or commit hash if building from git): 6.1.1

All drives involved were NTFS

This does not seem to occur on Linux, on Linux this behaves as expected.

What you did (as detailed as you can)

Minimal script to reproduce:

use std::{path::PathBuf, time::Duration};
use notify::{Config, Event, RecommendedWatcher, RecursiveMode, Watcher};

fn main() {
    let mut watcher: RecommendedWatcher = Watcher::new(
        Box::new(move |res: Result<Event, notify::Error>| match res {
            Ok(event) => {
                println!("Event: {event:?}");
            }
            Err(e) => {
                println!("Error: {e}");
            }
        }),
        Config::default().with_poll_interval(Duration::from_secs(1)),
    )
    .unwrap();

    watcher
        .watch(&PathBuf::from("."), RecursiveMode::Recursive)
        .unwrap();

    loop {}
}

Inside the project directory I created a symlink called test_dir that points to another folder, and the script began watching the project directory recursively. When creating files inside the symlinked folder, no events were reported. If the script was modified to watch the symlinked directory directly instead of the parent folder (the project folder), then it would pick up events when creating files inside the symlinked directory.

I would have expected the files being created inside the symlinked subdirectory to create events, which is what happens on Linux.

(Shown below is the above script (with some additional print statements) running, watching the current directory. The current directory contains a symlink to test_dir, where files are being created and destroyed, however no events are being printed)
1723034161

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions