From b675124cf5fc96a6c329b5580ef60304089270c6 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Wed, 15 Jun 2016 14:57:34 -0700 Subject: [PATCH] Vendor in runc cc29e3dded8e27ba8f65738f40d251c885030a28 Signed-off-by: Kenfe-Mickael Laventure --- Dockerfile | 4 ++-- Dockerfile.aarch64 | 4 ++-- Dockerfile.armhf | 4 ++-- Dockerfile.gccgo | 4 ++-- Dockerfile.ppc64le | 4 ++-- Dockerfile.s390x | 4 ++-- Dockerfile.simple | 4 ++-- hack/vendor.sh | 2 +- .../runc/libcontainer/cgroups/utils.go | 20 +++++++++++++++++-- 9 files changed, 33 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index ab58e3732f..8c80b9ac15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -233,10 +233,10 @@ RUN set -x \ && rm -rf "$GOPATH" # Install runc -ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 +ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 RUN set -x \ && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ + && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ && cd "$GOPATH/src/github.com/opencontainers/runc" \ && git checkout -q "$RUNC_COMMIT" \ && make static BUILDTAGS="seccomp apparmor selinux" \ diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 2333d474fe..564d89809e 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -180,10 +180,10 @@ RUN set -x \ && rm -rf "$GOPATH" # Install runc -ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 +ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 RUN set -x \ && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ + && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ && cd "$GOPATH/src/github.com/opencontainers/runc" \ && git checkout -q "$RUNC_COMMIT" \ && make static BUILDTAGS="seccomp apparmor selinux" \ diff --git a/Dockerfile.armhf b/Dockerfile.armhf index 08b4d31d4d..291915c13c 100644 --- a/Dockerfile.armhf +++ b/Dockerfile.armhf @@ -189,10 +189,10 @@ RUN set -x \ && rm -rf "$GOPATH" # Install runc -ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 +ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 RUN set -x \ && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ + && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ && cd "$GOPATH/src/github.com/opencontainers/runc" \ && git checkout -q "$RUNC_COMMIT" \ && make static BUILDTAGS="seccomp apparmor selinux" \ diff --git a/Dockerfile.gccgo b/Dockerfile.gccgo index 03e8a2afae..dc7780e919 100644 --- a/Dockerfile.gccgo +++ b/Dockerfile.gccgo @@ -74,10 +74,10 @@ WORKDIR /go/src/github.com/docker/docker ENV DOCKER_BUILDTAGS apparmor seccomp selinux # Install runc -ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 +ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 RUN set -x \ && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ + && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ && cd "$GOPATH/src/github.com/opencontainers/runc" \ && git checkout -q "$RUNC_COMMIT" \ && make static BUILDTAGS="seccomp apparmor selinux" \ diff --git a/Dockerfile.ppc64le b/Dockerfile.ppc64le index 4ceed03da4..357f927057 100644 --- a/Dockerfile.ppc64le +++ b/Dockerfile.ppc64le @@ -204,10 +204,10 @@ RUN set -x \ && rm -rf "$GOPATH" # Install runc -ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 +ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 RUN set -x \ && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ + && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ && cd "$GOPATH/src/github.com/opencontainers/runc" \ && git checkout -q "$RUNC_COMMIT" \ && make static BUILDTAGS="apparmor seccomp selinux" \ diff --git a/Dockerfile.s390x b/Dockerfile.s390x index ebb72c91c5..c75b321db4 100644 --- a/Dockerfile.s390x +++ b/Dockerfile.s390x @@ -197,10 +197,10 @@ RUN set -x \ && rm -rf "$GOPATH" # Install runc -ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 +ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 RUN set -x \ && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ + && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ && cd "$GOPATH/src/github.com/opencontainers/runc" \ && git checkout -q "$RUNC_COMMIT" \ && make static BUILDTAGS="seccomp apparmor selinux" \ diff --git a/Dockerfile.simple b/Dockerfile.simple index 00d53bdf06..9e11bb192c 100644 --- a/Dockerfile.simple +++ b/Dockerfile.simple @@ -57,10 +57,10 @@ ENV GOPATH /go:/go/src/github.com/docker/docker/vendor ENV CGO_LDFLAGS -L/lib # Install runc -ENV RUNC_COMMIT 5ce88a95f6cf218ba7f3309562f95464a968e890 +ENV RUNC_COMMIT cc29e3dded8e27ba8f65738f40d251c885030a28 RUN set -x \ && export GOPATH="$(mktemp -d)" \ - && git clone https://github.com/crosbymichael/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ + && git clone https://github.com/opencontainers/runc.git "$GOPATH/src/github.com/opencontainers/runc" \ && cd "$GOPATH/src/github.com/opencontainers/runc" \ && git checkout -q "$RUNC_COMMIT" \ && make static BUILDTAGS="seccomp apparmor selinux" \ diff --git a/hack/vendor.sh b/hack/vendor.sh index 1159a77390..6f393d2f82 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -102,7 +102,7 @@ clone git github.com/miekg/pkcs11 df8ae6ca730422dba20c768ff38ef7d79077a59f clone git github.com/docker/go v1.5.1-1-1-gbaf439e clone git github.com/agl/ed25519 d2b94fd789ea21d12fac1a4443dd3a3f79cda72c -clone git github.com/opencontainers/runc 85873d917e86676e44ccb80719fcb47a794676a1 # libcontainer +clone git github.com/opencontainers/runc cc29e3dded8e27ba8f65738f40d251c885030a28 # libcontainer clone git github.com/opencontainers/specs v1.0.0-rc1 # specs clone git github.com/seccomp/libseccomp-golang 32f571b70023028bd57d9288c20efbcb237f3ce0 # libcontainer deps (see src/github.com/opencontainers/runc/Godeps/Godeps.json) diff --git a/vendor/src/github.com/opencontainers/runc/libcontainer/cgroups/utils.go b/vendor/src/github.com/opencontainers/runc/libcontainer/cgroups/utils.go index 491faf287e..1a7c4e1a05 100644 --- a/vendor/src/github.com/opencontainers/runc/libcontainer/cgroups/utils.go +++ b/vendor/src/github.com/opencontainers/runc/libcontainer/cgroups/utils.go @@ -262,6 +262,8 @@ func readProcsFile(dir string) ([]int, error) { return out, nil } +// ParseCgroupFile parses the given cgroup file, typically from +// /proc//cgroup, into a map of subgroups to cgroup names. func ParseCgroupFile(path string) (map[string]string, error) { f, err := os.Open(path) if err != nil { @@ -269,7 +271,12 @@ func ParseCgroupFile(path string) (map[string]string, error) { } defer f.Close() - s := bufio.NewScanner(f) + return parseCgroupFromReader(f) +} + +// helper function for ParseCgroupFile to make testing easier +func parseCgroupFromReader(r io.Reader) (map[string]string, error) { + s := bufio.NewScanner(r) cgroups := make(map[string]string) for s.Scan() { @@ -278,7 +285,16 @@ func ParseCgroupFile(path string) (map[string]string, error) { } text := s.Text() - parts := strings.Split(text, ":") + // from cgroups(7): + // /proc/[pid]/cgroup + // ... + // For each cgroup hierarchy ... there is one entry + // containing three colon-separated fields of the form: + // hierarchy-ID:subsystem-list:cgroup-path + parts := strings.SplitN(text, ":", 3) + if len(parts) < 3 { + return nil, fmt.Errorf("invalid cgroup entry: must contain at least two colons: %v", text) + } for _, subs := range strings.Split(parts[1], ",") { cgroups[subs] = parts[2]