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
x/sys/unix: BTRFS_SUPER_MAGIC overflows Statfs_t.Type's type on 32-bit platforms #52061
Comments
This seems like a specific case of a general problem, and I'm not sure what the general answer is. There is an awkward mismatch between Go and C when it comes to constant overflow. C silently wraps, Go does not. |
Our ad hoc solution is to cast to int64(uint(info.Type)). Getting that cast right is tricky enough to warrant a convenience method, IMHO. |
FWIW, I'm unsure if the types for the
|
The type on amd64 is correct:
prints 8. |
What I wanted to point out was that the manpage advises programmers to use an unsigned int, on amd64 in Go Type is of Am I missing something? |
The type of the |
What version of Go are you using (
go version
)?What did you do?
What did you expect to see?
Code compiles on all platforms.
What did you see instead?
The code compiles on amd64 and arm64, but on 386 and arm it fails:
Statfs_t.Type is an int32 or int64, depending on the platform. Maybe the constant should be typed accordingly?
Ref restic/restic#3687.
The text was updated successfully, but these errors were encountered: