vault
vault copied to clipboard
`make bin` fails
Hi,
make bin fails to build freebsd and openbsd versions:
Mac OSX Yosemite
go version go1.4.2 darwin/amd64 (installed with brew install go --with-cc-all)
➜ vault git:(master) ✗ make dev
go generate ./...
==> Getting dependencies...
==> Removing old directory...
==> Building...
Number of parallel builds: 24
--> darwin/amd64: github.com/hashicorp/vault
==> Results:
total 14M
➜ vault git:(master) ✗ make bin
go generate ./...
==> Getting dependencies...
==> Removing old directory...
==> Building...
Number of parallel builds: 24
--> linux/386: github.com/hashicorp/vault
--> linux/amd64: github.com/hashicorp/vault
--> linux/arm: github.com/hashicorp/vault
--> darwin/386: github.com/hashicorp/vault
--> darwin/amd64: github.com/hashicorp/vault
--> windows/386: github.com/hashicorp/vault
--> windows/amd64: github.com/hashicorp/vault
--> freebsd/386: github.com/hashicorp/vault
--> freebsd/amd64: github.com/hashicorp/vault
--> freebsd/arm: github.com/hashicorp/vault
--> openbsd/386: github.com/hashicorp/vault
--> openbsd/amd64: github.com/hashicorp/vault
5 errors occurred:
--> freebsd/amd64 error: exit status 2
Stderr: # github.com/hashicorp/vault/helper/password
helper/password/password.go:29: undefined: read
--> freebsd/386 error: exit status 2
Stderr: # github.com/hashicorp/vault/helper/password
helper/password/password.go:29: undefined: read
--> openbsd/amd64 error: exit status 2
Stderr: # github.com/hashicorp/vault/helper/password
helper/password/password.go:29: undefined: read
--> freebsd/arm error: exit status 2
Stderr: # github.com/hashicorp/vault/helper/password
helper/password/password.go:29: undefined: read
--> openbsd/386 error: exit status 2
Stderr: # github.com/hashicorp/vault/helper/password
helper/password/password.go:29: undefined: read
Offending line seems to be:
var result string
var resultErr error
doneCh := make(chan struct{})
go func() {
defer close(doneCh)
result, resultErr = read(f) <--- Here
}()
diff --git a/helper/password/password.go b/helper/password/password.go
index 754eef9..2d953f7 100644
--- a/helper/password/password.go
+++ b/helper/password/password.go
@@ -26,7 +26,20 @@ func Read(f *os.File) (string, error) {
doneCh := make(chan struct{})
go func() {
defer close(doneCh)
- result, resultErr = read(f)
+ // get the file size
+ stat, err := f.Stat()
+ if err != nil {
+ return
+ }
+
+ // read the file
+ bs := make([]byte, stat.Size())
+ _, resultErr = f.Read(bs)
+ if err != nil {
+ return
+ }
+
+ result = string(bs)
}()
// Wait on either the read to finish or the signal to come through
Seems to fix the issue:
➜ vault git:(master) ✗ make bin
go generate ./...
==> Getting dependencies...
==> Removing old directory...
==> Building...
Number of parallel builds: 24
--> linux/386: github.com/hashicorp/vault
--> linux/amd64: github.com/hashicorp/vault
--> linux/arm: github.com/hashicorp/vault
--> darwin/386: github.com/hashicorp/vault
--> darwin/amd64: github.com/hashicorp/vault
--> windows/386: github.com/hashicorp/vault
--> windows/amd64: github.com/hashicorp/vault
--> freebsd/386: github.com/hashicorp/vault
--> freebsd/amd64: github.com/hashicorp/vault
--> freebsd/arm: github.com/hashicorp/vault
--> openbsd/386: github.com/hashicorp/vault
--> openbsd/amd64: github.com/hashicorp/vault
==> Packaging...
--> darwin_386
adding: vault (deflated 70%)
--> darwin_amd64
adding: vault (deflated 74%)
--> freebsd_386
adding: vault (deflated 70%)
--> freebsd_amd64
adding: vault (deflated 74%)
--> freebsd_arm
adding: vault (deflated 71%)
--> linux_386
adding: vault (deflated 70%)
--> linux_amd64
adding: vault (deflated 74%)
--> linux_arm
adding: vault (deflated 71%)
--> openbsd_386
adding: vault (deflated 70%)
--> openbsd_amd64
adding: vault (deflated 74%)
--> windows_386
adding: vault.exe (deflated 70%)
--> windows_amd64
adding: vault.exe (deflated 74%)
==> Results:
total 14M
-rwxr-xr-x 1 apackeer staff 14M May 1 18:36 vault
Will send pull request...
I had this problem on SmartOS (illumos) as well. The patch fixed it for me.
Fixed by not compiling for freebsd/openbsd. If you want to support those platforms please submit a patch to allow for echo-less reading.
The patch above works but isn't ideal since the point of helper/password is to provide echo-less password input