Fix bug in symlink traversal with indirect targets #1084
Closed
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:
Fixes a bug where symlinks beginning with indirections (
../
) may fail to traverse in someprojectRoot
/watchFolders
configurations.This occurs due to incomplete "normalisation" of a symlink target in
metro-file-map
, relative to the project root. Given a project root of/project
and a symlink/project/src/link-to-foo -> ../../project/foo.js
, we would normalise the target to../project/foo.js
rather than simplyfoo.js
- we were not taking into account that further normalisation could be possible after joining withprojectRoot
."Normal" paths are defined as being fully normalised relative to the project root. The unnecessary indirection out and back into the project root fails because
TreeFS
is a DAG, and internally there is no entry forrootNode.get('..').get('project')
- this would be a cycle back torootNode
.Changelog:
Differential Revision: D49323614