Merge pull request #9399 from vrothberg/home-sweet-home

do not set empty $HOME
This commit is contained in:
OpenShift Merge Robot 2021-02-16 11:39:27 -05:00 committed by GitHub
commit 7fb347a3d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -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))
}

View File

@ -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