-
Notifications
You must be signed in to change notification settings - Fork 955
os: implement readdir for darwin and linux #2499
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: implement readdir for darwin and linux #2499
Conversation
f82a567
to
86de1fb
Compare
86de1fb
to
1dab270
Compare
The i386 problem this ran into in CI may be related to #1906 It can be reproduced with the commands
in this branch, but not in dev. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Large patch, but almost all of it seems to be from upstream Go. And it has tests, which pass. 👍
Something not working quite right here: https://github.com/tinygo-org/tinygo/runs/4845686957?check_suite_focus=true#step:17:420
|
Yes, see #2499 (comment) The real fix may involves Ayke's fix for #1906 Until then, maybe I could figure out some clever way to exclude the architectures with the problem...? |
Needs a tiny bit more cleanup. Also can't land until the go assembly feature lands. So marking draft again for now. |
13185f8
to
daf1d2a
Compare
Rebased atop #2571 for the seek fix |
baff248
to
3ea7a36
Compare
#2571 should land first, but otherwise this is ready for review. |
57e9d46
to
6902f91
Compare
6902f91
to
41ce6b7
Compare
I think this is ready, now that I've tested it with io/fs and fixed the problem this found on Darwin. |
readdir is disabled on linux for 386 and arm until syscall.seek is implemented there. windows is hard, so leaving that for later. File src/os/dir_other_go115.go can be deleted when we drop support for go 1.15. Also adds TestReadNonDir, which was helpful while debugging.
It's wafer-thin :-) Includes smoke test from upstream. TODO: once t.TempDir is implemented, add io/fs to the list of standard library tests to run; that's a better test.
41ce6b7
to
e9fd684
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks @dkegel-fastly and @dgryski now merging. |
name string | ||
} | ||
|
||
func NewFile(fd FileHandle, name string) *File { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This differs from Go in taking an interface for fd
instead of a uintptr
, which seems to break if passing, e.g., file descriptor 3 as done in Go 1.18's fuzzing code (cf. #2515)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC that was taken straight from upstream? Maybe upstream has changed, or maybe I'm misremembering.
Either way, please file a bug and we can sort it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, it's been that way for 10 years, it appears. I'll just open a PR as I've already made the changes locally.
Other operating systems are left as an exercise for the reader :-)