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

Support deleting symlinks in Lwt_io.with_temp_dir on Windows #886

Merged
merged 1 commit into from
Nov 7, 2021

Conversation

MisterDA
Copy link
Contributor

@MisterDA MisterDA commented Sep 16, 2021

If a Windows symlink points to a directory, then rmdir is the correct
function to call. If it points to a file, then unlink is the correct
function. When pointing to a file, the symlink can also have the
read-only attribute, which makes it subject of the little chmod dance.

This depends on the fix in #883.

@smorimoto
Copy link
Member

@MisterDA Could you rebase this?

@MisterDA
Copy link
Contributor Author

MisterDA commented Oct 6, 2021

Rebased.

@smorimoto
Copy link
Member

Thanks!

@MisterDA
Copy link
Contributor Author

MisterDA commented Oct 7, 2021

This is related to ocaml/ocaml#10642. At the moment neither Sys.remove nor Unix.unlink can remove symlinks to directories on Windows, but POSIX unlink(2) can remove symlinks (regardless of whether they're symlinks to files or directories).
I think I'll probably provide write in the future the variant that the comment suggest, switching to blocking files and a detached thread.

@MisterDA MisterDA mentioned this pull request Oct 21, 2021
1 task
If a Windows symlink points to a directory, then rmdir is the correct
function to call. If it points to a file, then unlink is the correct
function. When pointing to a file, the symlink can also have the
read-only attribute, which makes it subject of the little chmod dance.
@smorimoto smorimoto merged commit 99c5635 into ocsigen:master Nov 7, 2021
@MisterDA MisterDA deleted the with-temp-dir-symlinks branch November 7, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants