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

os: os.Stat("*.txt") expands wildcard on Windows #24999

Closed
mattn opened this issue Apr 23, 2018 · 2 comments
Closed

os: os.Stat("*.txt") expands wildcard on Windows #24999

mattn opened this issue Apr 23, 2018 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Milestone

Comments

@mattn
Copy link
Member

mattn commented Apr 23, 2018

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

go version devel +d11df8baa8 Sun Apr 22 22:32:11 2018 +0000 windows/amd64

Does this issue reproduce with the latest release?

Yes

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

Windows7 64bit

What did you do?

package main

import (
	"fmt"
	"os"
)

func main() {
	fmt.Println(os.Stat("*.go"))
}

What did you expect to see?

return error

What did you see instead?

not return error

This is broken in e83601b, I guess. FindFirstFile resolve wildcard. So if *.go exists, os.Stat("*.go") doesn not fail.

This wildcard must no be accepted.

cc: @alexbrainman

@mattn mattn changed the title os: os.Stat("*.txt") successed os: os.Stat("*.txt") successed on Windows Apr 23, 2018
@mikioh mikioh changed the title os: os.Stat("*.txt") successed on Windows os: os.Stat("*.txt") succeeds on Windows Apr 23, 2018
@gopherbot
Copy link

Change https://golang.org/cl/108755 mentions this issue: os: check error ERROR_INVALID_NAME from GetFileAttributeEx in os.Stat("*.txt")

@gopherbot
Copy link

Change https://golang.org/cl/108776 mentions this issue: os: check error ERROR_INVALID_NAME from GetFileAttributeEx in os.Stat("*.txt")

@FiloSottile FiloSottile changed the title os: os.Stat("*.txt") succeeds on Windows os: os.Stat("*.txt") expands wildcard on Windows Apr 23, 2018
@FiloSottile FiloSottile added this to the Go1.11 milestone Apr 23, 2018
@FiloSottile FiloSottile added the NeedsFix The path to resolution is known, but the work has not been done. label Apr 23, 2018
@golang golang locked and limited conversation to collaborators Apr 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. OS-Windows
Projects
None yet
Development

No branches or pull requests

4 participants