Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

path/filepath: regression in filepath.VolumeName #64101

Closed
ncw opened this issue Nov 13, 2023 · 1 comment
Closed

path/filepath: regression in filepath.VolumeName #64101

ncw opened this issue Nov 13, 2023 · 1 comment

Comments

@ncw
Copy link
Contributor

ncw commented Nov 13, 2023

What version of Go are you using (go version)?

go version go1.21.4 linux/amd64

Does this issue reproduce with the latest release?

Yes (with the latest stable release).

What operating system and processor architecture are you using (go env)?

I've been cross compiling on Linux and running on my Windows 10 VM. This also fails on Github CI.

What did you do?

I compiled and ran this program

package main

import (
	"fmt"
	"path/filepath"
)

func main() {
	fmt.Println(filepath.VolumeName(`\\?\C:`))
}

What did you expect to see?

I expected it to print \\?\C: like it does under go1.21.3

What did you see instead?

However it prints \\? under go1.21.4

Discussion

I noticed this regression when github CI upgraded from go1.21.3 to go1.21.4

I used git bisect to discover the commit that breaks the tests is this one by @neild

9e933c1 - path/filepath: fix various issues in parsing Windows paths

I think \\?\C: is not a valid path in Windows, at least I get this under CMD

Z:\>dir \\?\C:
"\\?\C:" is not a recognized device.
The filename, directory name, or volume label syntax is incorrect.

This issue is probably only of academic interest since \\?\C: is not a valid Windows path, but I'm reporting it as a FYI - feel free to close!

ncw added a commit to rclone/rclone that referenced this issue Nov 13, 2023
In ths security related issue the go1.21.4 stdlib changed the parsing
of volume names on Windows.

golang/go#63713

This had the consequences of breaking the MkdirAll tests which were
looking for specific error messages which changed and using invalid
paths.

In particular under go1.21.3:

    filepath.VolumeName(`\\?\C:`) == `\\?\C:`

But under go1.21.4 it is:

    filepath.VolumeName(`\\?\C:`) == `\\?`

The path `\\?\C:` isn't actually a valid Windows path. I reported this
as a FYI bug upstream - I'm not expecting it to be fixed.

See: golang/go#64101
@bcmills
Copy link
Contributor

bcmills commented Nov 13, 2023

Duplicate of #64028

@bcmills bcmills marked this as a duplicate of #64028 Nov 13, 2023
@bcmills bcmills closed this as not planned Won't fix, can't repro, duplicate, stale Nov 13, 2023
ncw added a commit to rclone/rclone that referenced this issue Nov 14, 2023
In ths security related issue the go1.21.4 stdlib changed the parsing
of volume names on Windows.

golang/go#63713

This had the consequences of breaking the MkdirAll tests which were
looking for specific error messages which changed and using invalid
paths.

In particular under go1.21.3:

    filepath.VolumeName(`\\?\C:`) == `\\?\C:`

But under go1.21.4 it is:

    filepath.VolumeName(`\\?\C:`) == `\\?`

The path `\\?\C:` isn't actually a valid Windows path. I reported this
as a FYI bug upstream - I'm not expecting it to be fixed.

See: golang/go#64101
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants