berry
berry copied to clipboard
Allow symlinks in MountFS
What's the problem this PR addresses?
Yarn shouldn't care if zips in the cache are symlinks or not. The only reason it doesn't work is that finding the mount point skips zips if they're not regular files. This used to be supported until it was removed for "performance" reasons in https://github.com/yarnpkg/berry/pull/1474. The bulk of the logic in the linked PR involves resolving the real path of the symlink but I don't think that's needed for this?
Resolves https://github.com/yarnpkg/berry/issues/3514
How did you fix it?
I switched the check to use stat from lstat.
Checklist
- [X] I have read the Contributing Guide.
- [X] I have set the packages that need to be released for my changes to be effective.
- [x] I will check that all automated PR checks pass before the PR gets reviewed.
The tests seem to accept that, so I'd tend to be fine with merging this since it shouldn't impact existing codebases 🤔
I've added the tests. The acceptance tests were timing out on windows so I just excluded them. For some reason, the unit test works though so I'm just letting it run unconditionally.
Side note: I'm getting this error on Vercel when setting YARN_CACHE_FOLDER=node_modules/.yarn-cache:
YN0001: │ Error: While persisting /vercel/path0/node_modules/.yarn-cache/node-gyp-npm-9.3.1-43540bab9c-b860e9976f.zip/node_modules/node-gyp/ -> /vercel/path0/node_modules/node-gyp ENOENT: no such file or directory, scandir '/vercel/path0/node_modules/.yarn-cache/node-gyp-npm-9.3.1-43540bab9c-b860e9976f.zip/node_modules/node-gyp'
~~I hope this PR will also fix that, if not I'll make a new issue.~~ I have tested this PR's artifacts and it seems to resolve this as well.
@merceyz are there any other changes you want me to make?
@merceyz Sorry for pinging, but could this be merged or are there any blockers?
@thatsmydoing would you be able to rebase on master?
@arcanis Any way this could be merged?
Hey @thatsmydoing @merceyz -- is this safe to be merged?