summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-16 11:39:27 -0500
committerGitHub <noreply@github.com>2021-02-16 11:39:27 -0500
commit7fb347a3d40afeb4c565c2066fbade7f003e3e50 (patch)
tree7fcd21db6746f9c83428146a745a23cb5e344026
parent58a4793bec30058f648dcd1248da333a7bb6d47c (diff)
parent2ec0e3b650bcce43a8c9d0f47703eceaf947edbe (diff)
downloadpodman-7fb347a3d40afeb4c565c2066fbade7f003e3e50.tar.gz
podman-7fb347a3d40afeb4c565c2066fbade7f003e3e50.tar.bz2
podman-7fb347a3d40afeb4c565c2066fbade7f003e3e50.zip
Merge pull request #9399 from vrothberg/home-sweet-home
do not set empty $HOME
-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 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