diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh index 3e88fed73b..70bfb74309 100644 --- a/contrib/cirrus/lib.sh +++ b/contrib/cirrus/lib.sh @@ -96,7 +96,7 @@ EPOCH_TEST_COMMIT="$CIRRUS_BASE_SHA" PASSTHROUGH_ENV_EXACT='CGROUP_MANAGER|DEST_BRANCH|DISTRO_NV|GOCACHE|GOPATH|GOSRC|NETWORK_BACKEND|OCI_RUNTIME|ROOTLESS_USER|SCRIPT_BASE|SKIP_USERNS|EC2_INST_TYPE|PODMAN_DB' # List of envariable patterns which must match AT THE BEGINNING of the name. -PASSTHROUGH_ENV_ATSTART='CI|TEST' +PASSTHROUGH_ENV_ATSTART='CI|LANG|LC_|TEST' # List of envariable patterns which can match ANYWHERE in the name PASSTHROUGH_ENV_ANYWHERE='_NAME|_FQIN' diff --git a/libpod/oci_conmon_common.go b/libpod/oci_conmon_common.go index 32877c5ad2..10842a011b 100644 --- a/libpod/oci_conmon_common.go +++ b/libpod/oci_conmon_common.go @@ -1311,6 +1311,9 @@ func (r *ConmonOCIRuntime) configureConmonEnv(runtimeDir string) []string { if strings.HasPrefix(e, "LC_") { env = append(env, e) } + if strings.HasPrefix(e, "LANG=") { + env = append(env, e) + } } if path, ok := os.LookupEnv("PATH"); ok { env = append(env, fmt.Sprintf("PATH=%s", path)) diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go index c14750d2b9..88dbe125d6 100644 --- a/test/e2e/logs_test.go +++ b/test/e2e/logs_test.go @@ -2,6 +2,7 @@ package integration import ( "fmt" + "os" "os/exec" "time" @@ -548,6 +549,19 @@ var _ = Describe("Podman logs", func() { Expect(logs.ErrorToString()).To(ContainSubstring("this container is using the 'none' log driver, cannot read logs: this container is not logging output")) }) + It("podman logs with non ASCII log tag fails without env", func() { + // Env won't be passed to the podman command by default, so it will be empty + logc := podmanTest.Podman([]string{"run", "--log-opt", "tag=\"äöüß\"", ALPINE, "echo", "podman"}) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Not(Exit(0))) + }) + + It("podman logs with non ASCII log tag succeeds with env", func() { + env := append(os.Environ(), "LANG=en_US.UTF-8", "LC_ALL=") + logc := podmanTest.PodmanAsUser([]string{"run", "--log-opt", "tag=äöüß", ALPINE, "echo", "podman"}, 0, 0, "", env) + logc.WaitWithDefaultTimeout() + Expect(logc).To(Exit(0)) + }) It("podman pod logs with container names", func() { SkipIfRemote("Remote can only process one container at a time") podName := "testPod" @@ -597,5 +611,4 @@ var _ = Describe("Podman logs", func() { Expect(output[0]).To(MatchRegexp(`\x1b\[3[0-9a-z ]+\x1b\[0m`)) Expect(output[1]).To(MatchRegexp(`\x1b\[3[0-9a-z ]+\x1b\[0m`)) }) - })