`CopyOnWriteLinkSupportedBetweenPaths` throws for a source on a mapped network drive

Đang mở Phù hợp với người mới
#60 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
operating-systems

Hướng nghiên cứu

Bắt đầu với WindowsCopyOnWriteFilesystem.cs, đặc biệt là CopyOnWriteLinkSupportedBetweenPaths, và đọc VolumeInfoCache.cs quanh GetVolumeForPath. Tái hiện lệnh gọi với một tệp trên ổ đĩa Q: được ánh xạ; hoàn tất khi phương thức trả về false thay vì ném ngoại lệ khi không tồn tại volume nào đã biết.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

The XML documentation of ICopyOnWriteFilesystem.CopyOnWriteLinkSupportedBetweenPaths says:

Determines whether a copy-on-write link can be created between the provided paths.

Returns: True if a link can be created, false if it cannot.

A mapped network drive does not support a link. The expected result is therefore false, not an exception. However, the method throws:

System.ArgumentException: No known volume information for 'Q:\share\big-installer.zip'. If the drive was added recently you may need to recreate the filesystem cache.
   at Microsoft.CopyOnWrite.Windows.VolumeInfoCache.GetVolumeForPath(String path) in D:\CoW\lib\Windows\VolumeInfoCache.cs:line 102
   at Microsoft.CopyOnWrite.Windows.WindowsCopyOnWriteFilesystem.CopyOnWriteLinkSupportedBetweenPaths(String source, String destination, Boolean pathsAreFullyResolved) in D:\CoW\lib\Windows\WindowsCopyOnWriteFilesystem.cs:line 46

Q: is a mapped network drive. VolumeInfoCache holds the local volumes only, so GetVolumeForPath finds no volume for the path and throws.

Steps to reproduce

  1. Map a network share to a drive letter, for example Q:.
  2. Put a file on that share.
  3. Call CopyOnWriteLinkSupportedBetweenPaths with the file on Q: as the source.

Result: the call throws ArgumentException.
Expected: the call returns false.

Suggested fix

Return false for a path with no known volume, in the same way that the volume enumeration ignores a volume that gives an error. The release history shows this pattern for other volume errors:

  • 0.3.7: ignore ACCESS_DENIED on volume enumeration.
  • 0.3.9 to 0.3.12: ignore FILE_NOT_FOUND, ERROR_NO_SUCH_DEVICE, and
    ERROR_DEV_NOT_EXIST on volume enumeration.
  • 0.4.2: ignore any volume that gives an error.

A mapped network drive is arguably the next case in this series.

Version

  • CopyOnWrite 0.5.0 (NuGet)
  • .NET 8, Windows 11
Ngôn ngữ chính
C#
Star
153
Fork
9
Merge trung bình
10 ngày 21 giờ
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/CopyOnWrite

Tất cả issue của microsoft/CopyOnWrite

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.