Skip to content

x/sys/unix: BTRFS_SUPER_MAGIC overflows Statfs_t.Type's type on 32-bit platforms #52061

@greatroar

Description

@greatroar

What version of Go are you using (go version)?

$ go version
go version go1.18 linux/amd64

What did you do?

func isBtrfs(info *unix.Statfs_t) bool { return info.Type == unix.BTRFS_SUPER_MAGIC }

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:

./fstype.go:7:62: unix.BTRFS_SUPER_MAGIC (untyped int constant 2435016766) overflows int32

Statfs_t.Type is an int32 or int64, depending on the platform. Maybe the constant should be typed accordingly?

Ref restic/restic#3687.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions