Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007217OCamlotherlibspublic2016-04-08 06:552017-09-24 17:32
Reporterfuruse 
Assigned Todoligez 
PriorityurgentSeverityblockReproducibilityalways
StatusclosedResolutionfixed 
PlatformMinGW OCamlOSOS Version
Product Version4.02.3 
Target Version4.03.0+dev / +beta1Fixed in Version4.03.0+dev / +beta1 
Summary0007217: MinGW: Unix.symlink dose not raise an exception even when Unix.has_symlink () = false
DescriptionThe 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!

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0015687)
furuse (reporter)
2016-04-08 06:56
edited on: 2016-04-08 07:02

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

(0015722)
doligez (administrator)
2016-04-12 16:55

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

  has_symlink=false
  Fatal error: exception Unix.Unix_error(_, "symlink", "zz")
(0015729)
doligez (administrator)
2016-04-13 16:45

The bug happens only on Mingw64, not on Mingw32.
(0015730)
doligez (administrator)
2016-04-13 17:14

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 (8d32473030803c2fccbecb04b9fdbd45bf9174b2) and trunk (18c629a0965b61fdbcea3311a1dcf24ee5783190).
(0015738)
furuse (reporter)
2016-04-14 01:07

Thanks. Let me check the fix.
(0015739)
furuse (reporter)
2016-04-14 05:22

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

Exception: Unix.Unix_error (EUNKNOWNERR (-1314), "symlink", "zz")
(0015742)
gasche (administrator)
2016-04-14 16:26

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.

- Issue History
Date Modified Username Field Change
2016-04-08 06:55 furuse New Issue
2016-04-08 06:56 furuse Note Added: 0015687
2016-04-08 07:02 furuse Note Edited: 0015687 View Revisions
2016-04-12 15:12 doligez Assigned To => doligez
2016-04-12 15:12 doligez Status new => assigned
2016-04-12 15:12 doligez Target Version => 4.03.0+dev / +beta1
2016-04-12 16:55 doligez Note Added: 0015722
2016-04-12 16:55 doligez Status assigned => feedback
2016-04-13 16:45 doligez Note Added: 0015729
2016-04-13 17:14 doligez Note Added: 0015730
2016-04-13 17:14 doligez Status feedback => resolved
2016-04-13 17:14 doligez Resolution open => fixed
2016-04-13 17:14 doligez Fixed in Version => 4.03.0+dev / +beta1
2016-04-14 01:07 furuse Note Added: 0015738
2016-04-14 05:22 furuse Note Added: 0015739
2016-04-14 16:26 gasche Note Added: 0015742
2017-02-23 16:42 doligez Category OCaml otherlibs => otherlibs
2017-09-24 17:32 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker