Skip to content
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

Fix bug in symlink traversal with indirect targets #1084

Closed
wants to merge 1 commit into from

Commits on Sep 15, 2023

  1. Fix bug in symlink traversal with indirect targets

    Summary:
    Fixes a bug where symlinks beginning with indirections (`../`) may fail to traverse in some `projectRoot` / `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 simply `foo.js` - we were not taking into account that further normalisation could be possible after joining with `projectRoot`.
    
    "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 for `rootNode.get('..').get('project')` - this would be a cycle back to `rootNode`.
    
    Changelog:
    ```
     * **[Fix]:** Symlinks with indirections may not be resolvable
    ```
    
    Differential Revision: D49323614
    robhogan authored and facebook-github-bot committed Sep 15, 2023
    Configuration menu
    Copy the full SHA
    0d927b5 View commit details
    Browse the repository at this point in the history