-
-
Notifications
You must be signed in to change notification settings - Fork 418
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
Fix linker error when creating symlinks on Windows #3444
Conversation
When working on Windows builds for ponyup, I found that it wouldn't link due to an error with the FFI call in `symlink`. This commit adds a test to verify that `symlink` works. I expect this to fail CI on Windows at which point I will add a fix and verify that CI then passes on Windows.
@Theodus I'm aware. Thus the "do not merge". |
14a10c7
to
eebe46d
Compare
@kulibali So, if you pass "1" to CreateSymbolicLink (its a directory)... then it fails, if I change it to always pass U32(0) as the 3rd parameter it always passes. Not really sure what is up with that. You mentioned you would investigate. Should I hard-code U32(0) for now and you can look at your leisure and this can be merged or do you want to look into it more first? |
So theres problems with symlinks on Windows: you can only create them if you are running with elevated privileges (you have run a command window as Administrator, or spawned a process with elevated privileges, in which case a UI dialog will pop up, meaning we can't use this in CI or are using "Developer Mode" os-wide). https://blogs.windows.com/windowsdeveloper/2016/12/02/symlinks-windows-10/ I see a couple of problems -- if we include a symlink test on Windows then it will only work with elevated privileges, which are a problem for CI. Also, ponyup's symlinking stuff won't work without elevated privileges. Just for illustrative purposes, the following diff makes the
|
@kulibali do you want to update that branch with the patch and we can not have the test on for Windows but merge it so it will at least work? I'd say we also update the docs to note the requirement re: administrative privileges. |
OK, will do. |
Also updates the symlink function so that it links correctly on Windows, and tries its bestest to obtain the capability to create symlinks. Updates the documentation for `FilePath.symlink()` to note that on Windows creating symlinks requires elevated permissions.
packages/files/file_path.pony
Outdated
else | ||
0 | ||
end | ||
0 != @CreateSymbolicLinkA[U8](link_name.path.cstring(), path.cstring(), U32(0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the last parameter be dword
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah sorry that was the hardcoding that i left in from a test.
@SeanTAllen this looks good to me |
When working on Windows builds for ponyup, I found that it wouldn't
link due to an error with the FFI call in
symlink
. This commitadds a test to verify that
symlink
works.This PR contains a test that I verified fails on Windows and then adds a change to FilePath.symlink that then allows the failing test to pass.