Repository navigation
fix(server): a worktree a thread reached through a symlink can't be removed from under it - #917
Merged
Merged
Conversation
…emoved from under it The removal guard compared the folder being removed with each thread's recorded folders by spelling. git names a worktree by its real path, and a thread can record the same folder through a symlink (a data folder under macOS's /var, which is /private/var), so that thread did not count as in the way and its worktree could be deleted while it was still pointed there. The guard now compares folders as the disk resolves them. The cleanup list still classifies by spelling, so it can offer such a folder; the server then refuses and names the threads.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This branch was previously deployed
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.
The problem
The worktree removal guard compared the folder being removed with each thread's recorded folders by spelling. git names a worktree by its real path, and a thread can record the same folder through a symlink (a data folder under macOS's
/var, which is/private/var). That thread then did not count as in the way, and its worktree could be deleted while the thread still pointed there.Found while testing #911 on a data folder under
/var.The fix
The guard resolves the folder being removed and every thread's recorded folders through the disk before comparing them. Each distinct folder is resolved once; one that is gone keeps its spelling.
The cleanup list still classifies by spelling (it runs in the client and can't resolve paths), so it can offer such a folder. The server then refuses and names the threads.
Checked
vp fmt,vp lint,vp run typecheck,vp run '@threadlines/server#test' WorktreeRemovalGuard.