ソースを参照

bump containerd/go-runc e029b79d8cda8374981c64eba71f28ec38e5526f

- github.com/containerd/go-runc https://github.com/containerd/go-runc/compare/7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad...e029b79d8cda8374981c64eba71f28ec38e5526f
  - containerd/go-runc#52 Fix Method of judging command execution failure
    - fixes "init.pid: no such file or directory: unknown" errors
  - containerd/go-runc#54 avoid setting NOTIFY_SOCKET from calling process

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Sebastiaan van Stijn 6 年 前
コミット
1617be92d3

+ 1 - 1
vendor.conf

@@ -122,7 +122,7 @@ github.com/containerd/fifo                          a9fb20d87448d386e6d50b1f2e1f
 github.com/containerd/continuity                    aaeac12a7ffcd198ae25440a9dff125c2e2703a7
 github.com/containerd/continuity                    aaeac12a7ffcd198ae25440a9dff125c2e2703a7
 github.com/containerd/cgroups                       4994991857f9b0ae8dc439551e8bebdbb4bf66c1
 github.com/containerd/cgroups                       4994991857f9b0ae8dc439551e8bebdbb4bf66c1
 github.com/containerd/console                       0650fd9eeb50bab4fc99dceb9f2e14cf58f36e7f
 github.com/containerd/console                       0650fd9eeb50bab4fc99dceb9f2e14cf58f36e7f
-github.com/containerd/go-runc                       7d11b49dc0769f6dbb0d1b19f3d48524d1bad9ad
+github.com/containerd/go-runc                       e029b79d8cda8374981c64eba71f28ec38e5526f
 github.com/containerd/typeurl                       2a93cfde8c20b23de8eb84a5adbc234ddf7a9e8d
 github.com/containerd/typeurl                       2a93cfde8c20b23de8eb84a5adbc234ddf7a9e8d
 github.com/containerd/ttrpc                         92c8520ef9f86600c650dd540266a007bf03670f
 github.com/containerd/ttrpc                         92c8520ef9f86600c650dd540266a007bf03670f
 github.com/gogo/googleapis                          d31c731455cb061f42baff3bda55bad0118b126b # v1.2.0
 github.com/gogo/googleapis                          d31c731455cb061f42baff3bda55bad0118b126b # v1.2.0

+ 16 - 1
vendor/github.com/containerd/go-runc/command_linux.go

@@ -20,6 +20,7 @@ import (
 	"context"
 	"context"
 	"os"
 	"os"
 	"os/exec"
 	"os/exec"
+	"strings"
 	"syscall"
 	"syscall"
 )
 )
 
 
@@ -32,10 +33,24 @@ func (r *Runc) command(context context.Context, args ...string) *exec.Cmd {
 	cmd.SysProcAttr = &syscall.SysProcAttr{
 	cmd.SysProcAttr = &syscall.SysProcAttr{
 		Setpgid: r.Setpgid,
 		Setpgid: r.Setpgid,
 	}
 	}
-	cmd.Env = os.Environ()
+	cmd.Env = filterEnv(os.Environ(), "NOTIFY_SOCKET") // NOTIFY_SOCKET introduces a special behavior in runc but should only be set if invoked from systemd
 	if r.PdeathSignal != 0 {
 	if r.PdeathSignal != 0 {
 		cmd.SysProcAttr.Pdeathsig = r.PdeathSignal
 		cmd.SysProcAttr.Pdeathsig = r.PdeathSignal
 	}
 	}
 
 
 	return cmd
 	return cmd
 }
 }
+
+func filterEnv(in []string, names ...string) []string {
+	out := make([]string, 0, len(in))
+loop0:
+	for _, v := range in {
+		for _, k := range names {
+			if strings.HasPrefix(v, k+"=") {
+				continue loop0
+			}
+		}
+		out = append(out, v)
+	}
+	return out
+}

+ 10 - 2
vendor/github.com/containerd/go-runc/runc.go

@@ -275,7 +275,11 @@ func (r *Runc) Run(context context.Context, id, bundle string, opts *CreateOpts)
 	if err != nil {
 	if err != nil {
 		return -1, err
 		return -1, err
 	}
 	}
-	return Monitor.Wait(cmd, ec)
+	status, err := Monitor.Wait(cmd, ec)
+	if err == nil && status != 0 {
+		err = fmt.Errorf("%s did not terminate sucessfully", cmd.Args[0])
+	}
+	return status, err
 }
 }
 
 
 type DeleteOpts struct {
 type DeleteOpts struct {
@@ -570,7 +574,11 @@ func (r *Runc) Restore(context context.Context, id, bundle string, opts *Restore
 			}
 			}
 		}
 		}
 	}
 	}
-	return Monitor.Wait(cmd, ec)
+	status, err := Monitor.Wait(cmd, ec)
+	if err == nil && status != 0 {
+		err = fmt.Errorf("%s did not terminate sucessfully", cmd.Args[0])
+	}
+	return status, err
 }
 }
 
 
 // Update updates the current container with the provided resource spec
 // Update updates the current container with the provided resource spec