Fix known_hosts locking by refactoring our locks in utils/fs#16364
Merged
Fix known_hosts locking by refactoring our locks in utils/fs#16364
known_hosts locking by refactoring our locks in utils/fs#16364Conversation
r0mant
reviewed
Sep 13, 2022
dc5d21e to
3638f26
Compare
tigrato
reviewed
Sep 14, 2022
known_hostsknown_hosts locking by refactoring our locks in utils/fs
0c92076 to
8d80385
Compare
r0mant
reviewed
Sep 14, 2022
Collaborator
r0mant
left a comment
There was a problem hiding this comment.
@AntonAM I'll let @tigrato and @timothyb89 to review the code but before we merge this, let's please test the following tsh login scenarios on both Linux (or Mac) and Windows to make sure nothing else breaks:
- Simple login with local user.
- Login with SSO (e.g. Github or Okta SAML connector).
- Login with MFA (e.g. TouchID).
Contributor
Author
|
@r0mant 👍 I've already checked with OTP on Mac and Windows during development, will check the rest. |
tigrato
approved these changes
Sep 14, 2022
timothyb89
approved these changes
Sep 14, 2022
tigrato
reviewed
Sep 15, 2022
library and add support for windows Flock works differently on linx/mac vs windows. On windows it's impossible to read/write file after locking, so we need to create separate lockfile.
117f8e1 to
91204e3
Compare
Contributor
This was referenced Sep 15, 2022
This was referenced Feb 10, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Turned out linux/mac and windows versions of
flockwork differently - on windows it's impossible to read/write file after locking, andtshfailed to readknown_hostsfile after locking on it.To fix it we refactor file locks in
utils/fsto take advantage of the split os approach - on non windows it will be working with just locking on target file asknown_hostscurrently works, but on windows we'll be creating .lock file. We still get benefits of automatic unlocking if something bad happens and process dies without explicitly unlocking the file, so we don't have to worry about handling leftover lockfiles. We also remove .lock file on unlock.Related to #16057 and #15298
Fixes #16217