Skip to content

Commit

Permalink
Merge pull request #9399 from vrothberg/home-sweet-home
Browse files Browse the repository at this point in the history
do not set empty $HOME
  • Loading branch information
openshift-merge-robot authored Feb 16, 2021
2 parents 58a4793 + 2ec0e3b commit 7fb347a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libpod/container_internal_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
6 changes: 6 additions & 0 deletions test/system/030-run.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 7fb347a

Please sign in to comment.