-
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
symlink is - stateful? #27795
Comments
@nodejs/platform-windows |
Reproduces with v14, similar code in plain libuv (two uv_fs_symlink calls) works as expected. |
I do not think this is actually a bug but I think @bnoordhuis would have more context on it (see the old issue nodejs/node-v0.x-archive#6342 for example). Windows handles symlinks oddly and the reason you get an EPERM is that the security configuration actually blocks users from making symlinks in this case. If you change the paths to relative paths within the |
No, it's not a security issue, this happens both when running as admin as well as running in developer mode which allows creation of symlinks with a regular account. As I've written, the error happens due to long paths, it was tested to work with short paths. And none of that explains problem c, the fact that the function starts behaving differently after it failed once. That can't possibly be intended behavior. |
It looks like #33351 might fix this. |
Use the namespaced (with the \\?\ prefix) paths for symlink targets when the path is absolute. This allows creation of symlinks to files with long filenames. Fixes: nodejs#27795
Use the namespaced (with the \\?\ prefix) paths for symlink targets when the path is absolute. This allows creation of symlinks to files with long filenames. Fixes: #27795 PR-URL: #33351 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Use the namespaced (with the \\?\ prefix) paths for symlink targets when the path is absolute. This allows creation of symlinks to files with long filenames. Fixes: #27795 PR-URL: #33351 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Version: v11.6.0
Platform: Windows 10 (64bit)
Subsystem: fs
This is easiest to describe with sample code:
Now there are a few oddities here
a) I can link from a short path to a long one (> MAX_PATH) but not the other way around
b) The error reported is EPERM for some reason, not ENAMETOOLONG or EINVAL
c) after that error has been reported, even the original call linking from short to long fails
c is the most scary of them because it indicates there is some global internal state that gets flipped and breaks all further calls? How does that make sense?
This is independent of the unlink call btw., this problem also happens if I remove the link outside node or if I use a third file.
The text was updated successfully, but these errors were encountered: