Unify error messages for transient settings, fix handling of Ex variants (#38083)

This commit is contained in:
Lennart Poettering
2025-07-07 09:39:40 +02:00
committed by GitHub
4 changed files with 1336 additions and 190 deletions
@@ -20,25 +20,16 @@ property[7_seven]=ExecStopPost
# These should all get upgraded to the corresponding Ex property as the non-Ex variant
# does not support the ":" prefix (no-env-expand).
for c in "${!property[@]}"; do
systemd-run --unit="$c" -r -p "Type=oneshot" -p "${property[$c]}=:/bin/echo \${$c}" /bin/true
systemd-run --unit="$c" -r -p "Type=oneshot" -p "${property[$c]}=:/bin/echo \${$c}" true
systemctl show -p "${property[$c]}" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; ignore_errors=no"
systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; flags=no-env-expand"
done
declare -A property_ex
property_ex[1_one_ex]=ExecConditionEx
property_ex[2_two_ex]=ExecStartPreEx
property_ex[3_three_ex]=ExecStartEx
property_ex[4_four_ex]=ExecStartPostEx
property_ex[5_five_ex]=ExecReloadEx
property_ex[6_six_ex]=ExecStopEx
property_ex[7_seven_ex]=ExecStopPostEx
for c in "${!property_ex[@]}"; do
systemd-run --unit="$c" -r -p "Type=oneshot" -p "${property_ex[$c]}=:/bin/echo \${$c}" /bin/true
systemctl show -p "${property_ex[$c]%??}" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; ignore_errors=no"
systemctl show -p "${property_ex[$c]}" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; flags=no-env-expand"
# Ex names on the commandline are supported for backward compat.
for c in "${!property[@]}"; do
systemd-run --unit="${c}_ex" -r -p "Type=oneshot" -p "${property[$c]}Ex=:/bin/echo \${$c}" true
systemctl show -p "${property[$c]}" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; ignore_errors=no"
systemctl show -p "${property[$c]}Ex" "$c" | grep -F "path=/bin/echo ; argv[]=/bin/echo \${$c} ; flags=no-env-expand"
done
systemd-analyze log-level info
+1
View File
@@ -1115,6 +1115,7 @@ systemd-analyze transient-settings mount | grep CPUQuotaPeriodSec
(! systemd-analyze transient-settings service | grep CPUAccounting )
(! systemd-analyze transient-settings service | grep ConditionKernelVersion )
(! systemd-analyze transient-settings service | grep AssertKernelVersion )
(! systemd-analyze transient-settings service socket timer path slice scope mount automount | grep -E 'Ex$' )
# check systemd-analyze unit-shell with a namespaced unit
UNIT_NAME="test-unit-shell.service"