Skip to content

[1.5] Fix runc exec -p with absent process.env not setting HOME - #5459

Open
kolyshkin wants to merge 3 commits into
opencontainers:release-1.5from
kolyshkin:1.5-5266
Open

kolyshkin wants to merge 3 commits into
opencontainers:release-1.5from
kolyshkin:1.5-5266

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

Backport of #5266 to release-1.5. Original description follows.


  1. runc exec -p: fix adding HOME to nil env

    Before commit 7dc2486, when process.env was nil, prepareEnv
    returned a flag telling HOME is not set, and it was added.

    Commit 7dc2486 moved the functionality of adding HOME into
    prepareEnv but did not properly handle nil case. As a result,
    runc exec -p with process.json having no env set resulted in
    an exec with no HOME set.

    Fix this, and add unit and integration tests.

    Fixes: 7dc2486 ("libct: switch to numeric UID/GID/groups")

    Fixes: runc exec -p with absent env doesn't add HOME (regression in v1.3.0) #5265.

  2. Misc related tests additions (no new issues found).

This tests checks that "runc exec --env VAR=VAR ..." actually appends
VAR=VAL to the exec's environment.

Add additional checks that:
 - process.env from config.json is also inherited;
 - HOME is set.

Those checks do not reveal any new issues.

(cherry picked from commit 6210ceb)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
All existing tests check runc run, and there is no single runc exec
environment test except for one in exec.bats.

Add it (no new issues found).

(cherry picked from commit d530786)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin kolyshkin added the backport/1.5-pr A backport PR to release-1.5 label Sep 13, 2026
@kolyshkin kolyshkin added this to the 1.5.2 milestone Sep 13, 2026
Before commit 7dc2486, when process.env was nil, prepareEnv
returned a flag telling HOME is not set, and it was added.

Commit 7dc2486 moved the functionality of adding HOME into
prepareEnv but did not properly handle nil case. As a result,
runc exec -p with process.json having no env set resulted in
an exec with no HOME set.

Fix this, and add unit and integration tests.

Fixes: 7dc2486 ("libct: switch to numeric UID/GID/groups")
(cherry picked from commit 321073e)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/1.5-pr A backport PR to release-1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants