Skip to content

Symlink reparse points not resolved above the mount point #454

@mikelatcs

Description

@mikelatcs

Bug Report

I think there is something loose in the code that solves symlinks.

  • Relative paths crossing the mount point fail to work for both files and directories.
  • Directory symlinks with relative paths pointing to the mount point (not only above it) will fail to be traversed by applications.

When testing with directories:

  • cd from cmd: The name of the file cannot be resolved by the system.
  • Windows Explorer shows a similar error when trying to open the symlink.
  • WinFSP returns 0xC0000280 (STATUS_REPARSE_POINT_NOT_RESOLVED).

image
image

Absolute paths work OK.
The symlinks that trigger this behavior work OK when moved down the file hierarchy.

How to Reproduce

Case 1 - Link to dot

C:\SOMEWHERE\MOUNT_POINT> mkdir dir
C:\SOMEWHERE\MOUNT_POINT> cd dir
C:\SOMEWHERE\MOUNT_POINT\dir> mklink /D link .
C:\SOMEWHERE\MOUNT_POINT\dir> cd link # You can also try to open it in Windows Explorer.
C:\SOMEWHERE\MOUNT_POINT\dir\link>
# This is OK. New path is ends with "link". Actually, we are in the same directory.

C:\SOMEWHERE\MOUNT_POINT\dir\link> cd ..
C:\SOMEWHERE\MOUNT_POINT\dir> move link ..
C:\SOMEWHERE\MOUNT_POINT\dir> cd ..
C:\SOMEWHERE\MOUNT_POINT> cd link # You can also try to open it in Windows Explorer.
The name of the file cannot be resolved by the system.
# [[ This is KO! ]]

Case 2 - Link to dot-dot

C:\SOMEWHERE\MOUNT_POINT\dir> mklink /D link ..\.. # Target is "C:\SOMEWHERE"
C:\SOMEWHERE\MOUNT_POINT\dir> cd link # You can also try to open it in Windows Explorer.
The name of the file cannot be resolved by the system.
# [[ This is KO! ]]

Behaviors

It would be expected to be able to access both, the mount point directory and locations out of it by using relative symlinks (already possible with absolute paths).

Environment

  • OS version and build: 10.0.19044.2006
  • WinFsp version and build: WinFsp 2022.2 Beta 1 (C# version of the library).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions