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

貢獻者指南