-
Notifications
You must be signed in to change notification settings - Fork 13k
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
better build locks for bootstrap #118535
better build locks for bootstrap #118535
Conversation
`file_lock` util provides `FileLock` type which is a wrapper around `fs2` and `std::fs::File`. This is useful as `fs2` supports Solaris and has fewer dependencies than `fd-lock`. Signed-off-by: onur-ozkan <[email protected]>
(rustbot has picked a reviewer for you, use r? to override) |
77c56b2
to
125ba2a
Compare
Signed-off-by: onur-ozkan <[email protected]>
125ba2a
to
fb59860
Compare
Thank you for doing this! I can confirm it builds on Solaris. |
fs2 and fd-lock look basically the same to me dependency wise. (fd-lock actually looks more modern, e.g., windows-sys vs. winapi). fd-lock is also actively maintained, while fs2 isn't (last release 6 years ago). Can we stick with fd-lock rather than fs2 and submit a PR for fd-lock support for Solaris? That seems like the better solution here, rather than moving to a mostly unmaintained crate. |
☔ The latest upstream changes (presumably #118069) made this pull request unmergeable. Please resolve the merge conflicts. |
fd-lock support for Solaris is problematic. Solaris doesn't support flock syscall. And emulation via fcntl isn't easy where there is different semantic (flock works per file descriptor and fcntl per process). |
I was planning to apply this workaround https://github.com/danburkert/fs2-rs/blob/9a340454a8292df025de368fc4b310bb736f382f/src/unix.rs#L56-L92 on fd-lock. It shouldn't be problem I think as they are sharing almost the same implementation. |
@psumbera Can you test this https://github.com/onur-ozkan/rust/tree/demo-for-build-locks branch (to see if locking works as expected or not on solaris) by any chance? |
It builds just fine. But still prints:
I think it's now printed always: onur-ozkan@0c2b090#diff-5624b915604aca92c82fe2af07e555adfd958a3247eada8300061e6fe6c3dd6eR55 |
Oh, I forgot to remove that log (not really important anyway, this is just for debugging). Does the locking work? What happens when you run |
Yes, seems to work:
|
Created #119413 PR and closing this. |
This PR improves the way bootstrap handles the build locks by supporting Solaris and removing many dependencies coming with
fd-lock
.cc @psumbera