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

x/sys/unix: syscall_dragonfly.go broken #20055

Closed
stuartnelson3 opened this issue Apr 20, 2017 · 3 comments
Closed

x/sys/unix: syscall_dragonfly.go broken #20055

stuartnelson3 opened this issue Apr 20, 2017 · 3 comments

Comments

@stuartnelson3
Copy link

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

go version go1.8 dragonfly/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="dragonfly"
GOOS="dragonfly"
GOPATH="/home/stuartnelson"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/dragonfly_amd64"
CC="cc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build485800045=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

Try to compile any project importing golang.org/x/sys after this commit: golang/sys@9a7256c

What did you expect to see?

My program to successfully compile.

What did you see instead?

# github.com/prometheus/alertmanager/vendor/golang.org/x/sys/unix
vendor/golang.org/x/sys/unix/syscall_dragonfly.go:60: Dirent literal.Ino undefined (type Dirent has no field or method Ino)
vendor/golang.org/x/sys/unix/syscall_dragonfly.go:60: invalid expression unsafe.Sizeof(Dirent literal.Ino)
vendor/golang.org/x/sys/unix/syscall_dragonfly.go:68: constant -8 overflows uint64
!! command failed: build -o amtool -ldflags -X github.com/prometheus/alertmanager/vendor/github.com/prometheus/common/version.Version=0.5.1 -X github.com/prometheus/alertmanager/vendor/github.com/prometheus/common/version.Revision=68e1cbe024b327dba9eb6d9241282c3e68469968 -X github.com/prometheus/alertmanager/vendor/github.com/prometheus/common/version.Branch=master -X github.com/prometheus/alertmanager/vendor/github.com/prometheus/common/version.BuildUser=stuartnelson@stuart.local -X github.com/prometheus/alertmanager/vendor/github.com/prometheus/common/version.BuildDate=20170420-17:49:51  -extldflags '-static' -a -tags netgo github.com/prometheus/alertmanager/cmd/amtool: exit status 2

The first error on syscall_dragonfly.go:60 is easy to fix, just change change Ino to Fileno. The other issue on line 68 I have no context for, however.

Let me know if I can provide any additional information.

@bradfitz bradfitz changed the title /sys/unix/syscall_dragonfly.go broken x/sys/unix: syscall_dragonfly.go broken Apr 20, 2017
@bradfitz
Copy link
Contributor

/cc @niconegoto @neild

@gopherbot gopherbot added this to the Unreleased milestone Apr 20, 2017
@stuartnelson3
Copy link
Author

It appears the issue is:

diff --git a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
index 3363456..e76ab71 100644
--- a/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
+++ b/vendor/golang.org/x/sys/unix/syscall_dragonfly.go
@@ -57,7 +57,7 @@ func nametomib(name string) (mib []_C_int, err error) {
 }
 
 func direntIno(buf []byte) (uint64, bool) {
-   return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
+ return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
 }
 
 func direntReclen(buf []byte) (uint64, bool) {
@@ -65,7 +65,7 @@ func direntReclen(buf []byte) (uint64, bool) {
        if !ok {
                return 0, false
        }
-   return (16 + namlen + 1 + 7) & ^7, true
+ return (16 + namlen + 1 + 7) &^ 7, true
 }
 
 func direntNamlen(buf []byte) (uint64, bool) {

So the &^ was separated accidentally.

stuartnelson3 added a commit to prometheus/alertmanager that referenced this issue Apr 21, 2017
I can't be bothered to go through the mountain of
steps to commit this tiny change.

golang/go#20055
@gopherbot
Copy link

CL https://golang.org/cl/41672 mentions this issue.

daftaupe referenced this issue in daftaupe/DeltaPorts Dec 20, 2017
Signed-off-by: Pierre-Alain TORET <pierre-alain.toret@protonmail.com>
@golang golang locked and limited conversation to collaborators Apr 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants