| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Cross-referencing libuv/libuv#531 which is still open and has some unresolved issues. I'm not sure if this is a zero risk change. fs.realpathSync() is used by require(). If there are any discrepancies between the current implementation and realpath(3), that can cause regressions in the module loader. |
Sorry, something went wrong.
cc @bmeck who may have some insight |
Sorry, something went wrong.
|
I would say this is probably safe on *nix, but not Windows for now
On Fri, Oct 30, 2015 at 9:18 AM, Jeremiah Senkpiel <notifications@github.com
|
Sorry, something went wrong.
|
Updated realpath() and realpathSync() to use JS implementation when using Windows XP. |
Sorry, something went wrong.
Sorry, something went wrong.
|
Well, this depends on libuv/libuv#531 |
Sorry, something went wrong.
|
The libuv bits landed. I suggest this one is postponed until Windows XP is dropped so Node doesn't have to care about uv_fs_realpath not working on that platform. |
Sorry, something went wrong.
|
@saghul Ah, on the other hand, perhaps XP support being dropped should be documented first. |
Sorry, something went wrong.
|
@ChALkeR yeah, I was thinking about 6.0. It can be documented as a feature! "Removed baggage, aka Windows XP" :-P On a more serious note, master has libuv 1.8.0 now, so is probably a good time to rebase and give it a go on the CI? @jhamhader |
Sorry, something went wrong.
|
The current code sends Windows XP to the original JS implementation of realpath(). |
Sorry, something went wrong.
|
@jhamhader my undestanding is that Node 6.0 would drop XP (see #3804) so IMHO you can rely on that. |
Sorry, something went wrong.
|
Ready for CI |
Sorry, something went wrong.
Sorry, something went wrong.
|
Fixing the tests to accommodate with Windows case insensitive paths. |
Sorry, something went wrong.
|
Fixed |
Sorry, something went wrong.
Sorry, something went wrong.
|
Fixed linter errors (my bad! :\ ) Any idea why Windows 10 fails with on test-debug-no-context.js: ...
not ok 40 test-debug-no-context.js
#
# assert.js:89
# throw new assert.AssertionError({
# ^
# AssertionError: 3221225477 === 0
# at ChildProcess.<anonymous> (c:\workspace\node-test-binary-windows\RUN_SUBSET\0\VS_VERSION\vs2015\label\win10\test\parallel\test-debug-no-context.js:15:10)
# at ChildProcess.<anonymous> (c:\workspace\node-test-binary-windows\RUN_SUBSET\0\VS_VERSION\vs2015\label\win10\test\common.js:401:15)
# at emitTwo (events.js:88:13)
# at ChildProcess.emit (events.js:173:7)
# at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
|
Sorry, something went wrong.
|
No idea, sorry. There is one thing that worries me a bit: we are only using the "fast" variant when the cache is not used, which means that we have to keep 2 implementations which basically do the same, right? Was the cache added for speed? If so, would it be ok to drop it now? (that would be semver major, I guess) Thoughts @nodejs/collaborators ? |
Sorry, something went wrong.
|
3221225477 means an access violation/segfault occurred. I saw that test failure the other week but haven't been seeing it lately (and I haven't seen it happen locally in my Windows VM). I haven't looked into the cause though. |
Sorry, something went wrong.
|
@saghul honestly the call to uv_fs_realpath() is probably going to be faster that going through the complicated cache mechanism. we should do some benchmarking, and if it's not (as I suspect) then let's just dump it. EDIT: Would it not work to simply always make the call to node::RealPath() immediately? |
Sorry, something went wrong.
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.
* Buffer
* New Buffer constructors have been added
[#4682](#4682)
* Previously deprecated Buffer APIs are removed
[#5048](#5048),
[#4594](#4594)
* Improved error handling [#4514](#4514)
* Cluster
* Worker emitted as first argument in 'message' event
[#5361](#5361).
* Crypto
* Improved error handling [#3100](#3100),
[#5611](#5611)
* Simplified Certificate class bindings
[#5382](#5382)
* Improved control over FIPS mode
[#5181](#5181)
* pbkdf2 digest overloading is deprecated
[#4047](#4047)
* Dependencies
* Reintroduce shared c-ares build support
[#5775](#5775).
* V8 updated to 5.0.71.31 [#6111](#6111).
* DNS
* Add resolvePtr API to query plain DNS PTR records
[#4921](#4921).
* Domains
* Clear stack when no error handler
[#4659](#4659).
* File System
* The `fs.realpath()` and `fs.realpathSync()` methods have been updated
to use a more efficient libuv implementation. This change includes the
removal of the `cache` argument and the method can throw new errors
[#3594](#3594)
* FS apis can now accept and return paths as Buffers
[#5616](#5616).
* Error handling and type checking improvements
[#5616](#5616),
[#5590](#5590),
[#4518](#4518),
[#3917](#3917).
* fs.read's string interface is deprecated
[#4525](#4525)
* HTTP
* 'clientError' can now be used to return custom errors from an
HTTP server [#4557](#4557).
* Modules
* Current directory is now prioritized for local lookups
[#5689](#5689)
* Symbolic links are preserved when requiring modules
[#5950](#5950)
* Net
* DNS hints no longer implicitly set
[#6021](#6021).
* Improved error handling and type checking
[#5981](#5981),
[#5733](#5733),
[#2904](#2904)
* OS X
* MACOSX_DEPLOYMENT_TARGET has been bumped up to 10.7
[#6402](#6402).
* Path
* Improved type checking [#5348](#5348).
* Process
* Introduce process warnings API
[#4782](#4782).
* Throw exception when non-function passed to nextTick
[#3860](#3860).
* Readline
* Emit key info unconditionally
[#6024](#6024)
* REPL
* Assignment to `_` will emit a warning.
[#5535](#5535)
* Timers
* Fail early when callback is not a function
[#4362](#4362)
* TLS
* Rename 'clientError' to 'tlsClientError'
[#4557](#4557)
* SHA1 used for sessionIdContext
[#3866](#3866)
* TTY
* Previously deprecated setRawMode wrapper is removed
[#2528](#2528).
* Util
* Changes to Error object formatting
[#4582](#4582).
* Windows
* Windows XP and Vista are no longer supported
[#5167](#5167),
[#5167](#5167).
The following significant (semver-major) changes have been made since the
previous Node v5.0.0 release.
* Buffer
* New Buffer constructors have been added
[#4682](#4682)
* Previously deprecated Buffer APIs are removed
[#5048](#5048),
[#4594](#4594)
* Improved error handling [#4514](#4514)
* Cluster
* Worker emitted as first argument in 'message' event
[#5361](#5361).
* Crypto
* Improved error handling [#3100](#3100),
[#5611](#5611)
* Simplified Certificate class bindings
[#5382](#5382)
* Improved control over FIPS mode
[#5181](#5181)
* pbkdf2 digest overloading is deprecated
[#4047](#4047)
* Dependencies
* Reintroduce shared c-ares build support
[#5775](#5775).
* V8 updated to 5.0.71.31 [#6111](#6111).
* DNS
* Add resolvePtr API to query plain DNS PTR records
[#4921](#4921).
* Domains
* Clear stack when no error handler
[#4659](#4659).
* File System
* The `fs.realpath()` and `fs.realpathSync()` methods have been updated
to use a more efficient libuv implementation. This change includes the
removal of the `cache` argument and the method can throw new errors
[#3594](#3594)
* FS apis can now accept and return paths as Buffers
[#5616](#5616).
* Error handling and type checking improvements
[#5616](#5616),
[#5590](#5590),
[#4518](#4518),
[#3917](#3917).
* fs.read's string interface is deprecated
[#4525](#4525)
* HTTP
* 'clientError' can now be used to return custom errors from an
HTTP server [#4557](#4557).
* Modules
* Current directory is now prioritized for local lookups
[#5689](#5689)
* Symbolic links are preserved when requiring modules
[#5950](#5950)
* Net
* DNS hints no longer implicitly set
[#6021](#6021).
* Improved error handling and type checking
[#5981](#5981),
[#5733](#5733),
[#2904](#2904)
* OS X
* MACOSX_DEPLOYMENT_TARGET has been bumped up to 10.7
[#6402](#6402).
* Path
* Improved type checking [#5348](#5348).
* Process
* Introduce process warnings API
[#4782](#4782).
* Throw exception when non-function passed to nextTick
[#3860](#3860).
* Readline
* Emit key info unconditionally
[#6024](#6024)
* REPL
* Assignment to `_` will emit a warning.
[#5535](#5535)
* Timers
* Fail early when callback is not a function
[#4362](#4362)
* TLS
* Rename 'clientError' to 'tlsClientError'
[#4557](#4557)
* SHA1 used for sessionIdContext
[#3866](#3866)
* TTY
* Previously deprecated setRawMode wrapper is removed
[#2528](#2528).
* Util
* Changes to Error object formatting
[#4582](#4582).
* Windows
* Windows XP and Vista are no longer supported
[#5167](#5167),
[#5167](#5167).
|
One concern: if node's fs.realpath will start throwing on systems that lack PATH_MAX, then now we have to handle that, which is pretty inconvenient. How bad would it be to fall back to the JS implementation if libuv can't do realpath safely? |
Sorry, something went wrong.
|
Re the issue in node-glob, I consider throwing at different levels to be no big deal, and will adjust the tests accordingly. Bottom line, it'll eventually raise an error if it's following symlinks through a loop, which is the point. The important thing is that node's fs.realpath is safe, predictable, and fast. Imo, "safe, predictable, fast" is the right priority order. Removing realpath from systems that used to have it is pretty disruptive, and reduces predictability. Having a buffer overflow vuln on those systems is unsafe, so even worse. |
Sorry, something went wrong.
|
@isaacs libuv/libuv#843 makes libuv not even build on systems without PATH_MAX, fwiw. And no such platform has been found so far. |
Sorry, something went wrong.
|
it is worth mentioning that @bnoordhuis brought up some concerns, especially regarding freeBSD not having to have PATH_MAX defined There is a possibility that the commit could be reverted. |
Sorry, something went wrong.
|
I would prefer to attempt to work around edge cases rather than revert outright. The speed improvement here is actually really important to some users. (iirc that originally brought up this possibility!) |
Sorry, something went wrong.
|
@Fishrock123 You're correct that performance was how this whole thing came about. Here's the original issue posted by @joliss about issue with the Broccoli build tool because of the excessive slowness: nodejs/node-v0.x-archive#7902 (original post where I first suggested using realpath(3) where supported nodejs/node-v0.x-archive#7902 (comment)). The new performance gains are much better, but still not where they could be. Haven't had time to take an in depth look, but definitely agree with @Fishrock123 that we should take a look at fixing the issue instead of doing a full revert because of them. |
Sorry, something went wrong.
|
+1... While reverting should be an option on the table if it proves
|
Sorry, something went wrong.
fs.realpath has been optimized to utilize `uv_fs_realpath()`, a new api in libuv. The libuv api has slightly different behavior. There are two particular issues that are causing problems for glob * `ev_fs_realpath()` throwing before `fs.readdir` ELOOP * The removal of the cache In the past glob was relying on `fs.readdir` to throw when handling recursive symbolically linked directories. It is now possible that the call to libuv can throw before. The behavior is currently different on osx and linux causing the test suite to fail on all of the flavors of linux we are running in CI. This commit adds an extra check for 'ELOOP' and sets appropriately. The commit includes an extra check to make sure that `real` is truthy Without that extra check the test suite was reporting garbage data in the results. This was only happening with the async implementation. This commit has not done anything regarding the removal of the cache As long as the cache doesn't include a value called "encoding" everything will be fine. There has not been any benchmarking done on this change. ref: libuv/libuv#531 ref: nodejs/node#3594
Fixes: nodejs#5737 Fixes: nodejs#4643 Fixes: nodejs#4291 Fixes: nodejs/node-v0.x-archive#8960 Refs: nodejs#3594 PR-URL: nodejs#5994 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
| Back | FazBrowse Home | New Git URL |
If cache is not used, use the native uv_fs_realpath() which is faster
then the JS implementation by a few orders of magnitude.
See #2680