-
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: regression with reading empty root directories on Windows with go1.21rc2 #61159
Comments
Can reproduce the issue. Will investigate so we have a path forward before go1.21. |
@qmuntal do you need a simpler repro? I was going to make one today but if you don't need it I won't bother. |
I would welcome a simpler repro that doesn't require WinFSP so that it could be added to the |
I've been using this little program to test with package main
import (
"fmt"
"io/ioutil"
"os"
"time"
)
func main() {
if len(os.Args) < 2 {
fmt.Println("Need directory as parameter")
return
}
dir := os.Args[1]
for {
entries, err := ioutil.ReadDir(dir)
fmt.Println("entries", entries)
fmt.Println("err", err)
time.Sleep(time.Second)
}
} And leaving it running in a powershell window as this where
The problem reproduces if in another window we use rclone to mount an empty folder on Q:
Giving errors
Adding a file in the directory causes the error to go away. Removing it causes it to come back. Using
Looking with With
But with
So the rclone mount is not adding the This is arguably a bug in rclone - it should really be adding the However it is a regression in |
I think I got it. When reading a directory, we use Lines 81 to 86 in 5b72f45
We should also be ignoring |
Thanks for the samples @ncw. Seen them after posting my last reply.
Not sure if it is a bug in rclone, MS-FSA 2.1.5.6.3 says that
I guess that I'll submit a fix, although I'm not sure if I'll be able to add a test case, can't depend on WinFSP in the standard library. |
Thanks @qmuntal
Rclone is adding the So I suspect @billziss-gh (developer of WinFSP) has read that doc too!
Yes a test for this is quite hard I think unless we can find some builtin windows way of creating a drive letter like this. I'm happy to give it a test when you are ready. |
I've submitted https://go-review.googlesource.com/c/go/+/507775, which fixes the failing rclone test on my computer. Would be great if you could run the relevant rclone test suite using that CL. |
Change https://go.dev/cl/507775 mentions this issue: |
This is all looking good - thank you :-) |
GetFileInformationByHandleEx can return `ERROR_FILE_NOT_FOUND` when no files were found in a root directory, as per MS-FSA 2.1.5.6.3 [1]. This error code should not be treated as an error, but rather as an indication that no files were found, in which case `readdir` should return an empty slice. This CL doesn't add any test as it is difficult to trigger this error code. Empty root directories created using Windows utilities such as `net use` always report at least the optional `.` and `..` entries. A reproducer is provided in golang#61159, but it requires WinFSP to be installed. Fixes golang#61159 [1] https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-fsa/fa8194e0-53ec-413b-8315-e8fa85396fd8 Change-Id: Id46452030f5355c292e5b0abbf5e22af434a84d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/507775 Reviewed-by: Nick Craig-Wood <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Quim Muntal <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]> Reviewed-by: Bryan Mills <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
It reproduces with tip also at 5b72f45
What operating system and processor architecture are you using (
go env
)?I've been cross compiling for my Windows VM
go env
OutputWhat did you do?
This problem was spotted by the rclone test suite.
To reproduce (Windows only)
You will need WinFSP installed too.
What did you expect to see?
I expected this test to pass
What did you see instead?
Output which looks like this
Using a combination of bisect and reverting suspicious commits I managed to work out that it is caused by this commit by @qmuntal
The current reproducer is unsatisfactory so I will try to narrow it down tomorrow.
Any ideas much appreciated though!
See: rclone/rclone#7100
The text was updated successfully, but these errors were encountered: