Uh oh!
There was an error while loading. Please reload this page.
fs: fix realpath{Sync} on resolving pipes/sockets - #13028
Conversation
4104b3d to
84cbd7aCompareThere was a problem hiding this comment.
Use common.isWindows and common.skip() here instead. See here for an example.
There was a problem hiding this comment.
Consider using spawnSync() instead to simplify this a bit and to make future debugging a bit easier.
84cbd7a to
1fa2c30Compareebraminio
commented
May 15, 2017
Both done. |
1fa2c30 to
dbac492Comparemscdex
commented
May 15, 2017
ebraminio
commented
May 16, 2017
This probably needs more study, both of just not following (this patch) and following to the end and raising [current] or not raising error on following symlinks to pipes/sockets should be discussed, lets close it for now. |
dbac492 to
00f1de7CompareUpdated to follow python result. |
c630b2b to
f39045aCompare@refack: Hi. Thanks for reviewing my patches. :) Does this need a documentation change also? |
ebraminio
commented
May 20, 2017
Have a look at #13130 (comment) also |
There was a problem hiding this comment.
In adition to sanity, I would consider asserting the value of resolvedPath and the returned value from require('fs').realpathSync('/dev/stdin');
Either in the script literal or console.loging it and adding another assert for stdout.
There was a problem hiding this comment.
Hmm, that resolves to different things on different runs and platforms, that is hard to check I think
There was a problem hiding this comment.
Than check it has a truthy value if (!resolvedPath) process.exit(2)
@ebraminio Yes, I would add a note to fs.md#fsrealpathpath-options-callback and Something like *Note*: If `path` resolves to a Socket or a Pipe, the function will return the value of `require('path').resolve(path)`.P.S. this might be a breaking change (a.k.a |
Or is it converted by the notes? |
e65f679 to
035b935Compareebraminio
commented
May 20, 2017
doc is done now, have a look |
There was a problem hiding this comment.
Rebase on master this comment was reverted.
035b935 to
f0146f4CompareThere was a problem hiding this comment.
BTW is my note actually correct? In that case it's easy to check in the test.
There was a problem hiding this comment.
No I've copy-pasted your comment just in rush, removed the both as I couldn't reach to anything useful for here.
There was a problem hiding this comment.
Show me some input -> output results. I'll phrase something better.
There was a problem hiding this comment.
I am not sure what it should be called, before my patch echo "" | node -e "require('fs').realpath('/dev/stdin', console.log)" was raising error but with my patch now it has a similar result with python, say /proc/12938/fd/pipe:[224961], just on Linux
There was a problem hiding this comment.
*Note*: If `path` resolves to a socket or a pipe, the function will return a system dependent name for that object.e8ed5ba to
eef07fcComparerefack
commented
May 20, 2017
refack
commented
May 21, 2017
So there are a linting error: and a fail on AIX: assert.js:92 throw new AssertionError({ ^AssertionError [ERR_ASSERTION]: 1 === 2 at Object.<anonymous> (/home/iojs/build/workspace/node-test-commit-aix/nodes/aix61-ppc64/test/parallel/test-fs-realpath-pipe.js:33:10)If you don't have a clear idea why this fails on AIX, and since this is not a regression, we could add it to |
e1ae7c5 to
9746ad1CompareDone. I don't have access to AIX but perhaps it doesn't have the concept of /dev/stdin or that somehow is different there. |
richardlau
commented
May 21, 2017
cc @nodejs/platform-aix |
mhdawson
commented
May 23, 2017
AIX does not have /dev/stdin. See the second comment in https://unix.stackexchange.com/questions/338667/unix-systems-without-dev-stdin-dev-stdout-and-dev-stderr. I also logged into the community AIX machines and there is no /dev/stdin: So although for redirection behaviour seems to be similar, the files do not actually exist in /dev. Given that the test depends on /dev/stdin, I'd suggest it just be skipped as it is for windows. |
refack
commented
May 23, 2017
@mhdawson Thanks!
I'm +1 |
9746ad1 to
d4d9120Compareebraminio
commented
May 23, 2017
Done. |
d4d9120 to
363020cComparerefack
commented
May 25, 2017
Pre land CI: https://ci.nodejs.org/job/node-test-commit/10154/ |
refack
commented
May 25, 2017
|
PR-URL: nodejs#13028 Reviewed-By: Refael Ackermann <refack@gmail.com>
refack
commented
May 25, 2017
Landed in b3d1e3d |
PR-URL: #13028 Reviewed-By: Refael Ackermann <refack@gmail.com>
MylesBorins
commented
Jul 17, 2017
The docs here claim that it is adding a new api... should this have been semver minor? |
MylesBorins
commented
Aug 14, 2017
ping |
MylesBorins
commented
Sep 19, 2017
ping @refack |
refack
commented
Sep 19, 2017
AFAICT this is $ echo""| node -e "console.log(require('fs').realpathSync('/dev/stdin'))"
Error: ENOENT: no such file or directory, lstat '/proc/180/fd/pipe:[140]'
at Object.fs.lstatSync (fs.js:961:11)
at Object.realpathSync (fs.js:1629:21)so now it returns a sane value: $ echo""| node -e "console.log(require('fs').realpathSync('/dev/stdin'))"
/proc/577/fd/pipe:[565]Documentation comment could have been "Pipe/Socket resolve support |
MylesBorins
commented
Oct 16, 2017
@refack this doesn't appear broken on v6.x right now |
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
fs
Currently
echo "" | node -e "require('fs').realpath('/dev/stdin', console.log)"and
echo "" | node -e "console.log(require('fs').realpathSync('/dev/stdin'))"are broken due to our logic of realpath and this patch changes node in a way to match python:
echo "" | python -c "import os; print(os.path.realpath('/dev/stdin'))"