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: Chtimes doesn't work on directory on Windows #8090

Closed
gopherbot opened this issue May 24, 2014 · 5 comments
Closed

os: Chtimes doesn't work on directory on Windows #8090

gopherbot opened this issue May 24, 2014 · 5 comments
Milestone

Comments

@gopherbot
Copy link

by victorvu2001:

What does 'go version' print?
go version go1.2.2 windows/amd64

Calling os.Chtimes() with a directory as an argument fails on Windows (Win8.1 64bit)
with a "Access is denied." error. This happens even if the directory exists
and all write permissions are properly set.
@gopherbot
Copy link
Author

Comment 1 by victorvu2001:

Update.
I did some digging, and the root cause seems to be in the CreateFile() call in
UtimesNano() (pkg/syscall/syscall_windows.go), specifically its use of
FILE_ATTRIBUTE_NORMAL for the dwFlagsAndAttributes parameter.
The docs for CreateFile [1] say that FILE_FLAG_BACKUP_SEMANTICS must be set to obtain a
handle to a directory. It also says that opening an existing file "ignores any file
attributes" specified, so FILE_ATTRIBUTE_NORMAL is useless.
Possible fix? https://gist.github.com/vqvu/d8332f7ce87e13879e5d
[1] http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx

@ianlancetaylor
Copy link
Contributor

Comment 2:

Labels changed: added repo-main, release-go1.4, os-windows.

@alexbrainman
Copy link
Member

Comment 3:

Sounds like a plan. Here http://golang.org/doc/contribute.html is how to contribute, if
you like. Also, please, add new test that is broken now, but will be fixed once your
change is applied. Thank you.
Alex

Status changed to Accepted.

@gopherbot
Copy link
Author

Comment 4:

CL https://golang.org/cl/154020043 mentions this issue.

@rsc
Copy link
Contributor

rsc commented Oct 6, 2014

Comment 5:

This issue was closed by revision ab724f9.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 26, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 30, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants