Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
os: Chtimes doesn't work on directory on Windows #8090
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.
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  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  http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx