Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong / duplicate events on macOS ? #272

Open
blmhemu opened this issue Nov 12, 2020 · 1 comment
Open

Wrong / duplicate events on macOS ? #272

blmhemu opened this issue Nov 12, 2020 · 1 comment

Comments

@blmhemu
Copy link

blmhemu commented Nov 12, 2020

System details

  • MacOS Mojave
  • rust 1.47.0
  • notify = "5.0.0-pre.4"

What you did (as detailed as you can)

let mut watcher: RecommendedWatcher =
        Watcher::new_immediate(|res| 
        match res {
           Ok(event) => println!("event: {:?}", event),
           Err(e) => println!("watch error: {:?}", e),
        }
    ).unwrap();
watcher.watch(".", RecursiveMode::Recursive).unwrap();
touch somefile
rm somefile

What you expected

event: Event { kind: Create(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
event: Event { kind: Remove(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }

What happened

event: Event { kind: Create(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
event: Event { kind: Create(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
event: Event { kind: Remove(File), paths: ["/Users/hbollamreddi/git/rums/somefile"], attr:tracker: None, attr:flag: None, attr:info: None, attr:source: None }
@PhotonQuantum
Copy link

It looks like a bug of FSEvent API. Many people reported this weird behavior. Sometimes multiple recent events on the same file may get merged into a single event.

ref: haskell-fswatch/hfsnotify#36

dzfrias added a commit to dzfrias/projectable that referenced this issue Apr 1, 2023
2eed10a attempts to fix this problem,
but fails to do so.

The bug is caused by an issue with the macOS fs-event API, as detailed
[here](notify-rs/notify#272).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants