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

Aperta Adatta ai principianti
#60 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

Inizia da WindowsCopyOnWriteFilesystem.cs, in particolare da CopyOnWriteLinkSupportedBetweenPaths, e leggi VolumeInfoCache.cs intorno a GetVolumeForPath. Riproduci la chiamata con un file su un’unità Q: mappata; il lavoro è completato quando il metodo restituisce false invece di generare un’eccezione quando non esiste alcun volume noto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
C#
Stelle
153
Fork
9
Merge medio
10g 21h
PR unite (30g)
2

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/CopyOnWrite

Tutte le issue di microsoft/CopyOnWrite

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.