[FIXES #2096] fix relative symlinks of symlinks #2454
Merged
+1
−1
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.
Summary
This makes
yarn link
work when$HOME/.config/yarn/link/
is itself a symlink.The following commit forces symlinks to be relative: 36d73cc
This isn't ideal, although it enables some portability it breaks others. For example, it is not uncommon for
$HOME/.config
itself to be be a symlink:$HOME/.config
->$HOME/src/stefanpenner/dotfiles
.Now when running
yarn link
inside$HOME/src/ember-cli/ember-cli
we end up with:Which results in the link located at:
/Users/spenner/.config/yarn/link/ember-cli
pointing to/Users/spenner/.config/src/ember-cli/ember-cli
rather then/Users/spenner/src/ember-cli/ember-cli
This is because
/Users/spenner/.config
is actually a symlink pointing to/Users/spenner/src/stefanpenner/dotfiles/.config/
This PR mitigates he issue raised in #2096, but reifying the paths via
realpathSync
before deriving the relative path. This ensures that at the time of linking, the paths are correct. This doesn't fix all issues, e.g. symlinks cannot always be changed after this reification.Test plan
src/lib/fs.js
appears currently untested... if this is an approach you all would like to take I can add some tests.