mirror of
https://github.com/containers/podman.git
synced 2025-07-29 11:22:38 +08:00
do not set empty $HOME
Make sure to not set an empty $HOME for containers and let it default to "/". https://github.com/containers/crun/pull/599 is required to fully address #9378. Partially-Fixes: #9378 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
This commit is contained in:
@ -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))
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user