diff --git a/src/core/service.c b/src/core/service.c index e576f4ba83..0871912974 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -2948,6 +2948,7 @@ static void service_sigchld_event(Unit *u, pid_t pid, int code, int status) { if (s->main_command && s->main_command->command_next && + s->type == SERVICE_ONESHOT && f == SERVICE_SUCCESS) { /* There is another command to * diff --git a/test/test-exec-deserialization.py b/test/test-exec-deserialization.py index 39a9e62e15..c3fe0824c7 100755 --- a/test/test-exec-deserialization.py +++ b/test/test-exec-deserialization.py @@ -178,6 +178,37 @@ class ExecutionResumeTest(unittest.TestCase): self.assertTrue(not os.path.exists(self.output_file)) + def test_issue_6533(self): + unit = "test-issue-6533.service" + unitfile_path = "/run/systemd/system/{}".format(unit) + + content = ''' + [Service] + ExecStart=/bin/sleep 5 + ''' + + with open(unitfile_path, 'w') as f: + f.write(content) + + self.reload() + + subprocess.check_call(['systemctl', '--job-mode=replace', '--no-block', 'start', unit]) + time.sleep(2) + + content = ''' + [Service] + ExecStart=/bin/sleep 5 + ExecStart=/bin/true + ''' + + with open(unitfile_path, 'w') as f: + f.write(content) + + self.reload() + time.sleep(5) + + self.assertTrue(subprocess.call("journalctl -b _PID=1 | grep -q 'Freezing execution'", shell=True) != 0) + def tearDown(self): for f in [self.output_file, self.unitfile_path]: try: