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

Always use O_SHARE_DELETE with Unix.openfile #5435

Merged
merged 1 commit into from
Feb 6, 2023
Merged

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Feb 6, 2023

Follows-up #5351 (comment) with a better approach. The fds used for locking and for the output of running commands are now opened with O_SHARE_DELETE. This has no effect on Unix, but it makes the semantics of these files more POSIX-like on Windows. In particular, it means that a switch can be deleted while the lock is still held. This is both simpler than #5351 and also philosophically more accurate - it means that nothing can attempt to take a write lock until after the directory has been completely unlinked.

It's possible that there are one or two other places - in particular, the file used when monitoring an external solver would be another candidate, but these are less critical. In particular, these two mean that cleaning up switches on error no longer displays a fault in opam and it also means that a "crashed" background process doesn't prevent a switch from being deleted.

@dra27 dra27 added this to PR in progress in Opam 2.2.0 via automation Feb 6, 2023
@dra27 dra27 added this to the 2.2.0~alpha milestone Feb 6, 2023
Copy link
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks!

@dra27 dra27 merged commit 82772fa into ocaml:master Feb 6, 2023
Opam 2.2.0 automation moved this from PR in progress to Done Feb 6, 2023
@dra27 dra27 deleted the share-delete branch February 6, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Opam 2.2.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants