-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
doc: clarify fs.watch and inodes on linux, os x #6099
Conversation
<!--type=misc--> | ||
|
||
On Linux and OS X systems, `fs.watch` resolves the watched path to an inode. If | ||
the watched path is deleted and then created so that it has a new inode, you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nodejs/documentation is it okay to use "you"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thefourtheye It's consistent with the context, see the previous section on Availability a few lines up:
You can still use...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorangreef Yes, I am not saying its not correct. I just wanted to know what the Docs WG think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We encourage to avoid it. Redacted myself often about this too.
I'd see this as a nit, but worthwhile.
https://github.com/nodejs/docs/blob/master/STYLE-GUIDE.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I'd like to see us move away from the informal use of "you" as a best practice. It will take a while to eliminate past usage but I'd prefer not to introduce new instances of it :-)
I would link |
Thanks @stevemao, it's linked to "Linux and OS X systems" in the markdown. Do you mean that everything is fine as is? Or would you like any changes? |
the watched path is deleted and then created so that it has a new inode, you | ||
will receive an event for the delete but the watch will remain watching the | ||
original inode. You will not receive events for the new inode. This is because | ||
`fs.watch` watches the inode and not the path. This is expected behavior and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fs.watch()
LGTM when added |
LGTM with nits: you, brackets. Sorry if this was in the discussion, but does the same thing apply for BSDs too? Can be added after landing, since the writing is not exclusive about this. |
Generally LGTM but would prefer some of the nits addressed. |
|
||
<!--type=misc--> | ||
|
||
On Linux and OS X systems, `fs.watch` resolves the watched path to an inode. If |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jorangreef
I meant maybe we could link inode to http://www.linux.org/threads/intro-to-inodes.4130/ here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The link is just an example. If there is better one use that. :)
Sure, will make the suggested changes. |
@eljefedelrodeodeljefe I did not test on BSD so I am not sure if it applies (it probably does). Linux and OS X were used as examples because these notes are aimed at users coming from Windows who might not expect |
Done, with suggestions applied. |
@jorangreef fair enough, thx. LGTM then. |
+1 |
|
||
On Linux and OS X systems, `fs.watch()` resolves the watched path to an | ||
[inode][]. If the watched path is deleted and then created so that it has a new | ||
inode, an event for the delete will be emitted but the watch will remain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit... Perhaps: When a watched path is deleted and then recreated, it is assigned a new [inode][]. A notification for the deletion event will be emitted but the watch will continue on the *original* inode. Events for the new inode will not be emitted. This is expected behavior.
LGTM with a nit. |
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039
Thanks @jasnell, updated the wording. |
This should be ready to merge now? |
Yeah. I think he was just incredible busy since then with a conference and related stuff. Guess there will be around when this lands soon. Still LGTM and a friendly ping to @jasnell. |
Yep, sorry! LGTM! :-) |
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 88c35e7 |
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: nodejs#5039 PR-URL: nodejs#6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
On Linux and OS X systems, `fs.watch()` resolves the watched path to an inode. This clarifies that `fs.watch()` watches the inode and not the path. If the inode of the path subsequently changes, `fs.watch()` will continue watching the original inode and events for the path will no longer be emitted. This is expected behavior. Fixes: #5039 PR-URL: #6099 Reviewed-By: James M Snell <jasnell@gmail.com>
Hi guys, this is still happening: npm -v 3.10.10 The file.watch is triggering the change only once per file. In windows is working perfectly. Researched a lot but couldn't find a working solution. Any idea? Thanks, |
@fatonsopa That is the expected behavior. This PR just documented it properly. |
@thefourtheye Thanks. I didn't get the PR! |
Checklist
Affected core subsystem(s)
doc
Description of change
On Linux and OS X systems,
fs.watch
resolves the watched path to aninode. This clarifies that
fs.watch
watches the inode and not thepath. If the inode of the path subsequently changes,
fs.watch
willcontinue watching the original inode and events for the path will no
longer be emitted. This is expected behavior.
Fixes: #5039