Skip to content

Set gid 0 when no group is specified#2529

Merged
estesp merged 1 commit intocontainerd:masterfrom
crosbymichael:missing-gids
Aug 6, 2018
Merged

Set gid 0 when no group is specified#2529
estesp merged 1 commit intocontainerd:masterfrom
crosbymichael:missing-gids

Conversation

@crosbymichael
Copy link
Copy Markdown
Member

This change is to match Docker's implementaion of setting gid and groups
to 0 when no gid is specified but an explicit uid is set.

Fixes #2527

Signed-off-by: Michael Crosby [email protected]

This change is to match Docker's implementaion of setting gid and groups
to 0 when no gid is specified but an explicit uid is set.

Fixes containerd#2527

Signed-off-by: Michael Crosby <[email protected]>
@crosbymichael
Copy link
Copy Markdown
Member Author

@justincormack @ijc can you review this one please

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #2529 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2529   +/-   ##
=======================================
  Coverage   45.05%   45.05%           
=======================================
  Files          94       94           
  Lines        9796     9796           
=======================================
  Hits         4414     4414           
  Misses       4662     4662           
  Partials      720      720
Flag Coverage Δ
#linux 49.08% <0%> (ø) ⬆️
#windows 41.57% <ø> (ø) ⬆️
Impacted Files Coverage Δ
oci/spec_opts_unix.go 21.52% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd97a11...99df1a9. Read the comment docs.

@dmcgowan
Copy link
Copy Markdown
Member

dmcgowan commented Aug 6, 2018

LGTM

Add cherry pick label?

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@estesp estesp merged commit 6bf15fa into containerd:master Aug 6, 2018
Comment thread oci/spec_opts_unix.go
if err != nil {
if os.IsNotExist(err) || err == errNoUsersFound {
s.Process.User.UID, s.Process.User.GID = uid, uid
s.Process.User.UID, s.Process.User.GID = uid, 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it really correct to squash any previous non-zero GID here? Might it not be set in the base image or from a previous call to WithUser or WithUIDGID. The latter two examples are a bit weak, but the base image one I'm less sure of.

@ijc
Copy link
Copy Markdown
Contributor

ijc commented Aug 7, 2018

The comment on WithUserID reads:

 // WithUserID sets the correct UID and GID for the container based
 // on the image's /etc/passwd contents. If /etc/passwd does not exist,
 // or uid is not found in /etc/passwd, it sets gid to be the same with
 // uid, and not returns error.

Which is no longer correct.

There's also a grammar-o in the last clause to (probably should be "... and does not return an error").

ijc pushed a commit to ijc/containerd that referenced this pull request Aug 8, 2018
The behaviour was changed in 99df1a9 ("Set gid 0 when no group is
specified"), part of containerd#2529.

Take the opportunity to tighten up the grammar a bit too.

Signed-off-by: Ian Campbell <[email protected]>
estesp pushed a commit to estesp/containerd that referenced this pull request Aug 20, 2018
The behaviour was changed in 99df1a9 ("Set gid 0 when no group is
specified"), part of containerd#2529.

Take the opportunity to tighten up the grammar a bit too.

Signed-off-by: Ian Campbell <[email protected]>
Signed-off-by: Phil Estes <[email protected]>
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.

6 participants