From 561ceac55d5821a00258934cf9dc215278e3ecfd Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Fri, 31 May 2013 22:25:48 -0700 Subject: [PATCH] * Runtime: pass a guaranteed environment to bsdtar for predictable behavior without depending on the underlying host configuration. --- archive.go | 3 +++ packaging/ubuntu/docker.upstart | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/archive.go b/archive.go index 4120a52c1d..06466627a1 100644 --- a/archive.go +++ b/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) diff --git a/packaging/ubuntu/docker.upstart b/packaging/ubuntu/docker.upstart index 07e7e8a890..2bd5565ee7 100644 --- a/packaging/ubuntu/docker.upstart +++ b/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