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

Unix.symlink does not support forward slashes under Windows #7564

Closed
vicuna opened this Issue Jun 23, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@vicuna
Copy link
Collaborator

commented Jun 23, 2017

Original bug ID: 7564
Reporter: @nojb
Assigned to: @alainfrisch
Status: resolved (set by @alainfrisch on 2017-07-18T22:05:42Z)
Resolution: fixed
Priority: normal
Severity: minor
Fixed in version: 4.06.0 +dev/beta1/beta2/rc1
Category: platform support (windows, cross-compilation, etc)

Bug description

It appears that the target of native Windows symlinks (as created by Unix.symlink under Windows) must necessarily use backward slashes. Otherwise the native Windows APIs will think that the target does not exist.

As a compatibility layer, Unix.symlink should allow forward slashes in its argument.

Steps to reproduce

$ cd /tmp
$ ocaml unix.cma
# Unix.mkdir "foo" 0o777;;
- : unit = ()
# close_out (open_out "foo/test.txt");;
- : unit = ()
# Unix.symlink "foo/test.txt" "foolink";;
- : unit = ()
# Unix.stat "foolink";;
Exception: Unix.Unix_error (Unix.ENOENT, "stat", "foolink").
# Unix.symlink "foo\\test.txt" "foolink2";;
- : unit = ()
# Unix.stat "foolink2";;
- : Unix.stats =
{Unix.st_dev = -427248956; st_ino = 2456; st_kind = Unix.S_REG;
 st_perm = 438; st_nlink = 1; st_uid = 0; st_gid = 0; st_rdev = -427248956;
 st_size = 0; st_atime = 1498204751.3015687; st_mtime = 1498204751.3015687;
 st_ctime = 1498204751.3015687}
@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 23, 2017

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 23, 2017

Comment author: @nojb

#1211

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 27, 2017

Comment author: @xavierleroy

See work in progress and discussion here: #1211

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.