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

@vicuna
Copy link

vicuna 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
Copy link
Author

vicuna commented Apr 8, 2016

Comment author: furuse

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

@vicuna
Copy link
Author

vicuna 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
Copy link
Author

vicuna commented Apr 13, 2016

Comment author: @damiendoligez

The bug happens only on Mingw64, not on Mingw32.

@vicuna
Copy link
Author

vicuna 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
Copy link
Author

vicuna commented Apr 13, 2016

Comment author: furuse

Thanks. Let me check the fix.

@vicuna
Copy link
Author

vicuna 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
Copy link
Author

vicuna 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants