Browse code

* Runtime: pass a guaranteed environment to bsdtar for predictable behavior without depending on the underlying host configuration.

Solomon Hykes authored on 2013/06/01 14:25:48
Showing 2 changed files
... ...
@@ -54,6 +54,9 @@ func Tar(path string, compression Compression) (io.Reader, error) {
54 54
 func Untar(archive io.Reader, path string) error {
55 55
 	cmd := exec.Command("bsdtar", "-f", "-", "-C", path, "-x")
56 56
 	cmd.Stdin = archive
57
+	// Hardcode locale environment for predictable outcome regardless of host configuration.
58
+	//   (see https://github.com/dotcloud/docker/issues/355)
59
+	cmd.Env = []string{"LANG=en_US.utf-8", "LC_ALL=en_US.utf-8"}
57 60
 	output, err := cmd.CombinedOutput()
58 61
 	if err != nil {
59 62
 		return fmt.Errorf("%s: %s", err, output)
... ...
@@ -5,6 +5,5 @@ stop on starting rc RUNLEVEL=[016]
5 5
 respawn
6 6
 
7 7
 script
8
-    # FIXME: docker should not depend on the system having en_US.UTF-8
9
-    LC_ALL='en_US.UTF-8' /usr/bin/docker -d
8
+    /usr/bin/docker -d
10 9
 end script