Repository navigation
fix(extract): improve symlink handling to replace existing entries atomically - #26
Merged
Merged
Conversation
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.
This pull request improves the safety and correctness of symlink extraction in the CLI, especially when handling existing files, symlinks, or directories at the extraction path. It introduces an atomic replacement strategy for symlinks, updates the extraction logic to require
-fto overwrite existing entries, and adds comprehensive tests for these scenarios.Symlink extraction improvements:
replace_with_symlinkfunction (non-Windows) that atomically creates and renames a symlink, ensuring safe replacement of existing files or symlinks without race conditions.extract_symlinkto use the new atomic replacement logic: now, if a symlink already exists and-fis not specified, extraction fails with an informative message; if-fis given, the symlink is safely replaced. Regular files are also replaced only with-f, and directories are never replaced.Testing improvements:
test_cli.shthat verifies symlink extraction over existing symlinks, files, and directories, both with and without the-f(force) flag, and checks for cleanup of temporary symlinks.