Repository navigation
Conversation
duf silently printed an empty table for verbatim path arguments like "\\?\D:\path": filepath.Abs and filepath.EvalSymlinks preserve the verbatim prefix, so the path never matched a non-verbatim mount point. For "\\?\UNC\host\share", EvalSymlinks additionally failed with a truncated "CreateFile \\?\UNC\host: The specified path is invalid". Strip the verbatim prefix from drive-letter (\\?\X:\ -> X:\) and UNC (\\?\UNC\ -> \\) arguments before resolving them, so verbatim paths behave exactly like their canonical equivalents.
Owner
|
Yikes. Things like this make me want to drop Windows support altogether. We should at least try to move the code to a place that only gets compiled & included on Windows. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #382.
Bug
On Windows, duf silently prints an empty table (exit 0) for verbatim path arguments:
duf "\\?\D:\some\path"→ empty output —filepath.Abs/filepath.EvalSymlinkspreserve the\\?\prefix, so the path never prefix-matches any canonically-reported mount point (D:\).duf "\\?\UNC\host\share"→ misleading truncated errorCreateFile \\?\UNC\host: The specified path is invalid—EvalSymlinksitself fails mid-walk.Fix
New
stripVerbatimPrefix()infilesystems.go(guarded byruntime.GOOS == "windows"):\\?\X:\…→X:\…(drive-letter only) and\\?\UNC\host\share→\\host\share. Applied beforefilepath.Abs(soEvalSymlinksnever sees the crashing UNC-verbatim form) and again after it (covers symlinks resolving to verbatim targets).\\?\Volume{GUID}and other non-drive/UNC forms pass through untouched.Verified on real Windows
\\?\D:\wisp-portD:\table, identical toD:\wisp-port\\?\UNC\localhost\D$\…\\localhost\D$\…\\?\UNC\nonexist\share\\nonexist\share: network path not found(real path)\\?\Volume{guid}\, relative, multi-arg, no-arggo build/go vet/go test ./...green;GOOS=windowsbuild green.