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

Could not compile: constant overflows int #4

Closed
utsavm9 opened this issue Feb 23, 2021 · 3 comments
Closed

Could not compile: constant overflows int #4

utsavm9 opened this issue Feb 23, 2021 · 3 comments

Comments

@utsavm9
Copy link

utsavm9 commented Feb 23, 2021

Got this error while compiling:

| # github.com/anatol/luks.go
| /home/utsav/go/pkg/mod/github.com/anatol/luks.go@v0.0.0-20210208171804-d44366ded8ec/dm.go:36:19: constant 3241737475 overflows int
| /home/utsav/go/pkg/mod/github.com/anatol/luks.go@v0.0.0-20210208171804-d44366ded8ec/dm.go:59:19: constant 3241737481 overflows int
| /home/utsav/go/pkg/mod/github.com/anatol/luks.go@v0.0.0-20210208171804-d44366ded8ec/dm.go:65:19: constant 3241737478 overflows int
| /home/utsav/go/pkg/mod/github.com/anatol/luks.go@v0.0.0-20210208171804-d44366ded8ec/luks.go:107:16: constant 3241737476 overflows int

I believe I am using go version go1.14.7 linux/amd64, but I might be wrong.

Do you happen to know how can I get past this?

@anatol
Copy link
Owner

anatol commented Feb 23, 2021

What platform do you use? Is it some 32bit ARM? Show me your uname -a.

@utsavm9
Copy link
Author

utsavm9 commented Feb 23, 2021

I believe that must be the case. I do not completely understand the build system I am working with, so it might take me a while to confirm that. Do you suspect this issue to occur in 32-bit Go?

By the way, when I try this on 64-bit machine, it does work.

@anatol
Copy link
Owner

anatol commented Feb 23, 2021

I believe it fails due to the difference between 32 and 64bit platforms.

The fix would be:

diff --git a/dm.go b/dm.go
index 3262431..ec79b03 100644
--- a/dm.go
+++ b/dm.go
@@ -82,7 +82,7 @@ type targetSpec struct {
 // This flag is later processed by rules at /usr/lib/udev/rules.d/10-dm.rules
 // Per devicecrypt sourcecode only RESUME, REMOVE, RENAME operations need to have DM_UDEV_PRIMARY_SOURCE_FLAG
 // flag set.
-func dmIoctl(controlFile *os.File, cmd int, name string, uuid string, udevEvent bool, specs []targetSpec) error {
+func dmIoctl(controlFile *os.File, cmd uint64, name string, uuid string, udevEvent bool, specs []targetSpec) error {
        const (
                // allocate buffer large enough for dmioctl + specs
                alignment = 8

I will apply it once I carefully test it.

@utsavm9 utsavm9 changed the title Could not compile Could not compile: constant overflows int Feb 23, 2021
@anatol anatol closed this as completed in 260e7ac Feb 24, 2021
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

No branches or pull requests

2 participants