dotnet/runtime

NTFS volume on Linux - junction does not work properly

Open

#20,874 创建于 2017年4月3日

在 GitHub 查看
 (6 评论) (0 反应) (0 负责人)C# (5,445 fork)batch import
area-System.IObughelp wantedos-linux

仓库指标

Star
 (17,886 star)
PR 合并指标
 (平均合并 12天 11小时) (30 天内合并 661 个 PR)

描述

Manifestations:

  1. DirectoryInfo.Attributes does not include ReparsePoint
  2. DirectoryInfo.Delete fails - see dotnet/corefx#17844

Given this directory structure on an NTFS volume

E:.
+---sub
|   |   sym-to-other
|   |
|   +---junction-to-other
|   |
|   \---symd-to-other
|
\---sub_other

running dir from the Windows command line shows

04/02/2017  05:27 PM    <JUNCTION>     junction-to-other [\??\E:\link-test\sub_other]
04/02/2017  05:27 PM    <SYMLINK>      sym-to-other [E:\link-test\sub_other]
04/02/2017  05:27 PM    <SYMLINKD>     symd-to-other [..\sub_other]

Moving the NTFS device to a Linux box, ls -a from bash shows

lrwxrwxrwx 2 jeff jeff   72 Apr  3 14:10 junction-to-other -> /media/jeff/My Book/link-test/sub_other
lrwxrwxrwx 2 jeff jeff   68 Apr  3 14:10 symd-to-other -> ../sub_other
lrwxrwxrwx 2 jeff jeff  116 Apr  3 14:10 sym-to-other -> /media/jeff/My Book/.NTFS-3G/E:/link-test/sub_other

Invoking the DirectoryInfo constructor with "junction-to-other" results in a DirectoryInfo object whose Attributes property contains Directory, but not ReparsePoint. Constructors giving the other two types of symbolic link behave as expected.

   var d = new DirectoryInfo("symd-to-other");     // OK, Attributes has Directory | ReparsePoint
   var s = new DirectoryInfo("sym-to-other");      // OK, Attributes has ReparsePoint
   var j = new DirectoryInfo("junction-to-other"); // Bad, Attributes has Directory, but not ReparsePoint

贡献者指南