lib/utils/fs.go: Do not remove lockfiles on Windows#21655
Merged
Conversation
Member
Author
AntonAM
approved these changes
Feb 13, 2023
r0mant
approved these changes
Feb 13, 2023
|
@ravicious See the table below for backport results.
|
This was referenced Feb 13, 2023
avatus
pushed a commit
that referenced
this pull request
Mar 3, 2023
* lib/utils/fs.go: Do not remove lockfiles on Windows * Remove unused import from fs_windows.go
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.
Fixes #21529.
Removing auxiliary lockfiles was added in #16364. Back then we decided to remove lockfiles on unlock because leaving them behind could be confusing for users.
After #19420 was merged, Connect was creating dozens of locks for
known_hosts. It turns out that repeatedly deletingknown_hosts.lockwas causingflock.Flock.TryRLockto return either "access denied" or "The process cannot access the file because it is being used by another process" (see #21529). Getting rid of lockfile cleanup on unlock solves this problem.This PR also changes the suffix of auxiliary lockfiles from
.lockto.lock.tmpto hopefully help users understand that those leftovers don't really affect the execution of tsh, unlike for example git'sindex.lock.At the moment, the file lock functions from
lib/utils/fs.goare used in:lib/client/trusted_certs_store.golib/events/filesessionslib/tbot/configThis change will only have an impact on the first location, leaving
known_hosts.lock.tmpon Windows, as bothteleportandtbotbinaries are not available for Windows.