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

walk EOF error on Windows #70

Open
powersj opened this issue Nov 30, 2022 · 1 comment · May be fixed by #71
Open

walk EOF error on Windows #70

powersj opened this issue Nov 30, 2022 · 1 comment · May be fixed by #71

Comments

@powersj
Copy link

powersj commented Nov 30, 2022

Summary

It appears that v1.17.0 caused an EOF error to get returned from the Walk function on Windows platforms.

This was reported to Telegraf in influxdata/telegraf#11823 as updating the godirwalk library seemed to break Windows users.

Reproducer

Use the walk-fast example:

$ go run . --verbose C:/Users
d--------- C:\Users
L--------- C:\Users\All Users
d--------- C:\Users\Default
d--------- C:\Users\Default\AppData
d--------- C:\Users\Default\AppData\Local
L--------- C:\Users\Default\AppData\Local\Application Data
L--------- C:\Users\Default\AppData\Local\History
d--------- C:\Users\Default\AppData\Local\Microsoft
d--------- C:\Users\Default\AppData\Local\Microsoft\InputPersonalization
d--------- C:\Users\Default\AppData\Local\Microsoft\InputPersonalization\TrainedDataStore
EOF
exit status 1

This same behavior does not happen on Linux:

❯ go run . --verbose /home/powersj/test
d--------- /home/powersj/test
---------- /home/powersj/test/main.go
---------- /home/powersj/test/go.mod
---------- /home/powersj/test/go.sum
~/test via 🐹 v1.19.3 
❯ echo $?
0

System Info

Windows 10: go1.19.3 linux/amd64
Linux (Arch): go1.19.3 linux/amd64

powersj added a commit to powersj/godirwalk that referenced this issue Jan 31, 2023
In karrick#68, the scanner now returns any error that was encountered. On
Windows, the call to Readdir will return an EOF when it is done reading
a directory.

I believe the desired behavior is to throw an error on any actual
errors, but in the case of EOF, continue on to the next directory. As
such, check for the EOF and return no error while releasing resources.

fixes: karrick#70
@powersj powersj linked a pull request Jan 31, 2023 that will close this issue
@opstoken
Copy link

move to trash

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants