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

Update keyctl for other arches #675

Merged
merged 1 commit into from
Aug 5, 2019
Merged

Conversation

nalind
Copy link
Member

@nalind nalind commented Aug 2, 2019

Use definitions from golang.org/x/sys/unix to get the keyctl package building on other Linux architectures.

Use definitions from golang.org/x/sys/unix to get the keyctl package
building on other Linux architectures.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
@nalind
Copy link
Member Author

nalind commented Aug 2, 2019

@QiWang19 PTAL. I'm not sure why we have a copy of github.com/jsipprell/keyctl instead of vendoring it as a dependency.

@mtrmac
Copy link
Collaborator

mtrmac commented Aug 2, 2019

WRT having a copy, see the earlier conversation in #619 ; things did not out quite as painless as expected.

@nalind
Copy link
Member Author

nalind commented Aug 2, 2019

Ah, okay. I missed that detail while skimming it earlier. Thanks!

Copy link
Collaborator

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

ACK, basically just asking about the ID return type. Arguably no-one cares (there probably aren’t any external users in the few days this has been released) and we can merge this as is.

func (k *Key) ID() int32 {
return int32(k.id)
func (k *Key) ID() int {
return int(k.id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking, this is an API break. Do we need to change this? int would certainly be more idiomatic Go; still, the kernel key_serial_t is an int32_t, so this does not seem to hurt anything.

Same for ID.ID / Keyring.ID.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you're right. The APIs in golang.org/x/sys/unix use int for key types, so I changed the package to match without considering that.

}
return int32(r1), nil
func (id keyID) ID() int {
return int(id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: AFAICS this method can be safely dropped; all keyID values are private, so no external caller can call this (and internal ones just use int(keyID) AFAICS.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right - the only consumer I'm aware of is elsewhere in the library. Would you like a follow-up PR?

@@ -3,11 +3,14 @@
// license that can be found in the LICENSE file.

// +build linux
// +build 386 amd64

// Package keyctl is a Go interface to linux kernel keyrings (keyctl interface)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking, RFC: Maybe add a note here that the package is deprecated, and most callers should call x/sys/unix directly.

@rhatdan
Copy link
Member

rhatdan commented Aug 3, 2019

LGTM with @mtrmac comments.

@TomSweeneyRedHat
Copy link
Member

Addresses: containers/buildah#1762

@vrothberg
Copy link
Member

Thanks for the fix, @nalind!

@mtrmac, maybe we can add cross-compilation to the CI?

@rhatdan rhatdan merged commit dd01136 into containers:master Aug 5, 2019
@vrothberg
Copy link
Member

@mtrmac 's comments were not yet addressed.

@TomSweeneyRedHat
Copy link
Member

Once the dust settles I'm assuming we're respinning 3.0.0 or 3.0.1?

@vrothberg
Copy link
Member

3.0.1 ... 3.0.0 is already out

@nalind nalind deleted the keyctl-arches branch August 5, 2019 14:08
@mtrmac mtrmac mentioned this pull request Aug 5, 2019
@mtrmac
Copy link
Collaborator

mtrmac commented Aug 5, 2019

Follow-up: #676. PTAL.

@mtrmac
Copy link
Collaborator

mtrmac commented Aug 5, 2019

@mtrmac, maybe we can add cross-compilation to the CI?

We do have cross-OS compilation in there. Cross-architecture is not trivial:

$ GOOS=linux GOARCH=arm64 go build -tags containers_image_openpgp ./...
vendor/github.com/containers/storage/drivers/overlay/overlay.go:21:2: build constraints exclude all Go files in $GOPATH/src/github.com/containers/image/vendor/github.com/containers/storage/drivers/quota
# exclude_graphdriver_overlay is not really representative, but let’s try:
macOS $ GOOS=linux GOARCH=arm64 go build -tags 'containers_image_openpgp exclude_graphdriver_overlay' ./...
# github.com/containers/image/vendor/github.com/containers/storage/pkg/loopback
vendor/github.com/containers/storage/pkg/loopback/attach_loopback.go:21:36: undefined: LoNameSize
# and many other failures

I guess the macOS failures could go away on a Linux box, and c/image CI maybe does not need to worry about representative c/storage builds.

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

Successfully merging this pull request may close these issues.

5 participants