diff options
-rw-r--r-- | libpod/container_internal_linux.go | 2 | ||||
-rw-r--r-- | test/system/030-run.bats | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index f23a5233c..2360d0737 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -466,7 +466,7 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) { break } } - if !hasHomeSet { + if !hasHomeSet && execUser.Home != "" { c.config.Spec.Process.Env = append(c.config.Spec.Process.Env, fmt.Sprintf("HOME=%s", execUser.Home)) } diff --git a/test/system/030-run.bats b/test/system/030-run.bats index 3749dcac5..93449ece9 100644 --- a/test/system/030-run.bats +++ b/test/system/030-run.bats @@ -662,4 +662,10 @@ json-file | f run_podman rm $cname } +@test "podman run - do not set empty HOME" { + # Regression test for #9378. + run_podman run --rm --user 100 $IMAGE printenv + is "$output" ".*HOME=/.*" +} + # vim: filetype=sh |