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: Lstat from Go 1.12.x returns empty filename for C:\pagefile.sys on Windows #30883

Closed
josephpaul0 opened this issue Mar 16, 2019 · 3 comments
Closed

Comments

@josephpaul0
Copy link

@josephpaul0 josephpaul0 commented Mar 16, 2019

There seem to be a regression in os.Lstat(path) function in Go 1.12 on Windows when path is "pagefile.sys" on C:\.
The behaviour is correct with Go 1.8.7.

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

go version go1.12.1 windows/amd64
go version go1.12 windows/amd64

Does this issue reproduce with the latest release?

Yes, go1.12.1 is the latest release

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

go env Output
set GOARCH=amd64
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64

What did you do?

err := os.Chdir("C:\\")
fi, err := os.Lstat("pagefile.sys")
if fi.Name() == "" {
	fmt.Println("The bug is present.")
} else {
	fmt.Println("This program works correctly.")
}

Compile and run this on Windows 7 or Windows 10 amd64:
https://play.golang.org/p/ewOhJ7ErXf5

Use Go 1.12.1, then compile again with Go 1.8.7 and see the difference.

What did you expect to see?

The filename should be "pagefile.sys"

What did you see instead?

The filename is empty with Go 1.12

@odeke-em odeke-em changed the title [windows] os.Lstat from Go 1.12.x returns empty filename for C:\pagefile.sys os: Lstat from Go 1.12.x returns empty filename for C:\pagefile.sys on Windows Mar 17, 2019
@odeke-em

This comment has been minimized.

Copy link
Member

@odeke-em odeke-em commented Mar 17, 2019

Thank you for this report @josephpaul0 and welcome to the Go project!

So you mention that this is a regression from Go1.8.7, have you tried Go1.11 or other versions?

I shall kindly page some related folks @alexbrainman @ianlancetaylor @jordanrh1

@cuonglm

This comment has been minimized.

Copy link
Contributor

@cuonglm cuonglm commented Mar 17, 2019

It seems a regression of f108158

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Mar 17, 2019

Change https://golang.org/cl/167779 mentions this issue: os: fix windows Lstat missing name for some files

@gopherbot gopherbot closed this in 9e0e9ac Mar 20, 2019
@golang golang locked and limited conversation to collaborators Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.