]> git.ipfire.org Git - thirdparty/systemd.git/commit
core/exec-invoke: suppress placeholder home only in build_environment() 35219/head
authorMike Yuan <me@yhndnzj.com>
Mon, 18 Nov 2024 18:41:07 +0000 (19:41 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 18 Nov 2024 23:38:18 +0000 (00:38 +0100)
commitb718b86e1b8477f58461f3c456c944abb1428c0f
treefbfec276816b00692314235946435ffb3e1eb37f
parentd911778877c18827c64e21cc98e86c31dff9a627
core/exec-invoke: suppress placeholder home only in build_environment()

Currently, get_fixed_user() employs USER_CREDS_SUPPRESS_PLACEHOLDER,
meaning home path is set to NULL if it's empty or root. However,
the path is also used for applying WorkingDirectory=~, and we'd
spuriously use the invoking user's home as fallback even if
User= is changed in that case.

Let's instead delegate such suppression to build_environment(),
so that home is proper initialized for usage at other steps.
shell doesn't actually suffer from such problem, but it's changed
too for consistency.

Alternative to #34789
src/core/exec-invoke.c
test/units/TEST-07-PID1.working-directory.sh [new file with mode: 0755]