| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
You knew this question was coming: is making it public the right thing to do or should it be spun off into a npm package? _makeLong() is not a privileged function and doesn't do anything special, it just munges strings. |
Sorry, something went wrong.
There was a problem hiding this comment.
See my comments on jasnell@0222709
Sorry, something went wrong.
There was a problem hiding this comment.
AFAICT to make this a consistent API this needs to be
return posix.resolve(path);
Sorry, something went wrong.
There was a problem hiding this comment.
That would change the implementation. That's not what this intends to do.
Sorry, something went wrong.
There was a problem hiding this comment.
This is a new API, it need to be consistent.
Since the windows implementation uses resolve either the posix one does too, or remove it from the Windows one.
Sorry, something went wrong.
There was a problem hiding this comment.
No, it's not a new API. It literally just renames the existing function and makes the old name a deprecated alias. This api is and has been used by core for a long time and changing its behavior is not something I want to do in this pr.
Sorry, something went wrong.
IMHO it has value as another endpoint on path, which is anyway just a string munger. Using paths with the \\?\ prefix has "special powers" on Windows e.g. it can include . and .. as directory names, and has a much longer size limitation. The name is incorrect tough, it should be resolveExtended, since the output in not a UNC path. |
Sorry, something went wrong.
|
@bnoordhuis: simple answer is: node.js needs the function, it's already in the code, it's already accessible, it costs us extremely little to do this. So yes, I think it's the right thing to do. |
Sorry, something went wrong.
There was a problem hiding this comment.
-1 on runtime-deprecating without a reason, especially if we’re exposing an alias
Sorry, something went wrong.
There was a problem hiding this comment.
The reason is to strongly discourage userland from making continued use of _-prefixed methods. This is an api they already should not be using, without the deprecation notice, there's no strong motivation for those who are to change.
Sorry, something went wrong.
There was a problem hiding this comment.
I don't know if this should be runtime- or docs- deprecated, but I think the deprecation should be in an other commit so we can cherry-pick the addition to v8.x
Sorry, something went wrong.
There was a problem hiding this comment.
@jasnell I think I have two issues with that approach:
Sorry, something went wrong.
There was a problem hiding this comment.
A compromise approach, then, would be docs-only in 9.x, runtime deprecation in 10.x.
Sorry, something went wrong.
There was a problem hiding this comment.
@targos ... re: cherry-picking, If this goes through, I would open a separate PR against 8.x that can be cherry-picked.
Sorry, something went wrong.
There was a problem hiding this comment.
@jasnell I’m okay with that, I guess (not a fan, but eh).
Also, if this is just a docs-deprecation, I’d be in favour of just landing it as a minor in v8.x.
Sorry, something went wrong.
There was a problem hiding this comment.
This name is incorrect, the result is not UNC but a specially prefixed "extended lengh" path name.
IMHO best option is resolveExtended (although to keep with dirname and extname is could be all lowercase resolveextended)
Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx

