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

crash on macOS (fsevent) after watching same file twice, then unwatching #131

Closed
cmyr opened this issue Nov 20, 2017 · 3 comments
Closed

Comments

@cmyr
Copy link
Contributor

cmyr commented Nov 20, 2017

The following snippet consistently crashes for me:

        let (tx, rx) = channel();
        let path = PathBuf::from("/usr/local/bin/git");
        let mut w = watcher(tx, Duration::from_secs(1)).unwrap();
        w.watch(&path, RecursiveMode::NonRecursive).unwrap();
        w.watch(&path, RecursiveMode::NonRecursive).unwrap();
        w.unwatch(&path).unwrap();
    }

I'm not sure what I should expect if attempting to explicitly watch the same file twice; it might be reasonable to either return an error from watch?

edit: I'm now wondering if this crash isn't due to modifying the underlying cfarray during iteration (here) , and ending up out of bounds.

I can put together a PR for this, but I wonder if we shouldn't also have some clearer expectations around how to behave with duplicate entries? Since this is going to be (likely) very implementation dependent, I suspect we should disallow it? I'll defer to @passcod on that.

@passcod
Copy link
Member

passcod commented Nov 21, 2017

My plan would be more to silently ignore duplicate paths. This is how it's shaping up to be in the next version. ("frontend" would never pass overlapping or duplicate paths to "backend")

@cmyr
Copy link
Contributor Author

cmyr commented Nov 21, 2017

@passcod sounds good. I expect to be making quite extensive use of this crate in xi over the next little while, and I should have some downtime in december; if you're doing a rewrite and want a hand with anything feel free to ping me.

@cmyr cmyr closed this as completed Nov 21, 2017
@passcod
Copy link
Member

passcod commented Nov 21, 2017

Thanks — If you subscribe to the discussion in #117... I might not follow that design precisely but I'll chime in there when I'm getting to it seriously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants