-
Notifications
You must be signed in to change notification settings - Fork 782
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
bin-local Makefile target is missing #999
Comments
|
@sethvargo As an aside, "they" is me, as I'm the lead maintainer for https://github.com/Homebrew/homebrew-core/. The
|
What is a sandbox violation? We provide pre-compiled binaries via releases.hashicorp.com. Now that homebrew cask is integrated with homebrew core, it's probably easier to download and install the binary than try to compile from source each time. |
The sandbox only permits the build to write to locations in the buildpath and in the prefix into which the software is being installed. In this case the build has explicitly set We really don't allow CLI programs in Cask with very few exceptions (e.g. the binary must be signed in order to work with Location Services). |
This is the sandbox profile that is in effect during the consul-template build:
|
That's probably because the Makefile has to parse the version.go file to pull out the version number. I'm not really sure what you're sending over, or how I can help. The dev:
@rm -f "${GOPATH}/pkg/${GOOS}_${GOARCH}/${PROJECT}/version.a" # ldflags change and go doesn't detect
@env \
CGO_ENABLED="0" \
go install \
-ldflags "${LD_FLAGS}" \
-tags "${GOTAGS}" Can you tell me what file's it's trying to write to? I think you're making an assumption that I understand how homebrew works, which is not the case. Sorry. |
OK so it's the CGO_ENABLED=0 that triggers it.
|
@sethvargo It looks like this is being caused by golang/go#18981. Maybe a make target that doesn't set CGO_ENABLED=0 would be OK with you? |
results in a successful brew build and installation. |
Compiling with CGO enabled is a security risk |
Do you have a reference for this? It seems dubious that the upstream Go defaults are a security risk in and of themselves unless something is very wrong. Moreover, I'm assuming the removal of the bin-local target was not about forcing the use of CGO_ENABLED=0. |
Our security auditors have strongly recommended we do not enable dynamic linking unless we need to link to something (which this tool does not). As one concrete example, go used to link to glibc, which had a vulnerability on Feb 16, 2015.
They aren't during cross compilation. CGO is specifically disabled during cross-compilation. However, it doesn't make sense to allow dynamic linking for local development when the final build won't be dynamically linked. That actually introduced a bug in a previous release where things worked locally for me, but the final build failed because of dynamic linking.
In part, it was, from feedback from our auditors. The previous build process also relied on a number of external scripts and bash-isms, which have been refactored out. We build pre-compiled binaries that are signed with our public GPG key and checksummed for integrity. They are guaranteed to work because we've put them through our own internal CI system. We are not going to remove the CGO_DISABLE envvar, nor will we add a target that enables compiling without it. It's a bad practice and diverges the local build from the production build. Homebrew should either:
If you choose the last option, it will be very challenging for us to support those users, since they will be building from source, using a build chain that we have no control over. |
We will have to go with (3). I wanted to continue to use the Makefile specifically so that you would retain as much control as possible, especially over the ldflags, but it looks like we're just going to have to use the ldflags defaults and hope for the best if upstream is unwilling to provide a make target that doesn't attempt to alter the user's actual Go installation. |
That's not the case. I'm refusing to provide a make target that would produce a different binary than the resulting production build. The fact that disabling CGO causes Go to recompile it's own internal packages and violates Homebrew's sandbox is a separate issue that is already reported in golang/go#18981 as you already pointed out. Once that issue is fixed, theoretically you could use |
Indeed. It just seems like a pretty unfortunate outcome in the interim. The situation in the interim is counterproductive because it leaves you with less control not more :( |
@sethvargo I have done my best to preserve the correct ldflags: https://github.com/Homebrew/homebrew-core/pull/17258/files |
@sethvargo I have now shipped 0.19.1 in Homebrew: |
The
bin-local
Makefile target that was added in #793 is now missing in v0.19.1. As a result, the Homebrew formula is broken.CC @sethvargo
The text was updated successfully, but these errors were encountered: