-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: fix Windows (*os.File).Seek on directory handle #36019
Comments
Change https://golang.org/cl/210283 mentions this issue: |
This test was recently added in CL 209961. Apparently Windows can't seek a directory filehandle? And move the test from test/fixedbugs (which is mostly for compiler bugs) to an os package test. Updates #36019 Change-Id: I626b69b0294471014901d0ccfeefe5e2c7651788 Reviewed-on: https://go-review.googlesource.com/c/go/+/210283 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Keith Randall <[email protected]>
Go use FindFirstFile, FindNextFile and FindClose Windows API to implement directory reading. The API does not provide functionality to seek to random position of the directory. I don't know what the alternatives are, if any. Alex |
Change https://golang.org/cl/213439 mentions this issue: |
Updates #36019 Change-Id: I9fea2c3c5138e2233290979e4724f6e7b91da652 Reviewed-on: https://go-review.googlesource.com/c/go/+/213439 Reviewed-by: Ian Lance Taylor <[email protected]>
Could File.Seek(0, os.SeekStart) be mapped to FindFirstFile() ? |
https://linux.die.net/man/3/opendir As far as I can see the doc, Go should not support Seek for directory. |
NtQueryDirectoryFile may be of use. |
Yes. But people will still complain that File.Seel(1, os.SeekStart) fails. So, lets not pretend.
Yes, it might work. But is all extra new code worth ability to File.Seek? Alex |
Well you could FindNextFile() in a loop for i < seek_pos? |
I don't understand what you are proposing. Please, send a CL with the change, if you know what to do. Thank you. Alex |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Punting to Go1.17 as we didn’t get much action for the Go1.16 development cycle. |
Change https://go.dev/cl/405275 mentions this issue: |
Change https://go.dev/cl/458336 mentions this issue: |
TestReaddirSmallSeek should have been reenabled as part of CL 405275, but didn't. Do it now. Updates #36019 Change-Id: I5676eee4e63675d30e9d48ac708e72bd036b6aee Reviewed-on: https://go-review.googlesource.com/c/go/+/458336 Reviewed-by: Alex Brainman <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Quim Muntal <[email protected]> Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-by: David Chase <[email protected]>
Half of our Windows builders (windows-386-2008, windows-amd64-2016, windows-amd64-longtest) fail to seek an *os.File opened on a directory.
But windows-amd64-2008 and windows-amd64-2012 work.
Figure this out and re-enable the test on Windows. (The test was added late in the Go 1.14 cycle, just before beta)
The text was updated successfully, but these errors were encountered: