-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve the realpath of linkFolder before symlinking #7028
base: master
Are you sure you want to change the base?
Resolve the realpath of linkFolder before symlinking #7028
Conversation
Thanks for doing this; I personally just got bitten by this as well (my |
I ran into this problem too (I link my dotfiles into the home directory). It would be great if this could get merged! |
This solves the issue! |
Wow, didn't know so many people cared. I'll have a look at why the CI is failing. Edit: Turns out the tests on macOS run in a temporary folder that is also a symlink. Fixing the linking exposed a similar problem with linking the binaries on that platform, so I went and fixed that too. The fix seems to be complete now, at least I'm not aware what else to look at. |
f9180d4
to
3029d40
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passed all the tests, no significant code changes
6adf9b4
to
afb8fa4
Compare
4d38c7d
to
e921aae
Compare
cef8735
to
0edde59
Compare
@waleedahmed3045, is there anything else I can do? |
fs.symlink seems to not resolve existing symlinks in the target path when creating new ones, resulting in broken symlinks. Resolving the realpath of linkFolder before creating the symlink fixes this.
Tests on macOS run in a symlinked folder and previously worked because no path was resolved correctly. To work once more, both have to be replaced with the realpath.
As per pull request template recommendation.
0edde59
to
55727ba
Compare
Is this ever going to be merged? I'm tired of going back to npm when I need to link packages. What can I do to help? |
Is yarn just not maintained? |
By the way, for some reason the active development branch of yarn is not at this repository. It's at https://github.com/yarnpkg/berry Not sure what it means for opened issues here... |
Summary
I was affected by the bug described here: #1297
Symlinks created by
yarn link
will be broken if there's a symlink somewhere in the config path. This fixes the problem for me.fs.symlink
seems to not resolve existing symlinks in the target path when creating new ones, resulting in broken symlinks. Resolving the realpath of linkFolder before creating the symlink fixes this.Test plan
This was previously not working when
~/.config
was a symlink:With this update, it is working. More details in the ticket, too.