]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run: do not munge user.slice with --slice-inherit
authorRonan Pigott <ronan@rjp.ie>
Mon, 29 Jun 2026 19:14:58 +0000 (12:14 -0700)
committerLuca Boccassi <luca.boccassi@gmail.com>
Tue, 30 Jun 2026 08:51:05 +0000 (09:51 +0100)
When using --slice-inherit, setting arg_slice would inadvertently munge
user.slice into the current user slice, usually producing a slice name
like user-1000-user.slice. This is treated as a user-UID slice by
user-.slice.d/10-defaults.conf, resulting in a strange description:
literally "User slice for UID user" (instead of an actual user UID).

Keep arg_slice empty when using --slice-inherit so that we actually
inherit from the relevant slice instead of a munged version.

Fixes: #42601
src/run/run.c

index 2e37a0a2f63f3279c376a6b3af9c9be7c8ab48bc..168cd2f4e672c522a9c389ccd38e8a0c7ee51cb9 100644 (file)
@@ -1049,7 +1049,7 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
 
         strv_free_and_replace(arg_cmdline, l);
 
-        if (!arg_slice) {
+        if (!custom_slice) {
                 arg_slice = strdup(SPECIAL_USER_SLICE);
                 if (!arg_slice)
                         return log_oom();