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

go-fuzz-build: embed support packages in binary? #252

Open
josharian opened this issue Jun 17, 2019 · 5 comments
Open

go-fuzz-build: embed support packages in binary? #252

josharian opened this issue Jun 17, 2019 · 5 comments

Comments

@josharian
Copy link
Collaborator

It'd be nice if we could embed the support packages go-fuzz-build needs into the binary, rather than relying on the go tool being able to find them on disk. See discussion at golang/go#30515 (comment) and the following few comments.

https://go-review.googlesource.com/c/tools/+/172409/ added "package overlay" support to go/packages. This is a reminder issue to experiment with whether it would suffice for embedding our support packages, and if so, to start using it.

@thepudds
Copy link
Collaborator

@josharian Is the thinking that this would be the best approach (now that overlays of entire packages are supported):

Use codegen to embed the support package into go-fuzz-build and use go/packages overlays (ugh, plus IIUC this doesn’t work because you can only overlay files, not entire packages)

That is excerpt from your comment at golang/go#30515 (comment)

@josharian
Copy link
Collaborator Author

That’s what I was thinking, yes. I definitely still have an “ugh” reaction to it, but it should be reliable and simple for go-fuzz users.

@thepudds
Copy link
Collaborator

thepudds commented Oct 7, 2019

Most likely this can be done with the go-bindata-assetfs package, which is already vendored.

Here is a sample go:generate in the current go-fuzz that could be used as a starting point for anyone interested in investigating this.

go-fuzz/go-fuzz/main.go

Lines 23 to 26 in 1810d38

//go:generate go build github.com/dvyukov/go-fuzz/go-fuzz/vendor/github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs
//go:generate ./go-bindata-assetfs assets/...
//go:generate goimports -w bindata_assetfs.go
//go:generate rm go-bindata-assetfs

@thepudds
Copy link
Collaborator

@josharian fyi, I filed #279 to track a potentially related issue.

I suspect you might have been using https://github.com/kevinburke/go-bindata installed locally on your machine in the most recent go generate run in 1e7aea5... does that seem plausible?

If #279 is indeed an issue, do you think it would be OK to treat that as a separate pre-existing issue that does not gate any attempt here (in other words, to rely on a local installation of go-bindata in order to help embed the support packages here), or do you think #279 should be addressed before trying to resolve this issue here?

All that said, #279 might just be me being confused, so maybe it is a non-issue.

@josharian
Copy link
Collaborator Author

No need to gate progress here on #279, although I suspect that in practice you might choose to. Up to you.

Thanks for looking into this.

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