mirror of
https://github.com/systemd/systemd.git
synced 2025-01-09 01:18:19 +03:00
80b18d217a
Follow-up for 4d8b0f0f7a
After the mentioned commit, when the ExecCommand executable is missing,
and failure will be ignored by manager, we exit with EXIT_SUCCESS at executor
side too. The behavior however contradicts systemd.service(5), which states:
> If the executable path is prefixed with "-", an exit code of the command
> normally considered a failure (i.e. non-zero exit status or abnormal exit
> due to signal is _recorded_, but has no further effect and is considered
> equivalent to success.
and thus makes debugging unexpected failures harder. Therefore, let's still
exit with EXIT_EXEC, but just skip LOG_ERR level log.
23 lines
733 B
Bash
Executable File
23 lines
733 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
set -eux
|
|
set -o pipefail
|
|
|
|
# shellcheck source=test/units/util.sh
|
|
. "$(dirname "$0")"/util.sh
|
|
|
|
cat >/run/systemd/system/nonexistent-execstart-exit-status.service <<EOF
|
|
[Service]
|
|
Type=oneshot
|
|
RemainAfterExit=yes
|
|
ExecStart=-/foo/bar/not-exist
|
|
EOF
|
|
|
|
systemctl start nonexistent-execstart-exit-status.service
|
|
systemctl is-active nonexistent-execstart-exit-status.service
|
|
assert_eq "$(systemctl show nonexistent-execstart-exit-status.service -P Result)" "success"
|
|
(( $(systemctl show nonexistent-execstart-exit-status.service -P ExecMainStatus) > 0 ))
|
|
|
|
systemctl stop nonexistent-execstart-exit-status.service
|
|
rm /run/systemd/system/nonexistent-execstart-exit-status.service
|