-
Notifications
You must be signed in to change notification settings - Fork 18k
io: add test to verify that ReadAt doesn't affect seek offset (for Plan 9 kernel bug) #14534
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
Comments
Isn't that confirmed to be a Plan 9 kernel bug? I don't think Go needs to
change anything here.
|
Yes, this is a Plan 9 bug. I've opened this issue so people could find it and figure what to do if they encounter this bug. |
We're not going to change cmd/nm or any of the other million high-level Go programs to work around Plan 9 kernel bugs. Let's repurpose this bug for several things:
|
Yes, I'll update the builders and write a test once I'll be back in two weeks. |
And of course, there was absolutely no intention to change any of the Go tool to work around this bug. |
CL https://golang.org/cl/22244 mentions this issue. |
CL https://golang.org/cl/22319 mentions this issue. |
This new Plan 9 image provides various fixes to the Plan 9 kernel. The most notable change is a fix to the pread system call, so pread will not update the channel offset when reading a file. Updates golang/go#11194. Updates golang/go#14534. Change-Id: Ia8f537b3559fbc98a191bda836cd3e0035e16eec Reviewed-on: https://go-review.googlesource.com/22319 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Based on https://golang.org/cl/22319 from 0intro. Updates golang/go#11194 Updates golang/go#14534 Change-Id: I05650d74970f1ca108c520a44a326cbe8229422e Reviewed-on: https://go-review.googlesource.com/22966 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Running
go tool nm
on object files doesn't work anymore on Plan 9:This error is returned by rd.parseObject in goobj.Parse.
It reads the "386 deve" string which doesn't match the expected "go objec" string.
It happens because objfile.Open calls debug/elf.NewFile before, which does a ReadAt of 16 bytes. However, the implementation of pread in the Plan 9 kernel contains a bug where it updates the channel offset while it shouldn't. Hence, the first 16 bytes of the files are already read before calling goobj.Parse.
This is related to #11265
This can be fixed by fixing the pread system call in the Plan 9 kernel.
A workaround is to add
Seek(0, 0)
after calling ReadAt:The text was updated successfully, but these errors were encountered: