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

Inconsistent watcher.Add errors on different platforms #144

Open
tuxmea opened this issue May 14, 2016 · 3 comments
Open

Inconsistent watcher.Add errors on different platforms #144

tuxmea opened this issue May 14, 2016 · 3 comments
Labels
v2 Changes that are not compatible, but can possibly be done in v2

Comments

@tuxmea
Copy link

tuxmea commented May 14, 2016

on Linux watcher.Add() returns no Error.
on OS X it returns *os.PathError

@purpleidea
Copy link

This is in response to:

err = watcher.Add(current)
if err == syscall.ENOENT

On OSX this apparently doesn't trigger for file not found and generates a different event. Maybe it's just a different error code on OSX? I don't have a mac, so IDK.

@purpleidea
Copy link

(that works on GNU/Linux, btw)

@nathany nathany changed the title watcher.Add error on OS X watcher.Add error on macOS Oct 13, 2016
@arp242 arp242 added bug and removed investigate labels Jul 29, 2022
@arp242 arp242 changed the title watcher.Add error on macOS Inconsistent watcher.Add errors on different platforms Jul 30, 2022
@arp242 arp242 added v2 Changes that are not compatible, but can possibly be done in v2 bug and removed bug v2 Changes that are not compatible, but can possibly be done in v2 labels Oct 15, 2022
@arp242 arp242 added the v2 Changes that are not compatible, but can possibly be done in v2 label Jan 14, 2023
arp242 added a commit that referenced this issue Jan 14, 2023
@arp242
Copy link
Member

arp242 commented Jan 14, 2023

For a non-existent file this currently returns:

inotify    syscall.ErrNo    from unix.InotifyAddWatch()
windows    os.SyscallError  from GetFileAttributes(); always explicitly returns os.NewSyscallError()
kqueue     fs.PathError     from os.Lstat; can also fail on unix.Open() and unix.Kevent()
fen        fs.PathError     from os.Stat(); can also fail on os.ReadDir(), AssociatePath()

We can't really change this without breaking compatibility, as people probably have type assertions for this.

Have to look at changing it in v2 to fs.PathError for path errors, and os.SyscallError for errors with the underlying backend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 Changes that are not compatible, but can possibly be done in v2
Projects
None yet
Development

No branches or pull requests

4 participants