浏览代码

Merge pull request #777 from dotcloud/bsdtar-env

Pass a guaranteed environment to bsdtar for predictable behaviour
Guillaume J. Charmes 12 年之前
父节点
当前提交
078a19d725
共有 2 个文件被更改,包括 4 次插入2 次删除
  1. 3 0
      archive.go
  2. 1 2
      packaging/ubuntu/docker.upstart

+ 3 - 0
archive.go

@@ -54,6 +54,9 @@ func Tar(path string, compression Compression) (io.Reader, error) {
 func Untar(archive io.Reader, path string) error {
 	cmd := exec.Command("bsdtar", "-f", "-", "-C", path, "-x")
 	cmd.Stdin = archive
+	// Hardcode locale environment for predictable outcome regardless of host configuration.
+	//   (see https://github.com/dotcloud/docker/issues/355)
+	cmd.Env = []string{"LANG=en_US.utf-8", "LC_ALL=en_US.utf-8"}
 	output, err := cmd.CombinedOutput()
 	if err != nil {
 		return fmt.Errorf("%s: %s", err, output)

+ 1 - 2
packaging/ubuntu/docker.upstart

@@ -5,6 +5,5 @@ stop on starting rc RUNLEVEL=[016]
 respawn
 
 script
-    # FIXME: docker should not depend on the system having en_US.UTF-8
-    LC_ALL='en_US.UTF-8' /usr/bin/docker -d
+    /usr/bin/docker -d
 end script