]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Use ExitType=cgroup for autostart generated services 20813/head
authorHenri Chain <henri.chain@enioka.com>
Fri, 5 Nov 2021 15:11:42 +0000 (16:11 +0100)
committerHenri Chain <henri.chain@enioka.com>
Mon, 8 Nov 2021 09:15:24 +0000 (10:15 +0100)
This fixes a bug[1] with some generated autostart app services which
fork and exit immediately after main application process start,
that caused them not to launch during session startup, as the entire
cgroup was immediately killed by systemd.

This can also happen with apps such as file browsers, whose initial
process will exit after the window is closed, but who intend to leave a
daemon child running.

Since the forking model of a .desktop application cannot be known at
service generation time otherwise, ExitType=cgroup is the only effective
way to fix this bug.

[1] https://bugs.kde.org/show_bug.cgi?id=433299

src/xdg-autostart-generator/xdg-autostart-service.c

index 501cdca0b6e4d2351f083a06c8e3707b941e5bc7..241a5b3cfd612790a798b82a1563f7d71dac5601 100644 (file)
@@ -597,6 +597,7 @@ int xdg_autostart_service_generate_unit(
         fprintf(f,
                 "\n[Service]\n"
                 "Type=exec\n"
+                "ExitType=cgroup\n"
                 "ExecStart=:%s\n"
                 "Restart=no\n"
                 "TimeoutSec=5s\n"