-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
libuv_readlink_function #10714
libuv_readlink_function #10714
Conversation
return linkval | ||
end | ||
@windowsxp_only readlink(p::AbstractString, np::AbstractString) = | ||
error("WindowsXP does not support soft symlinks") |
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.
Unless the underlying libuv function errors on XP, there's no reason for us to make readlink
error there.
Interesting failure on appveyor - the To summarize the symlink situation on Windows, roughly speaking:
|
Should we at least enable readlink for none windows and fix #10506 because at the moment the |
|
||
.. note:: | ||
|
||
This function raises an error under operating systems that do not support |
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.
I don't think this note is true, unless uv_fs_readlink
errors internally on XP.
Can you look into We could modify the test to account for the OS-dependent behavior here, but would be good to track down where it's coming from. And looking at this all-in-C version, I'd like someone else's opinion whether it's actually better in the end to do it this way (malloc'ing a string in C) versus the all-in-Julia way from #10571 (malloc'ing a uv_fs in Julia). |
We could modify the test to account for the OS-dependent behavior here, but would be good to track down where it's coming from. I only have access to Linux: so I can not be of much help on the other OS. Can you look into uv_fs_readlink and see if it's any different between JuliaLang/libuv and upstream libuv/libuv? I can check that tomorro or so.. |
hi @tkelman seems your suggestion worked. All is well — 2 successful checks Anyway I had a look into the upstream libuv windows: fs.c A diff to the one used by julia gives a couple of changes. I copy past the most relevant @@ -287,7 +280,7 @@ INLINE static int fs__readlink_handle(HA
(w_target[4] >= L'a' && w_target[4] <= L'z')) &&
w_target[5] == L':' &&
(w_target_len == 6 || w_target[6] == L'\\')) {
- /* \??\«drive»:\ */
+ /* \??\<drive>:\ */
w_target += 4;
w_target_len -= 4;
@@ -296,8 +289,8 @@ INLINE static int fs__readlink_handle(HA
(w_target[5] == L'N' || w_target[5] == L'n') &&
(w_target[6] == L'C' || w_target[6] == L'c') &&
w_target[7] == L'\\') {
- /* \??\UNC\«server»\«share»\ - make sure the final path looks like */
- /* \\«server»\«share»\ */
+ /* \??\UNC\<server>\<share>\ - make sure the final path looks like */
+ /* \\<server>\<share>\ */
w_target += 6;
w_target[0] = L'\\';
w_target_len -= 6;
@@ -312,8 +305,8 @@ INLINE static int fs__readlink_handle(HA
w_target_len = reparse_data->MountPointReparseBuffer.SubstituteNameLength /
sizeof(WCHAR);
- /* Only treat junctions that look like \??\«drive»:\ as symlink. */
- /* Junctions can also be used as mount points, like \??\Volume{«guid»}, */
+ /* Only treat junctions that look like \??\<drive>:\ as symlink. */
+ /* Junctions can also be used as mount points, like \??\Volume{<guid>}, */
/* but that's confusing for programs since they wouldn't be able to */
/* actually understand such a path when returned by uv_readlink(). */
/* UNC paths are never valid for junctions so we don't care about them. */
@@ -359,7 +352,7 @@ INLINE static int fs__readlink_handle(HA
/* If requested, allocate memory and convert to UTF8. */
if (target_ptr != NULL) {
int r;
- target = (char*) malloc(target_len + 1);
+ target = (char*) uv__malloc(target_len + 1);
if (target == NULL) {
SetLastError(ERROR_OUTOFMEMORY);
return -1;
@@ -1473,7 +1640,7 @@ static void fs__symlink(uv_fs_t* req) {
static void fs__readlink(uv_fs_t* req) {
HANDLE handle;
- handle = CreateFileW(req->pathw,
+ handle = CreateFileW(req->file.pathw,
0,
0,
NULL, |
The private fields of I think this is acceptable, but again I'd like a second opinion (@Keno maybe?) whether we should prefer the C approach here or the Julia version in #10571. This PR has improved tests and docs, but we may want to go back to the other PR's implementation of |
No problem. I tried running a If you decide on the other PR I would recommend calling the Cheers |
hi @Keno any thoughts how to preceed? |
It looks like this needs a rebase. Can someone who knows the libuv interface please respond with an opinion? If no one says anything, I think I'm leaning towards the Julia version, and would just merge that absent an opinion from anyone else. |
I think the julia version would be fine do. I could after it is actually merged the docs if you want me. |
Do you know how to do an interactive rebase and force push to this branch with git? I could manually merge the two changes but I've got a bunch of other work to do, it would be simplest if you can resolve the conflicts. |
@tkelman sorry this was the first time I tried to rebase a PR. I had hoped it will be one final commit and not 4. Not sure what I did wrong. |
One step at a time, so far it looks like you were able to rebase to master correctly to resolve the merge conflict, so that's good. To combine multiple commits into one you select "squash" during the interactive rebase. And I think my vote will be to the Julia implementation of |
sorry I misunderstood that - will give it a try |
Adds wrapper function in C in jl_uv.c as well as the necessary documentations and tests.
This looks perfect, if it passes CI and nobody says otherwise I'll merge it. Sorry this took so long, would've been good to get input from another reviewer here. |
I took a quick look through the uv code and readlink man page, and this looks correct to me (for whatever it's worth). |
hi @tkelman |
Might be worth adding if you want, I'd say under Library improvements, other improvements |
libuv_readlink_function: This replaces the PR #10687.
As requested by @tkelman and @Keno in #10571: adds wrapper function in C in jl_uv.c as well as the necessary documentations and tests.
This is pre-required for #10506
make test file