Skip to content

Windows filesystem cannot resolve symlinks in WSL #4867

Closed

Description

I have found that Windows programs (such as native Windows gVim and cmd.exe) cannot resolve WSL filepaths involving symlinks.

The simplest example is using cmd.exe and the type built-in.

In a WSL shell:

$> echo "file contents" > /tmp/foo
$> ln -s /tmp/foo /tmp/bar
$> cat /tmp/foo
file contents
$> cat /tmp/bar
file contents
$> wslpath -wa /tmp/bar
\\wsl$\Ubuntu\tmp\bar

In cmd.exe:

C:\>type "\\wsl$\ubuntu\tmp\foo"
file contents

C:\>type "\\wsl$\ubuntu\tmp\bar"
The name of the file cannot be resolved by the system.

Version info

From a WSL shell:

$> cat /proc/version
Linux version 4.4.0-18362-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #476-Microsoft Fri Nov 01 16:53:00 PST 2019
$> cmd.exe /c ver
Microsoft Windows [Version 10.0.18362.592]

Activity

  1. BatmanAoD commented on Feb 3, 2020

    @BatmanAoD
    Author

    I've marked this as a "bug", but arguably it's a missing feature of wslpath. It seems reasonable that the -a flag should attempt to dereference symlinks.

  2. BatmanAoD commented on Feb 3, 2020

    @BatmanAoD
    Author

    For now, creating a workaround in the WSL shell is pretty easy, using GNU readlink -f to dereference symlinks before passing file paths to wslpath.

  3. therealkenc commented on Feb 3, 2020

    @therealkenc

    No version given. Ref #4078.

    image

  4. BatmanAoD commented on Feb 3, 2020

    @BatmanAoD
    Author

    Sorry, I knew I forgot something! I've updated the top-level comment.

  5. therealkenc commented on Feb 3, 2020

    @therealkenc

    Alright, chasing issue links it seems the behavior didn't change until 18917 ref #3999 (message). /dupe #4078, I'll fix up the fixed-in tag over there. Thanks for the submission and the version clarification.

  6. deleted a comment from on Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions