From 49ea1d168446af695a12a000f101e624f1370389 Mon Sep 17 00:00:00 2001 From: Peter Hunt Date: Mon, 12 Jun 2023 15:05:46 -0400 Subject: [PATCH 1/2] libpod: correctly pass env so alternative locales work in addition to https://github.com/containers/podman/commit/b6167cedb2ba69a66646a94eb27c49bbbea88e15 we also need to pass LANG. Do so, and add a test to verify Signed-off-by: Peter Hunt --- libpod/oci_conmon_common.go | 3 +++ test/e2e/logs_test.go | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) 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`)) }) - }) From a83dfa04ae94fdd3450abfaf1cd7125e60bba00a Mon Sep 17 00:00:00 2001 From: Peter Hunt Date: Tue, 8 Aug 2023 10:12:29 -0400 Subject: [PATCH 2/2] cirrus/lib.sh: extend env to passthrough at start for locale work Signed-off-by: Peter Hunt --- contrib/cirrus/lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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'