WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Can't remove and re-create files that are being watched by inotify

Open saschagehlich opened this issue 9 years ago • 6 comments

  • A brief description

When watching a file using inotify (in my case using node.js' fs.watch function), I can't re-create the file after deleting it (either permission denied or no such file or directory)

  • Actual results (with terminal output if applicable)
$ echo > file
$ node -p "require('fs').watch('file')" &
[1] 18962
FSWatcher {
  domain: null,
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  _handle: FSEvent { owner: [Circular], onchange: [Function] } }

$ rm file
$ echo > file
zsh: no such file or directory: file
$ echo $?
1
$ kill 18962
[1]  + 18962 terminated  node -p "require('fs').watch('file')"
$ echo > file
$ echo $?
0
  • Your Windows build number 14986

  • Strace of the failing command Here's a trace of vim trying to write to the watched file:

write(1, "\"file\"", 6"file")                 = 6
stat("file", 0x7fffe3fe2080)            = -1 ENOENT (No such file or directory)
open("file", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
lstat("file", 0x7fffe3fe21a0)           = -1 ENOENT (No such file or directory)
  • Required packages and commands to install Install node.js

saschagehlich avatar Dec 23 '16 11:12 saschagehlich

@saschagehlich - are you using a DrvFs path (/mnt/c/...) or a different location?

@JasonLinMS could you please have a look?

benhillis avatar Dec 27 '16 16:12 benhillis

Thanks Ben. @saschagehlich Please let us know and we will investigate.

JasonLinMS avatar Dec 28 '16 05:12 JasonLinMS

@benhillis @JasonLinMS This only seems to happen on DrvFs paths

saschagehlich avatar Dec 29 '16 23:12 saschagehlich

@benhillis Is this being worked on? I'm running into this very often when switching git branches while my build system is watching for changes :(

saschagehlich avatar Jan 16 '17 14:01 saschagehlich

@saschagehlich I can repro this and will start investigating, sorry for the delay!

JasonLinMS avatar Jan 18 '17 01:01 JasonLinMS

Marking as a duplicate of #966, we are looking at a fix for this issue.

JasonLinMS avatar Mar 30 '17 18:03 JasonLinMS