Scratching Your Own Itches
COPR Problems
Incus and LXD are packaged for Fedora in a COPR. I started there and found an issue describing the current build failure for the latest release of Incus.
The issue mentions that the build fails when running from the code downloaded from the GitHub release of Incus, but not when running from the Makefile. The issue also includes the build failure output which will look familiar to Go developers:
_build/src/github.com/lxc/incus/vendor/github.com/openfga/go-sdk/oauth2/clientcredentials/clientcredentials.go:19:5:
code in directory /builddir/build/BUILD/incus-0.3/_build/src/github.com/lxc/incus/vendor/github.com/openfga/go-sdk/oauth2 expects import "golang.org/x/oauth2"
The OpenFGA Go SDK includes a copy of Go's oauth2 package, which lives at golang.org/x/oauth2
. Including this code in their SDK is perfectly legal, and all the appropriate license headers are included. BUT...
The package declaration has a canonical import statement that still references the golang.org/x/oauth2
package. Incus is importing the openfga/go-sdk/oauth2
package, but Go's tooling is rightly resolving that to golang.org/x/oauth2 because that's what the code tells it to do. Therefore the OpenFGA code is never imported. This issue doesn't appear when building from source because the Go tooling just does the correct thing for you while it's resolving dependencies. But the Incus releases have vendored dependencies. The import in Incus references the OpenFGA package, but the golang.org/x
package is what is getting vendored.
I started writing a comment in the COPR repository describing why this is broken and where to get it fixed when I realized it was just a few minutes of work to do it myself.
So I opened an issue on the OpenFGA repo. Then I opened a pull request referencing that issue. Then I opened an issue on the Incus repository notifying them of the upstream problem.
The OpenFGA team merged the pull request and cut a new release within 10 minutes. The Incus team acknowledged the issue and promised to include the updated OpenFGA library in the upcoming 0.4.0 release. That release is due tomorrow, so in theory the COPR build of Incus 0.4.0 will work at that time.
It took me less than 15 minutes to identify the problem, notify responsible and interested parties, create a fix and push the pull request.
I'll end up with an updated version of Incus in the next day or two, and everyone else who uses Incus on Fedora will get it too.
Sometimes OSS is about creating wins for everyone by scratching your own itch.