microsoft / microsoft/CopyOnWrite
`CopyOnWriteLinkSupportedBetweenPaths` throws for a source on a mapped network drive
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 153
- Forks
- 9
- Avg merge
- 10d 21h
- Merged PRs (30d)
- 2
Description
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
- Map a network share to a drive letter, for example
Q:. - Put a file on that share.
- Call
CopyOnWriteLinkSupportedBetweenPathswith the file onQ: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_DENIEDon volume enumeration. - 0.3.9 to 0.3.12: ignore
FILE_NOT_FOUND,ERROR_NO_SUCH_DEVICE, and
ERROR_DEV_NOT_EXISTon 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
CopyOnWrite0.5.0 (NuGet)- .NET 8, Windows 11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with WindowsCopyOnWriteFilesystem.cs, especially CopyOnWriteLinkSupportedBetweenPaths, and read VolumeInfoCache.cs around GetVolumeForPath. Reproduce the call with a file on a mapped Q: drive; done means the method returns false instead of throwing when no known volume exists.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100