-
Notifications
You must be signed in to change notification settings - Fork 322
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
Fix races on temporary file copies #616
Conversation
if err != nil { | ||
return fmt.Errorf("failed to create temporary file in %s: %w", parent, err) | ||
} | ||
defer os.Remove(tmpFile.Name()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a no-op unless the write fails and the rename never happens.
@fweikert 👋 anything I can help with to get this PR merged? |
Thank you! |
Hi, when should we expect a release with this change? |
https://github.com/bazelbuild/bazelisk/releases/tag/v1.22.1 |
Thanks! |
When two instances of Bazelisk are running concurrently and downloading Bazel, the current code admits a race. This patch fixes the issue by using randomly named files for temporary paths.
For example: