| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Is the behavior of fs.exists altered if callback is not a function? It looks like fs.access throws a TypeError in that case.
Sorry, something went wrong.
There was a problem hiding this comment.
cb is a function (it's defined on the line below) and it checks that callback is truthy.
Sorry, something went wrong.
There was a problem hiding this comment.
cb is a function (it's defined on the line below) and it checks that callback is truthy.
Sorry, something went wrong.
|
I feel like we tried to do this a few years ago (sometime around the time we added fs.access{Sync} and had to revert for some reason. I'll look back and see if I can find it |
Sorry, something went wrong.
|
Oh well, I can't find it. Nevermind :] |
Sorry, something went wrong.
Uses fs.access to implement fs.exists functionality. Fixes a issue, when a file exists but user does not have privileges to do stat on the file. Fixes: nodejs#17921 # Conflicts: # lib/fs.js
|
Rebased, PTAL. |
Sorry, something went wrong.
|
Failures look unrelated. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM, just left a suggestion.
Sorry, something went wrong.
| if (ctx.errno !== undefined) { | ||
| return false; | ||
| } | ||
| fs.accessSync(path, fs.FS_OK); |
There was a problem hiding this comment.
I think it would be good to use a cached fs.accessSync version. That way everything would still work, even if that function gets monkey patched.
Sorry, something went wrong.
There was a problem hiding this comment.
That should be picked up in a separate PR, I think.
Sorry, something went wrong.
There was a problem hiding this comment.
Since we do not use any reference so far and now introduce one, it might break. So I would rather do that in this PR, but it's not blocking for me.
Sorry, something went wrong.
There was a problem hiding this comment.
Yeah, I get the argument but monkeypatching fs is something that already a normal pattern. If we're going to fix it for one method, I'd rather fix it for all of them so there's less inconsistency. I'm happy either way tho. I was going to get this landed but will hold off for now.
Sorry, something went wrong.
There was a problem hiding this comment.
So, is it ok for me to land this?
Sorry, something went wrong.
There was a problem hiding this comment.
It is OK to land but I personally would say it is better to use a cached version as we otherwise might introduce a potential issue that was not there before.
Sorry, something went wrong.
Sorry, something went wrong.
Uses fs.access to implement fs.exists functionality. Fixes a issue, when a file exists but user does not have privileges to do stat on the file. Fixes: #17921 PR-URL: #18618 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Should this be backported to v9.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label. |
Sorry, something went wrong.
Uses fs.access to implement fs.exists functionality. Fixes a issue, when a file exists but user does not have privileges to do stat on the file. Fixes: nodejs#17921 PR-URL: nodejs#18618 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Uses fs.access to implement fs.exists functionality. Fixes a issue, when a file exists but user does not have privileges to do stat on the file. Fixes: #17921 PR-URL: #18618 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Uses fs.access to implement fs.exists functionality. Fixes a issue, when a file exists but user does not have privileges to do stat on the file. Fixes: #17921 Backport-PR-URL: #19654 PR-URL: #18618 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Uses fs.access to implement fs.exists functionality. Fixes a issue, when a file exists but user does not have privileges to do stat on the file. Fixes: nodejs#17921 PR-URL: nodejs#18618 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Weijia Wang <starkwang@126.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: James M Snell <jasnell@gmail.com>
|
Should this be backported to v8.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label. The 9.x backport does not land cleanly unfortunately |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uses fs.access() to implement fs.exists() functionality. Fixes a issue, when a file exists but user does not have privileges to do stat on the file.
Fixes: #17921
Checklist
Affected core subsystem(s)
fs