Explorar o código

Windows: escape entrypoint before passing to libcontainerd

This makes Windows behavior consistent with Linux -- the entry point must
be an executable, not an executable and set of arguments.

Signed-off-by: John Starks <jostarks@microsoft.com>
John Starks %!s(int64=9) %!d(string=hai) anos
pai
achega
6fa0239772
Modificáronse 2 ficheiros con 4 adicións e 7 borrados
  1. 1 2
      daemon/exec_windows.go
  2. 3 5
      daemon/oci_windows.go

+ 1 - 2
daemon/exec_windows.go

@@ -8,7 +8,6 @@ import (
 
 
 func execSetPlatformOpt(c *container.Container, ec *exec.Config, p *libcontainerd.Process) error {
 func execSetPlatformOpt(c *container.Container, ec *exec.Config, p *libcontainerd.Process) error {
 	// Process arguments need to be escaped before sending to OCI.
 	// Process arguments need to be escaped before sending to OCI.
-	// TODO (jstarks): escape the entrypoint too once the tests are fixed to not rely on this behavior
-	p.Args = append([]string{p.Args[0]}, escapeArgs(p.Args[1:])...)
+	p.Args = escapeArgs(p.Args)
 	return nil
 	return nil
 }
 }

+ 3 - 5
daemon/oci_windows.go

@@ -63,11 +63,9 @@ func (daemon *Daemon) createSpec(c *container.Container) (*libcontainerd.Spec, e
 	}
 	}
 
 
 	// In s.Process
 	// In s.Process
-	if c.Config.ArgsEscaped {
-		s.Process.Args = append([]string{c.Path}, c.Args...)
-	} else {
-		// TODO (jstarks): escape the entrypoint too once the tests are fixed to not rely on this behavior
-		s.Process.Args = append([]string{c.Path}, escapeArgs(c.Args)...)
+	s.Process.Args = append([]string{c.Path}, c.Args...)
+	if !c.Config.ArgsEscaped {
+		s.Process.Args = escapeArgs(s.Process.Args)
 	}
 	}
 	s.Process.Cwd = c.Config.WorkingDir
 	s.Process.Cwd = c.Config.WorkingDir
 	s.Process.Env = c.CreateDaemonEnvironment(linkedEnv)
 	s.Process.Env = c.CreateDaemonEnvironment(linkedEnv)