Skip to content
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

MinGW: Unix.symlink dose not raise an exception even when Unix.has_symlink () = false #7217

Closed
vicuna opened this Issue Apr 8, 2016 · 7 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

commented Apr 8, 2016

Original bug ID: 7217
Reporter: furuse
Assigned to: @damiendoligez
Status: closed (set by @xavierleroy on 2017-09-24T15:32:17Z)
Resolution: fixed
Priority: urgent
Severity: block
Platform: MinGW OCaml
Version: 4.02.3
Target version: 4.03.0+dev / +beta1
Fixed in version: 4.03.0+dev / +beta1
Category: otherlibs
Monitored by: @gasche @hcarty

Bug description

The following code succeeds w/o creating a symlink, in MinGW OCaml 4.03.0+beta2 w/o Admin right:

let () =
Printf.printf "has_symlink=%b\n" @@ Unix.has_symlink (); (* says false )
let oc = open_out "z" in
output_string oc "hello";
close_out oc;
Unix.symlink "z" "zz"; (
succeeds but no symlink is created *)
print_endline "done"

The function must raise an exception at failure!

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 8, 2016

Comment author: furuse

I use Win7.
OMake's ln-or-cp is affected by this...

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 12, 2016

Comment author: @damiendoligez

I tried to reproduce your problem but I'm getting this output:

has_symlink=false
Fatal error: exception Unix.Unix_error(_, "symlink", "zz")

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 13, 2016

Comment author: @damiendoligez

The bug happens only on Mingw64, not on Mingw32.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 13, 2016

Comment author: @damiendoligez

Today I learned that, in Windows, BOOL and BOOLEAN are not the same thing, and that CreateHardLink returns one, while CreateSymbolicLink returns the other.

Fixed in 4.03 branch (8d32473) and trunk (18c629a).

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 13, 2016

Comment author: furuse

Thanks. Let me check the fix.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 14, 2016

Comment author: furuse

Yes, I use MinGW64. The patch fixed the problem and I got:

Exception: Unix.Unix_error (EUNKNOWNERR (-1314), "symlink", "zz")

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 14, 2016

Comment author: @gasche

Damien, you did not include this bugfix in the Changelog, I assume that this is because symlink support on Windows is a new feature and users of released versions only will not be able to observe the change. If I'm wrong on that, you should add a Change entry.

@vicuna vicuna closed this Sep 24, 2017

@vicuna vicuna added this to the 4.03.0 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.