fix copying top level symlinks to folders in directory unpack_strategy#6141
Merged
MikeMcQuaid merged 1 commit intoHomebrew:masterfrom May 17, 2019
Merged
fix copying top level symlinks to folders in directory unpack_strategy#6141MikeMcQuaid merged 1 commit intoHomebrew:masterfrom
MikeMcQuaid merged 1 commit intoHomebrew:masterfrom
Conversation
5 tasks
MikeMcQuaid
approved these changes
May 17, 2019
Member
|
Great work as usual, thanks @chrmoritz! |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
brew stylewith your changes locally?brew testswith your changes locally?This PR fixes a issue in the directory unpack_strategy, which currently does not preserve top level symlinks pointing to directories. Instead of copying the symlink (as a singe file) we are currently recursively copying the content of the folder to which the symlink points to. At the end the unpacked source does not contain the top level symlink (pointing to a folder within the source) anymore, because
brewhas converted it to a complete copy of said folder.This breaks
deno(see: Homebrew/homebrew-core#35645 (comment)) and the added test case.The current code is broken because
child.directory?is true for symlinks pointing to folders too, but we should preserve them. That's why an additional check if thechildis not a symlink was added to determine if we should recursively copy the contents of thechild(in case it's a non symlink folder) or just the file itself.