diff --git a/exec.go b/exec.go index d73518f6c..01c4db8d7 100644 --- a/exec.go +++ b/exec.go @@ -50,9 +50,9 @@ following will output a list of processes running in the container: Name: "user, u", Usage: "UID (format: [:])", }, - cli.StringFlag{ + cli.Int64SliceFlag{ Name: "additional-gids, g", - Usage: "additional gids separated by comma", + Usage: "additional gids", }, cli.StringFlag{ Name: "process, p", @@ -212,14 +212,8 @@ func getProcess(context *cli.Context, bundle string) (*specs.Process, error) { } p.User.UID = uint32(uid) } - if context.String("additional-gids") != "" { - for _, i := range strings.Split(context.String("additional-gids"), ",") { - gid, err := strconv.Atoi(i) - if err != nil { - return nil, fmt.Errorf("parsing %s as int for gid failed: %v", i, err) - } - p.User.AdditionalGids = append(p.User.AdditionalGids, uint32(gid)) - } + for _, gid := range context.Int64Slice("additional-gids") { + p.User.AdditionalGids = append(p.User.AdditionalGids, uint32(gid)) } return p, nil } diff --git a/man/runc-exec.8.md b/man/runc-exec.8.md index 46b266175..318d4a430 100644 --- a/man/runc-exec.8.md +++ b/man/runc-exec.8.md @@ -19,7 +19,7 @@ following will output a list of processes running in the container: --env value, -e value set environment variables --tty, -t allocate a pseudo-TTY --user value, -u value UID (format: [:]) - --additional-gids value, -g value additional gids separated by comma + --additional-gids value, -g value additional gids --process value, -p value path to the process.json --detach, -d detach from the container's process --pid-file value specify the file to write the process id to diff --git a/tests/integration/exec.bats b/tests/integration/exec.bats index c7774a0eb..b1f86a386 100644 --- a/tests/integration/exec.bats +++ b/tests/integration/exec.bats @@ -120,8 +120,8 @@ function teardown() { wait_for_container 15 1 test_busybox - runc exec --user 1000:1000 --additional-gids 100 test_busybox id + runc exec --user 1000:1000 --additional-gids 100 --additional-gids 99 test_busybox id [ "$status" -eq 0 ] - [[ ${output} == "uid=1000 gid=1000 groups=100(users)" ]] + [[ ${output} == "uid=1000 gid=1000 groups=99(nogroup),100(users)" ]] }