Sorry, something went wrong.
There was a problem hiding this comment.
The description is imprecise. Also if we decide to go with a resolveExtended interpretation the description needs to change to include a reference to resolve:
Resolves the `path` with [`path.resolve()`][].
On Windows systems only, returns an "extended-length" path, which includes the "\\?\" prefix.
For more information see [this MSDN][aa365247]
...
[`path.resolve()`]: #path_path_resolve_paths
[aa365247]: https://msdn.microsoft.com/library/windows/desktop/aa365247(v=vs.85).aspx
Sorry, something went wrong.
I get that you want to make it a minimal change, but you can't avoid the fact that documenting it is de facto declaring a new API. New users will become aware of it and will try to figure out how to use it, and for them we need it to make sense and have least amount of surprise. IMHO simply documenting an internal ad-hoc-ish API has sub-optimal benefit. If we can't find a way to make sense of it, I'd rather it stayed undocumented, or be documented as deprecated. As I see it the crux of the design issue is that besides prepending \\?\ (which doesn't have a counterpart on POSIX), it also does resolve on Windows (which does have a POSIX counterpart) |
Sorry, something went wrong.
which is why it is clearly indicated as a no-op in the added documentation. |
Sorry, something went wrong.
That doesn't answer why it is that way... Or what this API is good for. Anyway, I am now tending to see this from your POV, but I want to convince myself. Please let me think some more about what you are saying, and about the big picture. |
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Would love to see this as semver-minor in 8, and the original name runtime-deprecated in v9 :-)
Sorry, something went wrong.
|
I will be opening a backport PR to land it as a minor in 8.x, 6.x and 4.x |
Sorry, something went wrong.
|
@refack ... if there are specific implementation changes to the posix version that you'd like to see, please open a separate PR for that. |
Sorry, something went wrong.
Sorry, something went wrong.
That's not a great answer. Node has a lot of functions it needs that we don't expose. Why is this function special? "Costs us extremely little" was the same argument for net.Server#maxConnections, process.on('uncaughtException') and a host of other things we've come to regret later. I'd like to hear a better motivation. |
Sorry, something went wrong.
|
@nodejs/ctc ... please review and weigh in. |
Sorry, something went wrong.
|
It's already exposed. This change just documents it and gives it a better name. If not this, is your suggestion to remove it entirely? |
Sorry, something went wrong.
|
@jasnell, doing it right now. Sorry for the long delay on all this… |
Sorry, something went wrong.
There was a problem hiding this comment.
Please escape the underscore.
Sorry, something went wrong.
|
Full grep: https://gist.github.com/ChALkeR/d740faa02146b6d726fedb328c08a043 +1 to this PR. |
Sorry, something went wrong.
|
I am updating the OP to use the current new API name of path.toNamespacedPath(), rather than path.toLongUNCPath(). |
Sorry, something went wrong.
There was a problem hiding this comment.
I'm not super keen on exposing more easy-to-implement API but it does also seem reasonable. +-0 with comments addressed.
Sorry, something went wrong.
There was a problem hiding this comment.
This seems to have rather poor type-checking, can we fix that before exposing it publicly?
Sorry, something went wrong.
There was a problem hiding this comment.
Fix in what way? If the value is not a string it simply returns the value. Given how extensively this method is used by other fs methods that perform their own type checking, adding additional type checking to this would be redundant and largely unnecessary.
Sorry, something went wrong.
|
Based on discussion in the TSC meeting consensus is that we can move forward. We can land once comments are addressed unless there are objections in next 48 hours. |
Sorry, something went wrong.
|
Ok. Glad to finally see progress on this. I'll get the pr updated |
Sorry, something went wrong.
Replace the internal `path._makeLong()` with a public `path.toLongUNCPath()` method. Add documentation. Refs: standard-things/esm#66
|
PR rebased and updated to address the feedback. Opted not to apply additional type checking to the method. If we want to pursue adding additional type checking, then that can be done as a separate semver-major PR |
Sorry, something went wrong.
Sorry, something went wrong.
TSC decided to move forward with the change. We can add additional type checking later in a separate semver-major PR
Sorry, something went wrong.
@mhdawson The meeting notes in nodejs/TSC#367 don't mention the rationale, only that discussion happened. |
Sorry, something went wrong.
Replace the internal `path._makeLong()` with a public `path.toLongUNCPath()` method. Add documentation. PR-URL: #14956 Ref: standard-things/esm#66 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
|
@bnoordhuis ... just saw your comment here right after pushing to master. If we need to revisit this, we can, but I was proceeding based on the goahead from TSC and the green CI |
Sorry, something went wrong.
|
@jasnell No, it's fine, I'm just interested to know what the TSC's motivation for moving forward was. The questions I posted are mentioned in the meeting notes but not if they were actually discussed. |
Sorry, something went wrong.
|
DEP code left unassigned. |
Sorry, something went wrong.
|
Pr to fix the dep code is already open. |
Sorry, something went wrong.
I was think about something that wraps core-validate-commit:
I'm open a PR and if anyone has suggestions they should add there. |
Sorry, something went wrong.
Replace the internal `path._makeLong()` with a public `path.toLongUNCPath()` method. Add documentation. PR-URL: nodejs/node#14956 Ref: standard-things/esm#66 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
| Back | FazBrowse Home | New Git URL |
Replace the internal path._makeLong() with a public path.toNamespacedPath() method. Add documentation.
Refs: standard-things/esm#66
Ping: @ljharb @jdalton
Checklist
Affected core subsystem(s)
path