From bad0a715ee11c84371abf13eca51e845cd50fc92 Mon Sep 17 00:00:00 2001 From: Danish Prakash Date: Wed, 27 May 2026 10:47:43 +0530 Subject: [PATCH] specgen: move log_path handling over to the server log_path is currently set at the client side and is ignored by the server in a remote session. This leads to either incorrect log_path being considered by the server or not honored at all. Move the handling from client to the server, in line with other flags such as log_driver. Signed-off-by: Danish Prakash --- pkg/specgen/generate/container.go | 3 +++ pkg/specgen/generate/kube/kube.go | 4 ---- pkg/specgenutil/specgen.go | 4 ---- test/e2e/run_test.go | 5 +++++ 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index ba249ddc76..a4574bd449 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -331,6 +331,9 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat if len(s.LogConfiguration.Driver) < 1 { s.LogConfiguration.Driver = rtc.Containers.LogDriver } + if len(s.LogConfiguration.Path) < 1 { + s.LogConfiguration.Path = rtc.Containers.LogPath + } if len(rtc.Containers.LogTag) > 0 { if s.LogConfiguration.Options == nil { s.LogConfiguration.Options = make(map[string]string) diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go index 234d301b41..49e76db6a0 100644 --- a/pkg/specgen/generate/kube/kube.go +++ b/pkg/specgen/generate/kube/kube.go @@ -242,10 +242,6 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener s.ImageVolumes = opts.ImageVolumes - if rtc.Containers.LogPath != "" { - s.LogConfiguration.Path = rtc.Containers.LogPath - } - s.LogConfiguration.Options = make(map[string]string) s.LogConfiguration.Labels = make(map[string]string) for _, o := range opts.LogOptions { diff --git a/pkg/specgenutil/specgen.go b/pkg/specgenutil/specgen.go index 7cc2fe41f4..f0c3dad364 100644 --- a/pkg/specgenutil/specgen.go +++ b/pkg/specgenutil/specgen.go @@ -845,10 +845,6 @@ func FillOutSpecGen(s *specgen.SpecGenerator, c *entities.ContainerCreateOptions return err } - if rtc.Containers.LogPath != "" { - s.LogConfiguration.Path = rtc.Containers.LogPath - } - logOpts := make(map[string]string) logLabels := make(map[string]string) for _, o := range c.LogOptions { diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 879b1b9fa5..2266a71e73 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -2435,6 +2435,11 @@ log_path = "%s" if IsRemote() { podmanTest.RestartRemoteService() + // Server inherited CONTAINERS_CONF_OVERRIDE at restart; unset on + // the client so this forces the server to use its config and not rely on + // the client's. Without this the client would read log_path and + // pass it on to the client, masking server-side bugs. + os.Unsetenv("CONTAINERS_CONF_OVERRIDE") } containerName := "test-conf-log-container"