summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpod/container_internal_linux.go2
-rw-r--r--test/system/030-run.bats6
2 files changed, 7 insertions, 1 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index a3476f42e..e49c89566 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -458,7 +458,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