From d406a554c3d06e93ae5e5cc371dc03d46dda68dd Mon Sep 17 00:00:00 2001 From: AlmaLinux RelEng Bot Date: Tue, 19 May 2026 20:28:39 -0400 Subject: [PATCH] import UBI systemd-252-67.el9_8.2 --- ...EFI_BOOT_MANAGER_POLICY_PROTOCOL-to-.patch | 96 + ...-correct-memory-type-for-allocations.patch | 38 + ...stemd-network-is-also-used-by-udevd.patch} | 4 +- ...e-bus_add_match_full-accept-timeout.patch} | 4 +- ..._timeout_start_usec-in-UnitVTable-a.patch} | 4 +- ...e-the-NameOwnerChanged-GetNameOwner.patch} | 4 +- ...empty-lines-between-function-call-a.patch} | 4 +- ...nnect-from-bus-when-failed-to-insta.patch} | 4 +- ...bscriber-list-when-we-disconenct-fr.patch} | 4 +- ...lized_subscribed-subscribed_as_strv.patch} | 4 +- ...eset-the-count-returned-by-sd_bus_t.patch} | 4 +- ...ore-bus-track-deserialization-clean.patch} | 4 +- ...-duplicate-bus-track-deserializatio.patch} | 4 +- ...use-install_callback-in-sd_bus_trac.patch} | 4 +- ...-add-kernel-identify-inspect-verbs-f.patch | 38 + ...r-format_timestamp-and-parse_timest.patch} | 4 +- ...est-time-util-disable-failing-tests.patch} | 4 +- ...parse_timestamp-in-various-timezone.patch} | 4 +- ...ystemctl-logind-add-missing-asserts.patch} | 4 +- ...make-logind_schedule_shutdown-accep.patch} | 4 +- ...-option-when-for-scheduled-shutdown.patch} | 4 +- ...d-test-cases-to-invalidate-show-and.patch} | 4 +- ...-RET_GATHER-and-use-it-in-src-shared.patch | 128 + ...n-t-eat-up-errors-in-fd_cloexec_many.patch | 50 + ...-send-messages-with-an-invalid-strin.patch | 52 + ...-correctly-handle-invalid-UTF-8-in-m.patch | 92 + ...test-fix-a-typo-in-the-cleanup-stuff.patch | 25 + ...specify-a-UTF-8-locale-for-UTF-8-she.patch | 62 + ...rect-file-name-when-restoring-the-or.patch | 26 + ...8-in-mount-unit-Where-field-before-s.patch | 134 + ...est-time-util-disable-failing-tests.patch} | 4 +- ...zones-to-iterate-all-known-timezone.patch} | 4 +- ...time-util-do-not-fail-on-DST-change.patch} | 4 +- ...ppress-timestamp-conversion-failure.patch} | 4 +- ...-more-suppression-of-time-zone-chec.patch} | 4 +- ...-util-fix-truncation-of-usec-to-sec.patch} | 4 +- ...ore-timezone-sensitive-unit-tests-a.patch} | 4 +- ...n-extend-timeout-for-test-time-util.patch} | 4 +- ...INE_STRING_TABLE_LOOKUP_TO_STRING-m.patch} | 4 +- ...> 1249-time-util-align-string-table.patch} | 4 +- ... => 1250-time-util-rename-variables.patch} | 4 +- ...ch => 1251-time-util-add-assertions.patch} | 4 +- ... 1252-time-util-drop-redundant-else.patch} | 4 +- ...> 1253-time-util-do-not-use-strdupa.patch} | 4 +- ...-use-result-from-startswith_no_case.patch} | 4 +- ...-use-usec_add-and-usec_sub_unsigned.patch} | 4 +- ...> 1256-time-util-shorten-code-a-bit.patch} | 4 +- ... => 1257-time-util-rename-variables.patch} | 4 +- ...necessary-assignment-of-timezone-na.patch} | 4 +- ...rse_timestamp-use-the-RFC-822-ISO-8.patch} | 4 +- ...po.patch => 1260-time-util-fix-typo.patch} | 4 +- ... 1261-ci-bump-the-tools-tree-to-F42.patch} | 4 +- ...ald-extend-STDOUT_STREAMS_MAX-to-64k.patch | 27 + ...ev-builtin-net_id-use-firmware_node-.patch | 163 + ...in-net_id-ignore-firmware_node-sun-0.patch | 43 + ...fix-compile-check-for-explicit_bzero.patch | 36 + ...EC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch} | 4 +- ...EST-53-ISSUE-16347-to-TEST-53-TIMER.patch} | 4 +- ...lapsed-timer-shouldn-t-trigger-the-.patch} | 4 +- ...xt-elapse-timer-timestamp-after-des.patch} | 4 +- ...ervice-immediately-after-restart-of.patch} | 4 +- ...and-compare-just-the-property-value.patch} | 4 +- ...d-util-more-lenient-when-using-fd_mo.patch | 94 + ...=> 1273-basic-add-PIDFS-magic-31709.patch} | 4 +- SOURCES/1274-man-fix-a-missing-word.patch | 27 + ...tional-support-for-linking-volume-k.patch} | 4 +- ...o.patch => 1276-cryptsetup-fix-typo.patch} | 4 +- ...RYPT_SET_KEYRING_TO_LINK-is-always-.patch} | 4 +- ...ck-that-all-argv-meta-data-fields-a.patch} | 2 +- ...e-compatibility-with-older-patterns.patch} | 2 +- ...redump-use-d-in-kernel-core-pattern.patch} | 2 +- ...ure-that-can-reference-a-pid-via-bo.patch} | 2 +- ... => 1282-fd-util-introduce-parse_fd.patch} | 2 +- ...d-support-for-new-F-PIDFD-specifier.patch} | 2 +- ...next-elapse-timestamp-only-if-timer.patch} | 4 +- ...introduce-string_strv_hashmap_remove.patch | 85 + ...oduce-unit_file_remove_from_name_map.patch | 230 + ...-path-to-transient-unit-file-from-un.patch | 52 + ...7-PID1-add-reprudcer-for-issue-35190.patch | 33 + ...e-ENOBUFS-and-EMSGSIZE-the-same-way.patch} | 4 +- ...-escape-binary-null-characters-from-.patch | 32 + ...se-last_trigger-timestamp-if-needed.patch} | 4 +- ...erator-refactor-add_crypttab_devices.patch | 130 + ...nerator-continue-parsing-after-error.patch | 43 + ...erator-parse-all-cmdline-devices-too.patch | 39 + ...rator-always-process-cmdline-devices.patch | 33 + ...d-add-background-light-session-class.patch | 44 + ...r-session-class-provided-via-PAM-env.patch | 118 + ...ix-array-size-in-unit_log_resources.patch} | 8 +- ...-to-override-default-mount-rate-limi.patch | 63 + ...-to-override-default-mount-rate-limi.patch | 75 + ...e-service-fix-error-cause-in-the-log.patch | 28 + ...rator-drop-assertions-for-mount-opts.patch | 45 + ...fix-options-in-systemd.mount-extra-a.patch | 114 + ...-reorder-systemd-arguments-on-reexec.patch | 57 + .../1305-basic-add-RuntimeScope-enum.patch | 5322 +++++++++++++++++ ...d-helper-that-turns-RuntimeScope-enu.patch | 68 + ...-path-add-support-for-XDG_STATE_HOME.patch | 79 + ...acing-in-sd-path.h-and-systemd-path-.patch | 57 + ...tool-add-some-basic-ansi-highlighing.patch | 25 + ...RuntimeScope-field-in-ExecParameters.patch | 91 + ...-execute-remove-redundant-assignment.patch | 25 + ...ursively-chowning-StateDirectory-whe.patch | 79 + ...ort-for-XDG_STATE_HOME-for-placing-s.patch | 195 + ...e-logs-from-setup_exec_directory-wit.patch | 92 + ...horten-some-code-by-using-RET_NERRNO.patch | 62 + ...code-by-making-use-of-laccess-return.patch | 26 + ...ther-with-chowning-StateDirectory-an.patch | 29 + ...test-for-new-XDG_STATE_HOME-handling.patch | 79 + ...ntion-the-newly-added-XDG_STATE_HOME.patch | 54 + ...reak-lines-in-file-hierarchy-7-a-bit.patch | 96 + .../1321-man-properly-close-XML-tags.patch | 34 + ...mpfiles-the-new-XDG_STATE_HOME-varia.patch | 51 + ...-test-use-XDG_STATE_HOME-for-S-and-L.patch | 74 + .../1324-man-fully-adopt-.local-state.patch | 41 + ...te-transaction-that-contain-useful-j.patch | 36 + ...fix-scope-for-environment-generators.patch | 27 + ...te-input-cgroup-path-more-prudently.patch} | 6 +- SPECS/systemd.spec | 376 +- 119 files changed, 9363 insertions(+), 249 deletions(-) create mode 100644 SOURCES/1210-Revert-boot-Use-EFI_BOOT_MANAGER_POLICY_PROTOCOL-to-.patch create mode 100644 SOURCES/1211-boot-Use-correct-memory-type-for-allocations.patch rename SOURCES/{1210-meson-etc-systemd-network-is-also-used-by-udevd.patch => 1212-meson-etc-systemd-network-is-also-used-by-udevd.patch} (92%) rename SOURCES/{1218-sd-bus-make-bus_add_match_full-accept-timeout.patch => 1213-sd-bus-make-bus_add_match_full-accept-timeout.patch} (98%) rename SOURCES/{1219-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch => 1214-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch} (95%) rename SOURCES/{1220-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch => 1215-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch} (97%) rename SOURCES/{1221-core-sd-bus-drop-empty-lines-between-function-call-a.patch => 1216-core-sd-bus-drop-empty-lines-between-function-call-a.patch} (94%) rename SOURCES/{1222-core-do-not-disconnect-from-bus-when-failed-to-insta.patch => 1217-core-do-not-disconnect-from-bus-when-failed-to-insta.patch} (96%) rename SOURCES/{1223-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch => 1218-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch} (98%) rename SOURCES/{1224-manager-s-deserialized_subscribed-subscribed_as_strv.patch => 1219-manager-s-deserialized_subscribed-subscribed_as_strv.patch} (98%) rename SOURCES/{1225-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch => 1220-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch} (95%) rename SOURCES/{1226-core-manager-restore-bus-track-deserialization-clean.patch => 1221-core-manager-restore-bus-track-deserialization-clean.patch} (92%) rename SOURCES/{1227-core-manager-drop-duplicate-bus-track-deserializatio.patch => 1222-core-manager-drop-duplicate-bus-track-deserializatio.patch} (93%) rename SOURCES/{1228-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch => 1223-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch} (97%) create mode 100644 SOURCES/1224-shell-completion-add-kernel-identify-inspect-verbs-f.patch rename SOURCES/{1211-test-add-tests-for-format_timestamp-and-parse_timest.patch => 1225-test-add-tests-for-format_timestamp-and-parse_timest.patch} (99%) rename SOURCES/{1212-test-time-util-disable-failing-tests.patch => 1226-test-time-util-disable-failing-tests.patch} (95%) rename SOURCES/{1213-test-test-parse_timestamp-in-various-timezone.patch => 1227-test-test-parse_timestamp-in-various-timezone.patch} (98%) rename SOURCES/{1214-systemctl-logind-add-missing-asserts.patch => 1228-systemctl-logind-add-missing-asserts.patch} (93%) rename SOURCES/{1215-systemctl-logind-make-logind_schedule_shutdown-accep.patch => 1229-systemctl-logind-make-logind_schedule_shutdown-accep.patch} (96%) rename SOURCES/{1216-systemctl-add-option-when-for-scheduled-shutdown.patch => 1230-systemctl-add-option-when-for-scheduled-shutdown.patch} (99%) rename SOURCES/{1217-test-time-util-add-test-cases-to-invalidate-show-and.patch => 1231-test-time-util-add-test-cases-to-invalidate-show-and.patch} (93%) create mode 100644 SOURCES/1232-Introduce-RET_GATHER-and-use-it-in-src-shared.patch create mode 100644 SOURCES/1233-fd-util-don-t-eat-up-errors-in-fd_cloexec_many.patch create mode 100644 SOURCES/1234-sd-bus-refuse-to-send-messages-with-an-invalid-strin.patch create mode 100644 SOURCES/1235-test-check-if-we-correctly-handle-invalid-UTF-8-in-m.patch create mode 100644 SOURCES/1236-test-fix-a-typo-in-the-cleanup-stuff.patch create mode 100644 SOURCES/1237-test-explicitly-specify-a-UTF-8-locale-for-UTF-8-she.patch create mode 100644 SOURCES/1238-test-use-the-correct-file-name-when-restoring-the-or.patch create mode 100644 SOURCES/1239-core-escape-UTF-8-in-mount-unit-Where-field-before-s.patch rename SOURCES/{1229-Revert-test-time-util-disable-failing-tests.patch => 1240-Revert-test-time-util-disable-failing-tests.patch} (95%) rename SOURCES/{1230-test-use-get_timezones-to-iterate-all-known-timezone.patch => 1241-test-use-get_timezones-to-iterate-all-known-timezone.patch} (97%) rename SOURCES/{1231-test-time-util-do-not-fail-on-DST-change.patch => 1242-test-time-util-do-not-fail-on-DST-change.patch} (97%) rename SOURCES/{1232-test-time-util-suppress-timestamp-conversion-failure.patch => 1243-test-time-util-suppress-timestamp-conversion-failure.patch} (97%) rename SOURCES/{1233-test-time-util-do-more-suppression-of-time-zone-chec.patch => 1244-test-time-util-do-more-suppression-of-time-zone-chec.patch} (97%) rename SOURCES/{1234-test-time-util-fix-truncation-of-usec-to-sec.patch => 1245-test-time-util-fix-truncation-of-usec-to-sec.patch} (96%) rename SOURCES/{1235-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch => 1246-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch} (96%) rename SOURCES/{1236-meson-extend-timeout-for-test-time-util.patch => 1247-meson-extend-timeout-for-test-time-util.patch} (90%) rename SOURCES/{1237-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch => 1248-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch} (91%) rename SOURCES/{1238-time-util-align-string-table.patch => 1249-time-util-align-string-table.patch} (91%) rename SOURCES/{1239-time-util-rename-variables.patch => 1250-time-util-rename-variables.patch} (99%) rename SOURCES/{1240-time-util-add-assertions.patch => 1251-time-util-add-assertions.patch} (97%) rename SOURCES/{1241-time-util-drop-redundant-else.patch => 1252-time-util-drop-redundant-else.patch} (95%) rename SOURCES/{1242-time-util-do-not-use-strdupa.patch => 1253-time-util-do-not-use-strdupa.patch} (95%) rename SOURCES/{1243-time-util-use-result-from-startswith_no_case.patch => 1254-time-util-use-result-from-startswith_no_case.patch} (94%) rename SOURCES/{1244-time-util-use-usec_add-and-usec_sub_unsigned.patch => 1255-time-util-use-usec_add-and-usec_sub_unsigned.patch} (94%) rename SOURCES/{1245-time-util-shorten-code-a-bit.patch => 1256-time-util-shorten-code-a-bit.patch} (96%) rename SOURCES/{1246-time-util-rename-variables.patch => 1257-time-util-rename-variables.patch} (96%) rename SOURCES/{1247-time-util-drop-unnecessary-assignment-of-timezone-na.patch => 1258-time-util-drop-unnecessary-assignment-of-timezone-na.patch} (94%) rename SOURCES/{1248-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch => 1259-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch} (99%) rename SOURCES/{1249-time-util-fix-typo.patch => 1260-time-util-fix-typo.patch} (92%) rename SOURCES/{1250-ci-bump-the-tools-tree-to-F42.patch => 1261-ci-bump-the-tools-tree-to-F42.patch} (93%) create mode 100644 SOURCES/1262-journald-extend-STDOUT_STREAMS_MAX-to-64k.patch create mode 100644 SOURCES/1263-Revert-Revert-udev-builtin-net_id-use-firmware_node-.patch create mode 100644 SOURCES/1264-udev-builtin-net_id-ignore-firmware_node-sun-0.patch create mode 100644 SOURCES/1265-fundamental-fix-compile-check-for-explicit_bzero.patch rename SOURCES/{1255-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch => 1266-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch} (97%) rename SOURCES/{1262-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch => 1267-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch} (97%) rename SOURCES/{1263-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch => 1268-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch} (97%) rename SOURCES/{1264-test-check-the-next-elapse-timer-timestamp-after-des.patch => 1269-test-check-the-next-elapse-timer-timestamp-after-des.patch} (98%) rename SOURCES/{1265-timer-don-t-run-service-immediately-after-restart-of.patch => 1270-timer-don-t-run-service-immediately-after-restart-of.patch} (91%) rename SOURCES/{1266-test-store-and-compare-just-the-property-value.patch => 1271-test-store-and-compare-just-the-property-value.patch} (96%) create mode 100644 SOURCES/1272-test-make-test-fd-util-more-lenient-when-using-fd_mo.patch rename SOURCES/{1254-basic-add-PIDFS-magic-31709.patch => 1273-basic-add-PIDFS-magic-31709.patch} (95%) create mode 100644 SOURCES/1274-man-fix-a-missing-word.patch rename SOURCES/{1251-cryptsetup-Add-optional-support-for-linking-volume-k.patch => 1275-cryptsetup-Add-optional-support-for-linking-volume-k.patch} (98%) rename SOURCES/{1252-cryptsetup-fix-typo.patch => 1276-cryptsetup-fix-typo.patch} (93%) rename SOURCES/{1253-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch => 1277-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch} (92%) rename SOURCES/{1256-coredump-make-check-that-all-argv-meta-data-fields-a.patch => 1278-coredump-make-check-that-all-argv-meta-data-fields-a.patch} (95%) rename SOURCES/{1257-coredump-restore-compatibility-with-older-patterns.patch => 1279-coredump-restore-compatibility-with-older-patterns.patch} (99%) rename SOURCES/{1258-coredump-use-d-in-kernel-core-pattern.patch => 1280-coredump-use-d-in-kernel-core-pattern.patch} (99%) rename SOURCES/{1259-pidref-add-structure-that-can-reference-a-pid-via-bo.patch => 1281-pidref-add-structure-that-can-reference-a-pid-via-bo.patch} (98%) rename SOURCES/{1260-fd-util-introduce-parse_fd.patch => 1282-fd-util-introduce-parse_fd.patch} (95%) rename SOURCES/{1261-coredump-add-support-for-new-F-PIDFD-specifier.patch => 1283-coredump-add-support-for-new-F-PIDFD-specifier.patch} (99%) rename SOURCES/{1267-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch => 1284-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch} (99%) create mode 100644 SOURCES/1285-strv-introduce-string_strv_hashmap_remove.patch create mode 100644 SOURCES/1286-unit-file-introduce-unit_file_remove_from_name_map.patch create mode 100644 SOURCES/1287-core-unit-remove-path-to-transient-unit-file-from-un.patch create mode 100644 SOURCES/1288-TEST-07-PID1-add-reprudcer-for-issue-35190.patch rename SOURCES/{1268-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch => 1289-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch} (94%) create mode 100644 SOURCES/1290-ukify-rstrip-and-escape-binary-null-characters-from-.patch rename SOURCES/{1269-timer-rebase-last_trigger-timestamp-if-needed.patch => 1291-timer-rebase-last_trigger-timestamp-if-needed.patch} (98%) create mode 100644 SOURCES/1292-cryptsetup-generator-refactor-add_crypttab_devices.patch create mode 100644 SOURCES/1293-cryptsetup-generator-continue-parsing-after-error.patch create mode 100644 SOURCES/1294-cryptsetup-generator-parse-all-cmdline-devices-too.patch create mode 100644 SOURCES/1295-cryptsetup-generator-always-process-cmdline-devices.patch create mode 100644 SOURCES/1296-logind-add-background-light-session-class.patch create mode 100644 SOURCES/1297-pam_systemd-honor-session-class-provided-via-PAM-env.patch rename SOURCES/{1270-core-fix-array-size-in-unit_log_resources.patch => 1298-core-fix-array-size-in-unit_log_resources.patch} (88%) create mode 100644 SOURCES/1299-pid1-add-env-var-to-override-default-mount-rate-limi.patch create mode 100644 SOURCES/1300-pid1-add-env-var-to-override-default-mount-rate-limi.patch create mode 100644 SOURCES/1301-core-service-fix-error-cause-in-the-log.patch create mode 100644 SOURCES/1302-fstab-generator-drop-assertions-for-mount-opts.patch create mode 100644 SOURCES/1303-fstab-generator-fix-options-in-systemd.mount-extra-a.patch create mode 100644 SOURCES/1304-core-reorder-systemd-arguments-on-reexec.patch create mode 100644 SOURCES/1305-basic-add-RuntimeScope-enum.patch create mode 100644 SOURCES/1306-runtime-scope-add-helper-that-turns-RuntimeScope-enu.patch create mode 100644 SOURCES/1307-sd-path-add-support-for-XDG_STATE_HOME.patch create mode 100644 SOURCES/1308-sd-path-bring-spacing-in-sd-path.h-and-systemd-path-.patch create mode 100644 SOURCES/1309-path-tool-add-some-basic-ansi-highlighing.patch create mode 100644 SOURCES/1310-execude-include-RuntimeScope-field-in-ExecParameters.patch create mode 100644 SOURCES/1311-execute-remove-redundant-assignment.patch create mode 100644 SOURCES/1312-execute-when-recursively-chowning-StateDirectory-whe.patch create mode 100644 SOURCES/1313-execute-add-support-for-XDG_STATE_HOME-for-placing-s.patch create mode 100644 SOURCES/1314-execute-associate-logs-from-setup_exec_directory-wit.patch create mode 100644 SOURCES/1315-execute-shorten-some-code-by-using-RET_NERRNO.patch create mode 100644 SOURCES/1316-execute-shorten-code-by-making-use-of-laccess-return.patch create mode 100644 SOURCES/1317-execute-don-t-bother-with-chowning-StateDirectory-an.patch create mode 100644 SOURCES/1318-test-add-test-for-new-XDG_STATE_HOME-handling.patch create mode 100644 SOURCES/1319-man-mention-the-newly-added-XDG_STATE_HOME.patch create mode 100644 SOURCES/1320-man-rebreak-lines-in-file-hierarchy-7-a-bit.patch create mode 100644 SOURCES/1321-man-properly-close-XML-tags.patch create mode 100644 SOURCES/1322-tmpfiles-teach-tmpfiles-the-new-XDG_STATE_HOME-varia.patch create mode 100644 SOURCES/1323-test-use-XDG_STATE_HOME-for-S-and-L.patch create mode 100644 SOURCES/1324-man-fully-adopt-.local-state.patch create mode 100644 SOURCES/1325-core-only-activate-transaction-that-contain-useful-j.patch create mode 100644 SOURCES/1326-manager-fix-scope-for-environment-generators.patch rename SOURCES/{1271-core-validate-input-cgroup-path-more-prudently.patch => 1327-core-validate-input-cgroup-path-more-prudently.patch} (89%) diff --git a/SOURCES/1210-Revert-boot-Use-EFI_BOOT_MANAGER_POLICY_PROTOCOL-to-.patch b/SOURCES/1210-Revert-boot-Use-EFI_BOOT_MANAGER_POLICY_PROTOCOL-to-.patch new file mode 100644 index 0000000..ef9ced5 --- /dev/null +++ b/SOURCES/1210-Revert-boot-Use-EFI_BOOT_MANAGER_POLICY_PROTOCOL-to-.patch @@ -0,0 +1,96 @@ +From 3d54c58e3d4c720a9a95a39879b795e7154f0209 Mon Sep 17 00:00:00 2001 +From: Jan Janssen +Date: Fri, 23 Dec 2022 14:14:53 +0100 +Subject: [PATCH] Revert "boot: Use EFI_BOOT_MANAGER_POLICY_PROTOCOL to connect + console devices" + +This reverts commit b99bf5811850afdb2502ba37251c48348da63c82. + +It seems that using this protocol on some firmwares to forcibly +initialize console devices may break handles (already opened file +handles and the device handle itself) that we rely on to access the +boot filesystem, making it impossible to load the selected entry. + +It might be possible to get a new handle by querying for the device +handle by using its device path after calling into this protocol, but +this is untested. The firmware might also be so buggy that accessing +devices after using this protocol is impossible. + +It seems prudent to revert this for now until some reliable way is found +to initialize console devices without introducing huge boot delays. Any +users on firmware where console devices cannot be accessed would have to +rely on disabling fastboot. + +Fixes: #25737, #25846 +(cherry picked from commit f151abb0e5fa4f820109eb0541bfdcba319d2b92) + +Resolves: RHEL-108596 +--- + src/boot/efi/console.c | 16 ---------------- + src/boot/efi/missing_efi.h | 19 ------------------- + 2 files changed, 35 deletions(-) + +diff --git a/src/boot/efi/console.c b/src/boot/efi/console.c +index 85a76e6e68..3b8b6b2e41 100644 +--- a/src/boot/efi/console.c ++++ b/src/boot/efi/console.c +@@ -12,20 +12,6 @@ + #define VERTICAL_MAX_OK 1080 + #define VIEWPORT_RATIO 10 + +-static EFI_STATUS console_connect(void) { +- EFI_BOOT_MANAGER_POLICY_PROTOCOL *boot_policy; +- EFI_STATUS err; +- +- /* This should make console devices appear/fully initialize on fastboot firmware. */ +- +- err = BS->LocateProtocol( +- &(EFI_GUID) EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID, NULL, (void **) &boot_policy); +- if (err != EFI_SUCCESS) +- return err; +- +- return boot_policy->ConnectDeviceClass(boot_policy, &(EFI_GUID) EFI_BOOT_MANAGER_POLICY_CONSOLE_GUID); +-} +- + static inline void event_closep(EFI_EVENT *event) { + if (!*event) + return; +@@ -61,8 +47,6 @@ EFI_STATUS console_key_read(uint64_t *key, uint64_t timeout_usec) { + assert(key); + + if (!checked) { +- console_connect(); +- + /* Get the *first* TextInputEx device.*/ + err = BS->LocateProtocol( + MAKE_GUID_PTR(EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL), NULL, (void **) &extraInEx); +diff --git a/src/boot/efi/missing_efi.h b/src/boot/efi/missing_efi.h +index d34dfc3379..3c35a85e46 100644 +--- a/src/boot/efi/missing_efi.h ++++ b/src/boot/efi/missing_efi.h +@@ -399,25 +399,6 @@ typedef struct { + } EFI_SHELL_PARAMETERS_PROTOCOL; + #endif + +-#ifndef EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID +-#define EFI_BOOT_MANAGER_POLICY_PROTOCOL_GUID \ +- { 0xFEDF8E0C, 0xE147, 0x11E3, { 0x99, 0x03, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA } } +-#define EFI_BOOT_MANAGER_POLICY_CONSOLE_GUID \ +- { 0xCAB0E94C, 0xE15F, 0x11E3, { 0x91, 0x8D, 0xB8, 0xE8, 0x56, 0x2C, 0xBA, 0xFA } } +- +-typedef struct EFI_BOOT_MANAGER_POLICY_PROTOCOL EFI_BOOT_MANAGER_POLICY_PROTOCOL; +-struct EFI_BOOT_MANAGER_POLICY_PROTOCOL { +- UINT64 Revision; +- EFI_STATUS (EFIAPI *ConnectDevicePath)( +- EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, +- EFI_DEVICE_PATH *DevicePath, +- BOOLEAN Recursive); +- EFI_STATUS (EFIAPI *ConnectDeviceClass)( +- EFI_BOOT_MANAGER_POLICY_PROTOCOL *This, +- EFI_GUID *Class); +-}; +-#endif +- + #ifndef EFI_WARN_UNKNOWN_GLYPH + # define EFI_WARN_UNKNOWN_GLYPH 1 + #endif diff --git a/SOURCES/1211-boot-Use-correct-memory-type-for-allocations.patch b/SOURCES/1211-boot-Use-correct-memory-type-for-allocations.patch new file mode 100644 index 0000000..66a3dbc --- /dev/null +++ b/SOURCES/1211-boot-Use-correct-memory-type-for-allocations.patch @@ -0,0 +1,38 @@ +From bcb456e590fd6994a6b38e9b2d89e3ef0417d402 Mon Sep 17 00:00:00 2001 +From: Jan Janssen +Date: Tue, 2 May 2023 19:41:58 +0200 +Subject: [PATCH] boot: Use correct memory type for allocations + +We were using the wrong memory type when allocating pool memory. This +does not seem to cause a problem on x86, but the kernel will fail to +boot at least on ARM in QEMU. + +This is caused by mixing different allocation types which ended up +breaking the kernel or EDK2 during boot services exit. Commit +2f3c3b0bee5534f2338439f04b0aa517479f8b76 appears to fix this boot +failure because it was replacing the gnu-efi xpool_print with xasprintf +thereby unifying the allocation type. +But this same issue can also happen without this fix somehow when the +random-seed logic is in use. + +Fixes: #27371 +(cherry picked from commit ec232e4abd7aebfec06b4814b30129532b2bcefd) + +Resolves: RHEL-108555 +--- + src/boot/efi/util.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/boot/efi/util.h b/src/boot/efi/util.h +index f7452e3cf5..16c9fcc3e1 100644 +--- a/src/boot/efi/util.h ++++ b/src/boot/efi/util.h +@@ -47,7 +47,7 @@ static inline void freep(void *p) { + _malloc_ _alloc_(1) _returns_nonnull_ _warn_unused_result_ + static inline void *xmalloc(size_t size) { + void *p; +- assert_se(BS->AllocatePool(EfiBootServicesData, size, &p) == EFI_SUCCESS); ++ assert_se(BS->AllocatePool(EfiLoaderData, size, &p) == EFI_SUCCESS); + return p; + } + diff --git a/SOURCES/1210-meson-etc-systemd-network-is-also-used-by-udevd.patch b/SOURCES/1212-meson-etc-systemd-network-is-also-used-by-udevd.patch similarity index 92% rename from SOURCES/1210-meson-etc-systemd-network-is-also-used-by-udevd.patch rename to SOURCES/1212-meson-etc-systemd-network-is-also-used-by-udevd.patch index af884bf..092e523 100644 --- a/SOURCES/1210-meson-etc-systemd-network-is-also-used-by-udevd.patch +++ b/SOURCES/1212-meson-etc-systemd-network-is-also-used-by-udevd.patch @@ -1,11 +1,11 @@ -From 6757a16e8fc9df8b36f9b2bcd26a346f44860961 Mon Sep 17 00:00:00 2001 +From 7ee5909a539f7a4a65c35e86404ceecb499c54c5 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 2 Nov 2023 14:20:11 +0900 Subject: [PATCH] meson: /etc/systemd/network is also used by udevd (cherry picked from commit 6256c65aad2a719ac9054961561bb26e497208ce) -Resolves: RHEL-111611 +Resolves: RHEL-109096 --- network/meson.build | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SOURCES/1218-sd-bus-make-bus_add_match_full-accept-timeout.patch b/SOURCES/1213-sd-bus-make-bus_add_match_full-accept-timeout.patch similarity index 98% rename from SOURCES/1218-sd-bus-make-bus_add_match_full-accept-timeout.patch rename to SOURCES/1213-sd-bus-make-bus_add_match_full-accept-timeout.patch index 0fc0ff9..cbe07f0 100644 --- a/SOURCES/1218-sd-bus-make-bus_add_match_full-accept-timeout.patch +++ b/SOURCES/1213-sd-bus-make-bus_add_match_full-accept-timeout.patch @@ -1,11 +1,11 @@ -From 0156030d3b8298f099389489b7fcb68df6de4516 Mon Sep 17 00:00:00 2001 +From 3b49b68593cbca6ee4e08a34a780fd5b5c3ab9fb Mon Sep 17 00:00:00 2001 From: licunlong Date: Thu, 15 Jun 2023 16:28:28 +0800 Subject: [PATCH] sd-bus: make bus_add_match_full accept timeout (cherry picked from commit bb30e58f644689feaa87d8136d1686b6c3a6f42a) -Related: RHEL-111630 +Related: RHEL-31756 --- src/libsystemd/sd-bus/bus-control.c | 48 +++++++++++++++++++++------- src/libsystemd/sd-bus/bus-control.h | 4 +-- diff --git a/SOURCES/1219-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch b/SOURCES/1214-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch similarity index 95% rename from SOURCES/1219-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch rename to SOURCES/1214-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch index c1fe478..2ab6a92 100644 --- a/SOURCES/1219-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch +++ b/SOURCES/1214-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch @@ -1,4 +1,4 @@ -From 42c47cd24767a8d1903905735ec4abfa5571cc17 Mon Sep 17 00:00:00 2001 +From 1a5720577ae6791ae64795486c5902b7c5aceb6b Mon Sep 17 00:00:00 2001 From: licunlong Date: Thu, 15 Jun 2023 10:47:32 +0800 Subject: [PATCH] core/unit: add get_timeout_start_usec in UnitVTable and @@ -6,7 +6,7 @@ Subject: [PATCH] core/unit: add get_timeout_start_usec in UnitVTable and (cherry picked from commit f5a9d2ee2a849aca1f2d15485d020142ff33cc30) -Related: RHEL-111630 +Related: RHEL-31756 --- src/core/service.c | 6 ++++++ src/core/unit.h | 3 +++ diff --git a/SOURCES/1220-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch b/SOURCES/1215-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch similarity index 97% rename from SOURCES/1220-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch rename to SOURCES/1215-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch index 9b962b5..fa1bfb4 100644 --- a/SOURCES/1220-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch +++ b/SOURCES/1215-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch @@ -1,4 +1,4 @@ -From 3f378aafe5cd51fa4e53c7d22be9e3e9fc9fa6d5 Mon Sep 17 00:00:00 2001 +From 6b2f0e500e6688d1b2d9ad8b9947e03bd58f27a2 Mon Sep 17 00:00:00 2001 From: licunlong Date: Wed, 24 May 2023 11:45:31 +0800 Subject: [PATCH] core/unit: increase the NameOwnerChanged/GetNameOwner timeout @@ -11,7 +11,7 @@ unit's start timeout. (cherry picked from commit 8df433d7cd268ae96cfe795feaa59f4d3e87b85c) -Related: RHEL-111630 +Related: RHEL-31756 --- src/core/unit.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/SOURCES/1221-core-sd-bus-drop-empty-lines-between-function-call-a.patch b/SOURCES/1216-core-sd-bus-drop-empty-lines-between-function-call-a.patch similarity index 94% rename from SOURCES/1221-core-sd-bus-drop-empty-lines-between-function-call-a.patch rename to SOURCES/1216-core-sd-bus-drop-empty-lines-between-function-call-a.patch index 8cf0882..5e7501e 100644 --- a/SOURCES/1221-core-sd-bus-drop-empty-lines-between-function-call-a.patch +++ b/SOURCES/1216-core-sd-bus-drop-empty-lines-between-function-call-a.patch @@ -1,4 +1,4 @@ -From 4fcc6acb1227491c5f76bb15560e34adb7b7f01a Mon Sep 17 00:00:00 2001 +From 14c6c9a0a58a99d66f541cec50a5cc860303ae7e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 29 Dec 2024 15:10:53 +0900 Subject: [PATCH] core,sd-bus: drop empty lines between function call and error @@ -6,7 +6,7 @@ Subject: [PATCH] core,sd-bus: drop empty lines between function call and error (cherry picked from commit 7baf4d234a70f136014f9e92f00c078a55c7adba) -Related: RHEL-111630 +Related: RHEL-31756 --- src/core/unit.c | 1 - src/libsystemd/sd-bus/sd-bus.c | 1 - diff --git a/SOURCES/1222-core-do-not-disconnect-from-bus-when-failed-to-insta.patch b/SOURCES/1217-core-do-not-disconnect-from-bus-when-failed-to-insta.patch similarity index 96% rename from SOURCES/1222-core-do-not-disconnect-from-bus-when-failed-to-insta.patch rename to SOURCES/1217-core-do-not-disconnect-from-bus-when-failed-to-insta.patch index f8ca0bc..8bf948f 100644 --- a/SOURCES/1222-core-do-not-disconnect-from-bus-when-failed-to-insta.patch +++ b/SOURCES/1217-core-do-not-disconnect-from-bus-when-failed-to-insta.patch @@ -1,4 +1,4 @@ -From d250fbcd7247ed2da554e1041c91709c8ed107c7 Mon Sep 17 00:00:00 2001 +From 899e94d72119c5e5f3d0ae75f39abd376bc28b0e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 29 Dec 2024 15:50:43 +0900 Subject: [PATCH] core: do not disconnect from bus when failed to install @@ -14,7 +14,7 @@ the situation when the issue is triggered. (cherry picked from commit db6b214f95aa42f9a9fa3d94a3c6492cc57b58fb) -Related: RHEL-111630 +Related: RHEL-31756 --- src/core/unit.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/SOURCES/1223-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch b/SOURCES/1218-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch similarity index 98% rename from SOURCES/1223-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch rename to SOURCES/1218-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch index d49d3b3..fc1cda9 100644 --- a/SOURCES/1223-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch +++ b/SOURCES/1218-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch @@ -1,4 +1,4 @@ -From a9dcedfb661c6ae82d3e5cd4542ab75b64a4e70e Mon Sep 17 00:00:00 2001 +From 5917dd6d4667ed4f97b63baaa3b35e2c1410f3c0 Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Thu, 28 Nov 2024 12:53:32 -0700 Subject: [PATCH] dbus: stash the subscriber list when we disconenct from the @@ -14,7 +14,7 @@ subscriptions. (cherry picked from commit 8402ca04d1a063c3d8a9e3d5c16df8bb8778ae98) -Related: RHEL-111630 +Related: RHEL-31756 --- src/core/dbus.c | 21 +++++++++++++++------ src/core/dbus.h | 2 +- diff --git a/SOURCES/1224-manager-s-deserialized_subscribed-subscribed_as_strv.patch b/SOURCES/1219-manager-s-deserialized_subscribed-subscribed_as_strv.patch similarity index 98% rename from SOURCES/1224-manager-s-deserialized_subscribed-subscribed_as_strv.patch rename to SOURCES/1219-manager-s-deserialized_subscribed-subscribed_as_strv.patch index d0fca5d..9150e88 100644 --- a/SOURCES/1224-manager-s-deserialized_subscribed-subscribed_as_strv.patch +++ b/SOURCES/1219-manager-s-deserialized_subscribed-subscribed_as_strv.patch @@ -1,4 +1,4 @@ -From ef32d4747836ecab0190f8780b98d2f29dfd7c6d Mon Sep 17 00:00:00 2001 +From 435d53448b8c427dc1b61b4d27342fb593185acf Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Wed, 11 Dec 2024 12:47:10 -0700 Subject: [PATCH] manager: s/deserialized_subscribed/subscribed_as_strv @@ -8,7 +8,7 @@ is misleading. Change the name to reflect its updated purpose. (cherry picked from commit e1315a621ae26473fcc9cd0d6013836f5f498d40) -Related: RHEL-111630 +Related: RHEL-31756 --- src/core/dbus.c | 6 +++--- src/core/manager-serialize.c | 2 +- diff --git a/SOURCES/1225-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch b/SOURCES/1220-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch similarity index 95% rename from SOURCES/1225-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch rename to SOURCES/1220-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch index c865201..1f6fddd 100644 --- a/SOURCES/1225-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch +++ b/SOURCES/1220-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch @@ -1,4 +1,4 @@ -From 812ba08785cfe86b3523b168eab7e9eb24dde6e0 Mon Sep 17 00:00:00 2001 +From da904dede254800cdbac51905db9423f8f88fefa Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 11 Jan 2025 16:26:55 +0100 Subject: [PATCH] bus-util: do not reset the count returned by @@ -14,7 +14,7 @@ Addresses https://github.com/systemd/systemd/pull/35406#discussion_r1912066774 (cherry picked from commit 33eeea4128f31df7ab4bd8866b582062d70114ae) -Related: RHEL-111630 +Related: RHEL-31756 --- src/shared/bus-util.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/SOURCES/1226-core-manager-restore-bus-track-deserialization-clean.patch b/SOURCES/1221-core-manager-restore-bus-track-deserialization-clean.patch similarity index 92% rename from SOURCES/1226-core-manager-restore-bus-track-deserialization-clean.patch rename to SOURCES/1221-core-manager-restore-bus-track-deserialization-clean.patch index b4bd5ea..d9240a8 100644 --- a/SOURCES/1226-core-manager-restore-bus-track-deserialization-clean.patch +++ b/SOURCES/1221-core-manager-restore-bus-track-deserialization-clean.patch @@ -1,4 +1,4 @@ -From 15270c9122882650fd355cda22006a2224590cf9 Mon Sep 17 00:00:00 2001 +From 02e5c4076ce3981fb2b0c7830197b2f13e225efe Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Mon, 13 Jan 2025 17:30:51 +0100 Subject: [PATCH] core/manager: restore bus track deserialization cleanup in @@ -9,7 +9,7 @@ There's zero explanation why it got (spuriously) removed in (cherry picked from commit 34f4b817f67b002eae7e2c09b19bf4b66c4791b6) -Related: RHEL-111630 +Related: RHEL-31756 --- src/core/manager.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SOURCES/1227-core-manager-drop-duplicate-bus-track-deserializatio.patch b/SOURCES/1222-core-manager-drop-duplicate-bus-track-deserializatio.patch similarity index 93% rename from SOURCES/1227-core-manager-drop-duplicate-bus-track-deserializatio.patch rename to SOURCES/1222-core-manager-drop-duplicate-bus-track-deserializatio.patch index 95954f1..8f6abca 100644 --- a/SOURCES/1227-core-manager-drop-duplicate-bus-track-deserializatio.patch +++ b/SOURCES/1222-core-manager-drop-duplicate-bus-track-deserializatio.patch @@ -1,4 +1,4 @@ -From 938b1847f5eee87ad0e0e95d62ee15ac73b50b87 Mon Sep 17 00:00:00 2001 +From 8e451eebfe6f37bacb02543d9a38c4ddaa6f8400 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 11 Jan 2025 18:38:49 +0100 Subject: [PATCH] core/manager: drop duplicate bus track deserialization @@ -8,7 +8,7 @@ bus_init_api() now does this internally (cherry picked from commit af0e10354e567bfd0b9521376b2aad55f12a4e3d) -Related: RHEL-111630 +Related: RHEL-31756 --- src/core/manager.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/SOURCES/1228-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch b/SOURCES/1223-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch similarity index 97% rename from SOURCES/1228-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch rename to SOURCES/1223-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch index ea0f832..ca630b9 100644 --- a/SOURCES/1228-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch +++ b/SOURCES/1223-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch @@ -1,4 +1,4 @@ -From 2ea409070b1e863d243476c20f0b2229acff6878 Mon Sep 17 00:00:00 2001 +From f18c7dd568ba87c6aa9a045878c0a9ef7c23208e Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Thu, 31 Jul 2025 18:26:09 +0200 Subject: [PATCH] sd-bus/bus-track: use install_callback in @@ -15,7 +15,7 @@ Fixes #32381 (cherry picked from commit dcf42d1ee21222ee698e5e0ab3ecf3411b63da40) -Related: RHEL-111630 +Related: RHEL-31756 --- src/libsystemd/sd-bus/bus-track.c | 32 +++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/SOURCES/1224-shell-completion-add-kernel-identify-inspect-verbs-f.patch b/SOURCES/1224-shell-completion-add-kernel-identify-inspect-verbs-f.patch new file mode 100644 index 0000000..f049a09 --- /dev/null +++ b/SOURCES/1224-shell-completion-add-kernel-identify-inspect-verbs-f.patch @@ -0,0 +1,38 @@ +From 9f940102616443911fff789aae63546c1da3138e Mon Sep 17 00:00:00 2001 +From: Luca Boccassi +Date: Tue, 18 Feb 2025 21:15:08 +0000 +Subject: [PATCH] shell completion: add kernel-identify/inspect verbs for + bootctl + +Follow-up for a05255981ba5b04f1cf54ea656fbce1dfd9c3a68 +Follow-up for 3e0a3a0259324b4c40a9a62c8506fe683cd0273b + +(cherry picked from commit 6a6d4c3f3c123a1cbb6770f1cae8c130a48333e1) + +Resolves: RHEL-108576 +--- + shell-completion/bash/bootctl | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/shell-completion/bash/bootctl b/shell-completion/bash/bootctl +index 0b7cef7871..328289e0cf 100644 +--- a/shell-completion/bash/bootctl ++++ b/shell-completion/bash/bootctl +@@ -70,6 +70,7 @@ _bootctl() { + [STANDALONE]='help status install update remove is-installed random-seed systemd-efi-options list set-timeout set-timeout-oneshot' + [BOOTENTRY]='set-default set-oneshot' + [BOOLEAN]='reboot-to-firmware' ++ [FILE]='kernel-identify kernel-inspect' + ) + + for ((i=0; i < COMP_CWORD; i++)); do +@@ -100,6 +101,9 @@ _bootctl() { + fi + elif __contains_word "$verb" ${VERBS[BOOLEAN]}; then + comps="yes no" ++ elif __contains_word "$verb" ${VERBS[FILE]}; then ++ comps=$( compgen -A file -- "$cur" ) ++ compopt -o filenames + fi + + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) diff --git a/SOURCES/1211-test-add-tests-for-format_timestamp-and-parse_timest.patch b/SOURCES/1225-test-add-tests-for-format_timestamp-and-parse_timest.patch similarity index 99% rename from SOURCES/1211-test-add-tests-for-format_timestamp-and-parse_timest.patch rename to SOURCES/1225-test-add-tests-for-format_timestamp-and-parse_timest.patch index 9be09dc..6f1e028 100644 --- a/SOURCES/1211-test-add-tests-for-format_timestamp-and-parse_timest.patch +++ b/SOURCES/1225-test-add-tests-for-format_timestamp-and-parse_timest.patch @@ -1,4 +1,4 @@ -From b60dbde3b1a767239dbaf1025eb9ac55585eac2f Mon Sep 17 00:00:00 2001 +From 05b4623cb23c6f083a5bee9769e5cd22d8ff4e16 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 12 Feb 2023 05:30:49 +0900 Subject: [PATCH] test: add tests for format_timestamp() and parse_timestamp() @@ -6,7 +6,7 @@ Subject: [PATCH] test: add tests for format_timestamp() and parse_timestamp() (cherry picked from commit 8b51c41fd0796b1299f3b7f2f11eaf4efae8c2db) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 378 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 366 insertions(+), 12 deletions(-) diff --git a/SOURCES/1212-test-time-util-disable-failing-tests.patch b/SOURCES/1226-test-time-util-disable-failing-tests.patch similarity index 95% rename from SOURCES/1212-test-time-util-disable-failing-tests.patch rename to SOURCES/1226-test-time-util-disable-failing-tests.patch index e27e517..2ba88ca 100644 --- a/SOURCES/1212-test-time-util-disable-failing-tests.patch +++ b/SOURCES/1226-test-time-util-disable-failing-tests.patch @@ -1,4 +1,4 @@ -From 46941d4ae57a6d197ab212fea499fe8ab537a769 Mon Sep 17 00:00:00 2001 +From c7a62e108ffbe41ccf1bb5fba4b5a37daf317939 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 15 Aug 2025 15:12:14 +0200 Subject: [PATCH] test-time-util: disable failing tests @@ -9,7 +9,7 @@ PR. RHEL-only: ci -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SOURCES/1213-test-test-parse_timestamp-in-various-timezone.patch b/SOURCES/1227-test-test-parse_timestamp-in-various-timezone.patch similarity index 98% rename from SOURCES/1213-test-test-parse_timestamp-in-various-timezone.patch rename to SOURCES/1227-test-test-parse_timestamp-in-various-timezone.patch index c084ad4..a8d9da4 100644 --- a/SOURCES/1213-test-test-parse_timestamp-in-various-timezone.patch +++ b/SOURCES/1227-test-test-parse_timestamp-in-various-timezone.patch @@ -1,11 +1,11 @@ -From b90ba17e5858dd6fc6f199a360ae0892d531c4df Mon Sep 17 00:00:00 2001 +From 9010f2b16067fbe974cd1922b596bcd526de07bc Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 3 Mar 2023 12:09:59 +0900 Subject: [PATCH] test: test parse_timestamp() in various timezone (cherry picked from commit d8f3ad627c9a857d46d442f8ab722c1efab30d5c) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 57 +++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/SOURCES/1214-systemctl-logind-add-missing-asserts.patch b/SOURCES/1228-systemctl-logind-add-missing-asserts.patch similarity index 93% rename from SOURCES/1214-systemctl-logind-add-missing-asserts.patch rename to SOURCES/1228-systemctl-logind-add-missing-asserts.patch index f1960d0..c5c0ab5 100644 --- a/SOURCES/1214-systemctl-logind-add-missing-asserts.patch +++ b/SOURCES/1228-systemctl-logind-add-missing-asserts.patch @@ -1,11 +1,11 @@ -From 0c887fd73e8d9ade1a4e93fa8e258633d7000a52 Mon Sep 17 00:00:00 2001 +From 41b7fedf9ed75f6dfa9fec03a70964b897fbf9ba Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Tue, 14 Mar 2023 06:56:17 +0800 Subject: [PATCH] systemctl: logind: add missing asserts (cherry picked from commit 9071eea01bd26d838bfd793db497efd849ad44da) -Related: RHEL-110954 +Related: RHEL-109488 --- src/systemctl/systemctl-logind.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/SOURCES/1215-systemctl-logind-make-logind_schedule_shutdown-accep.patch b/SOURCES/1229-systemctl-logind-make-logind_schedule_shutdown-accep.patch similarity index 96% rename from SOURCES/1215-systemctl-logind-make-logind_schedule_shutdown-accep.patch rename to SOURCES/1229-systemctl-logind-make-logind_schedule_shutdown-accep.patch index ea0abee..23092c9 100644 --- a/SOURCES/1215-systemctl-logind-make-logind_schedule_shutdown-accep.patch +++ b/SOURCES/1229-systemctl-logind-make-logind_schedule_shutdown-accep.patch @@ -1,4 +1,4 @@ -From 3e641f30f6ad6990d06bd677aabffdc47ef6e200 Mon Sep 17 00:00:00 2001 +From 5085c1c72a52d6c4e8b47d91a6cd08ceec9c49cc Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sun, 5 Mar 2023 23:11:48 +0800 Subject: [PATCH] systemctl: logind: make logind_schedule_shutdown accept @@ -6,7 +6,7 @@ Subject: [PATCH] systemctl: logind: make logind_schedule_shutdown accept (cherry picked from commit 92b00e867844948bdf559758739343c4308570c0) -Related: RHEL-110954 +Related: RHEL-109488 --- src/systemctl/systemctl-compat-halt.c | 2 +- src/systemctl/systemctl-logind.c | 8 +++++--- diff --git a/SOURCES/1216-systemctl-add-option-when-for-scheduled-shutdown.patch b/SOURCES/1230-systemctl-add-option-when-for-scheduled-shutdown.patch similarity index 99% rename from SOURCES/1216-systemctl-add-option-when-for-scheduled-shutdown.patch rename to SOURCES/1230-systemctl-add-option-when-for-scheduled-shutdown.patch index d5df0d7..08e57cb 100644 --- a/SOURCES/1216-systemctl-add-option-when-for-scheduled-shutdown.patch +++ b/SOURCES/1230-systemctl-add-option-when-for-scheduled-shutdown.patch @@ -1,4 +1,4 @@ -From 83f2c59faf0ba979b27824821096dd322336ef2f Mon Sep 17 00:00:00 2001 +From 87f8db36eb01b805e7000aeb69ebfaf1c8c323b8 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sun, 5 Mar 2023 23:27:44 +0800 Subject: [PATCH] systemctl: add option --when for scheduled shutdown @@ -10,7 +10,7 @@ Replaces #17258 (cherry picked from commit 1433e1f998465b7acf472c73d58c14e7e2eb3f13) -Resolves: RHEL-110954 +Resolves: RHEL-109488 --- man/systemctl.xml | 41 ++++++++++++++----------- src/systemctl/systemctl-logind.c | 26 ++++++++++------ diff --git a/SOURCES/1217-test-time-util-add-test-cases-to-invalidate-show-and.patch b/SOURCES/1231-test-time-util-add-test-cases-to-invalidate-show-and.patch similarity index 93% rename from SOURCES/1217-test-time-util-add-test-cases-to-invalidate-show-and.patch rename to SOURCES/1231-test-time-util-add-test-cases-to-invalidate-show-and.patch index 413cd3e..b7d87bd 100644 --- a/SOURCES/1217-test-time-util-add-test-cases-to-invalidate-show-and.patch +++ b/SOURCES/1231-test-time-util-add-test-cases-to-invalidate-show-and.patch @@ -1,4 +1,4 @@ -From b58bad789badd3872c25c411734fc670f17fe846 Mon Sep 17 00:00:00 2001 +From e8f66d4c6570765fd60111ec7e3b5dbdb7d14c69 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Tue, 14 Mar 2023 07:16:18 +0800 Subject: [PATCH] test-time-util: add test cases to invalidate "show" and @@ -8,7 +8,7 @@ Ensure that systemctl reboot --when=show and --when=cancel will not result in am (cherry picked from commit 165655cb1de2e79d954d9165459143140e52c53b) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SOURCES/1232-Introduce-RET_GATHER-and-use-it-in-src-shared.patch b/SOURCES/1232-Introduce-RET_GATHER-and-use-it-in-src-shared.patch new file mode 100644 index 0000000..9fdcfa6 --- /dev/null +++ b/SOURCES/1232-Introduce-RET_GATHER-and-use-it-in-src-shared.patch @@ -0,0 +1,128 @@ +From 5bec9826a14483e7e612879fe2630f1b517e37be Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Sun, 9 Jul 2023 13:25:42 -0600 +Subject: [PATCH] Introduce RET_GATHER and use it in src/shared/ + +The idea is to make it easier to implement the common pattern of +accumulating errors (negative values) in an accumulator to return +the first error. + +(cherry picked from commit 809c3a84e1a572ccaaa7eca5394c0b842118c22f) + +Resolves: RHEL-108598 +--- + src/basic/errno-util.h | 10 ++++++++++ + src/shared/bus-util.c | 10 ++-------- + src/shared/devnode-acl.c | 4 ++-- + src/shared/nscd-flush.c | 16 +++++----------- + src/test/test-errno-util.c | 11 +++++++++++ + 5 files changed, 30 insertions(+), 21 deletions(-) + +diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h +index b10dd755c9..27804e6382 100644 +--- a/src/basic/errno-util.h ++++ b/src/basic/errno-util.h +@@ -74,6 +74,16 @@ static inline int RET_NERRNO(int ret) { + return ret; + } + ++/* Collect possible errors in , so that the first error can be returned. ++ * Returns (possibly updated) . */ ++#define RET_GATHER(acc, err) \ ++ ({ \ ++ int *__a = &(acc), __e = (err); \ ++ if (*__a >= 0 && __e < 0) \ ++ *__a = __e; \ ++ *__a; \ ++ }) ++ + static inline int errno_or_else(int fallback) { + /* To be used when invoking library calls where errno handling is not defined clearly: we return + * errno if it is set, and the specified error otherwise. The idea is that the caller initializes +diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c +index 5e6d17d201..7c8d2aa6f5 100644 +--- a/src/shared/bus-util.c ++++ b/src/shared/bus-util.c +@@ -484,14 +484,8 @@ int bus_track_add_name_many(sd_bus_track *t, char **l) { + + /* Continues adding after failure, and returns the first failure. */ + +- STRV_FOREACH(i, l) { +- int k; +- +- k = sd_bus_track_add_name(t, *i); +- if (k < 0 && r >= 0) +- r = k; +- } +- ++ STRV_FOREACH(i, l) ++ RET_GATHER(r, sd_bus_track_add_name(t, *i)); + return r; + } + +diff --git a/src/shared/devnode-acl.c b/src/shared/devnode-acl.c +index 66e3a40f2f..8c961061cf 100644 +--- a/src/shared/devnode-acl.c ++++ b/src/shared/devnode-acl.c +@@ -220,8 +220,8 @@ int devnode_acl_all(const char *seat, + k = devnode_acl(n, flush, del, old_uid, add, new_uid); + if (k == -ENOENT) + log_debug("Device %s disappeared while setting ACLs", n); +- else if (k < 0 && r == 0) +- r = k; ++ else ++ RET_GATHER(r, k); + } + + return r; +diff --git a/src/shared/nscd-flush.c b/src/shared/nscd-flush.c +index 9b0ba2d67a..d2b41f2b4d 100644 +--- a/src/shared/nscd-flush.c ++++ b/src/shared/nscd-flush.c +@@ -128,21 +128,15 @@ static int nscd_flush_cache_one(const char *database, usec_t end) { + } + + int nscd_flush_cache(char **databases) { +- usec_t end; + int r = 0; + +- /* Tries to invalidate the specified database in nscd. We do this carefully, with a 5s timeout, so that we +- * don't block indefinitely on another service. */ ++ /* Tries to invalidate the specified database in nscd. We do this carefully, with a 5s timeout, ++ * so that we don't block indefinitely on another service. */ + +- end = usec_add(now(CLOCK_MONOTONIC), NSCD_FLUSH_CACHE_TIMEOUT_USEC); ++ usec_t end = usec_add(now(CLOCK_MONOTONIC), NSCD_FLUSH_CACHE_TIMEOUT_USEC); + +- STRV_FOREACH(i, databases) { +- int k; +- +- k = nscd_flush_cache_one(*i, end); +- if (k < 0 && r >= 0) +- r = k; +- } ++ STRV_FOREACH(i, databases) ++ RET_GATHER(r, nscd_flush_cache_one(*i, end)); + + return r; + } +diff --git a/src/test/test-errno-util.c b/src/test/test-errno-util.c +index cac0d5402b..77fb7d0011 100644 +--- a/src/test/test-errno-util.c ++++ b/src/test/test-errno-util.c +@@ -67,4 +67,15 @@ TEST(ERRNO_IS_TRANSIENT) { + assert_se(!ERRNO_IS_NEG_TRANSIENT(INTMAX_MIN)); + } + ++TEST(RET_GATHER) { ++ int x = 0, y = 2; ++ ++ assert_se(RET_GATHER(x, 5) == 0); ++ assert_se(RET_GATHER(x, -5) == -5); ++ assert_se(RET_GATHER(x, -1) == -5); ++ ++ assert_se(RET_GATHER(x, y++) == -5); ++ assert_se(y == 3); ++} ++ + DEFINE_TEST_MAIN(LOG_INFO); diff --git a/SOURCES/1233-fd-util-don-t-eat-up-errors-in-fd_cloexec_many.patch b/SOURCES/1233-fd-util-don-t-eat-up-errors-in-fd_cloexec_many.patch new file mode 100644 index 0000000..1992592 --- /dev/null +++ b/SOURCES/1233-fd-util-don-t-eat-up-errors-in-fd_cloexec_many.patch @@ -0,0 +1,50 @@ +From c2dc44abd4014f13a40dde350af92e2d74201359 Mon Sep 17 00:00:00 2001 +From: Mike Yuan +Date: Fri, 29 Dec 2023 17:57:59 +0800 +Subject: [PATCH] fd-util: don't eat up errors in fd_cloexec_many + +Follow-up for ed18c22c989495aab36512f03449222cfcf79aa7 + +Before this commit, a successful fd_cloexec() call would +discard all previously gathered errors. + +(cherry picked from commit 6b9cac874c33f4fa27aa4b4b5b980f60c28ee043) + +Resolves: RHEL-108598 +--- + src/basic/fd-util.c | 13 ++++++------- + 1 file changed, 6 insertions(+), 7 deletions(-) + +diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c +index 66bb7569bb..932c5a8d80 100644 +--- a/src/basic/fd-util.c ++++ b/src/basic/fd-util.c +@@ -175,7 +175,7 @@ int fd_cloexec(int fd, bool cloexec) { + } + + int fd_cloexec_many(const int fds[], size_t n_fds, bool cloexec) { +- int ret = 0, r; ++ int r = 0; + + assert(n_fds == 0 || fds); + +@@ -183,14 +183,13 @@ int fd_cloexec_many(const int fds[], size_t n_fds, bool cloexec) { + if (fds[i] < 0) /* Skip gracefully over already invalidated fds */ + continue; + +- r = fd_cloexec(fds[i], cloexec); +- if (r < 0 && ret >= 0) /* Continue going, but return first error */ +- ret = r; +- else +- ret = 1; /* report if we did anything */ ++ RET_GATHER(r, fd_cloexec(fds[i], cloexec)); ++ ++ if (r >= 0) ++ r = 1; /* report if we did anything */ + } + +- return ret; ++ return r; + } + + _pure_ static bool fd_in_set(int fd, const int fdset[], size_t n_fdset) { diff --git a/SOURCES/1234-sd-bus-refuse-to-send-messages-with-an-invalid-strin.patch b/SOURCES/1234-sd-bus-refuse-to-send-messages-with-an-invalid-strin.patch new file mode 100644 index 0000000..c1a582b --- /dev/null +++ b/SOURCES/1234-sd-bus-refuse-to-send-messages-with-an-invalid-strin.patch @@ -0,0 +1,52 @@ +From 762a8dc0c328e256847b111249bbff8e70f98942 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Fri, 19 May 2023 04:33:39 +0900 +Subject: [PATCH] sd-bus: refuse to send messages with an invalid string + +Prompted by aaf7b0e41105d7b7cf30912cdac32820f011a219 and +4804da58536ab7ad46178a03f4d2da49fd8e4ba2. + +(cherry picked from commit 26a9dd6f55bb757e0033995cbb16bca12986b7cd) + +Resolves: RHEL-108584 +--- + src/libsystemd/sd-bus/bus-message.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c +index 213b276e33..c51af56dda 100644 +--- a/src/libsystemd/sd-bus/bus-message.c ++++ b/src/libsystemd/sd-bus/bus-message.c +@@ -1324,12 +1324,21 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void + * into the empty string */ + p = strempty(p); + +- _fallthrough_; ++ if (!utf8_is_valid(p)) ++ return -EINVAL; ++ ++ align = 4; ++ sz = 4 + strlen(p) + 1; ++ break; ++ + case SD_BUS_TYPE_OBJECT_PATH: + + if (!p) + return -EINVAL; + ++ if (!object_path_is_valid(p)) ++ return -EINVAL; ++ + align = 4; + sz = 4 + strlen(p) + 1; + break; +@@ -1338,6 +1347,9 @@ int message_append_basic(sd_bus_message *m, char type, const void *p, const void + + p = strempty(p); + ++ if (!signature_is_valid(p, /* allow_dict_entry = */ true)) ++ return -EINVAL; ++ + align = 1; + sz = 1 + strlen(p) + 1; + break; diff --git a/SOURCES/1235-test-check-if-we-correctly-handle-invalid-UTF-8-in-m.patch b/SOURCES/1235-test-check-if-we-correctly-handle-invalid-UTF-8-in-m.patch new file mode 100644 index 0000000..be9eebb --- /dev/null +++ b/SOURCES/1235-test-check-if-we-correctly-handle-invalid-UTF-8-in-m.patch @@ -0,0 +1,92 @@ +From f3f939b236636fdca38e89ca564a669f0da4fd4d Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Fri, 19 May 2023 18:42:36 +0200 +Subject: [PATCH] test: check if we correctly handle invalid UTF-8 in mount + stuff + +Provides coverage for #27611. + +(cherry picked from commit b74df879fc81d4668ce14532a76c23b85e651170) + +Resolves: RHEL-108584 +--- + .../units/testsuite-07.mount-invalid-chars.sh | 70 +++++++++++++++++++ + 1 file changed, 70 insertions(+) + create mode 100755 test/units/testsuite-07.mount-invalid-chars.sh + +diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh +new file mode 100755 +index 0000000000..617ea697c8 +--- /dev/null ++++ b/test/units/testsuite-07.mount-invalid-chars.sh +@@ -0,0 +1,70 @@ ++#!/usr/bin/env bash ++# SPDX-License-Identifier: LGPL-2.1-or-later ++set -eux ++set -o pipefail ++ ++# Don't send invalid characters over dbus if a mount contains them ++ ++at_exit() { ++ mountpoint -q /proc/1/mountinfo && umount /proc/1/mountinfo ++ [[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab /etc/fstab ++ rm -f /run/systemd/system/foo-*.mount ++ systemctl daemon-reload ++} ++ ++trap at_exit EXIT ++ ++# Check invalid characters directly in /proc/mountinfo ++# ++# This is a bit tricky (and hacky), since we have to temporarily replace ++# PID 1's /proc/mountinfo, but we have to keep the original mounts intact, ++# otherwise systemd would unmount them on reload ++TMP_MOUNTINFO="$(mktemp)" ++ ++cp /proc/1/mountinfo "$TMP_MOUNTINFO" ++# Add a mount entry with a "Unicode non-character" in it ++echo -ne '69 1 252:2 / /foo/mountinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO" ++mount --bind "$TMP_MOUNTINFO" /proc/1/mountinfo ++systemctl daemon-reload ++# On affected versions this would throw an error: ++# Failed to get properties: Bad message ++systemctl status foo-mountinfo.mount ++ ++umount /proc/1/mountinfo ++systemctl daemon-reload ++rm -f "$TMP_MOUNTINFO" ++ ++# Check invalid characters in a mount unit ++# ++# systemd already handles this and refuses to load the invalid string, e.g.: ++# foo-fstab.mount:9: String is not UTF-8 clean, ignoring assignment: What=//localhost/foo���bar ++# ++# a) Unit generated from /etc/fstab ++[[ -e /etc/fstab ]] && cp -f /etc/fstab /tmp/fstab.bak ++ ++echo -ne '//localhost/foo\ufffebar /foo/fstab cifs defaults 0 0\n' >/etc/fstab ++systemctl daemon-reload ++[[ "$(systemctl show -P UnitFileState foo-fstab.mount)" == bad ]] ++ ++# b) Unit generated from /etc/fstab (but the invalid character is in options) ++echo -ne '//localhost/foobar /foo/fstab/opt cifs nosuid,a\ufffeb,noexec 0 0\n' >/etc/fstab ++systemctl daemon-reload ++[[ "$(systemctl show -P UnitFileState foo-fstab-opt.mount)" == bad ]] ++rm -f /etc/fstab ++ ++[[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab /etc/fstab ++systemctl daemon-reload ++ ++# c) Mount unit ++mkdir -p /run/systemd/system ++echo -ne '[Mount]\nWhat=//localhost/foo\ufffebar\nWhere=/foo/unit\nType=cifs\nOptions=noexec\n' >/run/systemd/system/foo-unit.mount ++systemctl daemon-reload ++[[ "$(systemctl show -P UnitFileState foo-unit.mount)" == bad ]] ++rm -f /run/systemd/system/foo-unit.mount ++ ++# d) Mount unit (but the invalid character is in Options=) ++mkdir -p /run/systemd/system ++echo -ne '[Mount]\nWhat=//localhost/foobar\nWhere=/foo/unit/opt\nType=cifs\nOptions=noexec,a\ufffeb,nosuid\n' >/run/systemd/system/foo-unit-opt.mount ++systemctl daemon-reload ++[[ "$(systemctl show -P UnitFileState foo-unit-opt.mount)" == bad ]] ++rm -f /run/systemd/system/foo-unit-opt.mount diff --git a/SOURCES/1236-test-fix-a-typo-in-the-cleanup-stuff.patch b/SOURCES/1236-test-fix-a-typo-in-the-cleanup-stuff.patch new file mode 100644 index 0000000..c077de1 --- /dev/null +++ b/SOURCES/1236-test-fix-a-typo-in-the-cleanup-stuff.patch @@ -0,0 +1,25 @@ +From e882eabc5c9115413db1e6d83f4542ad618fec23 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Mon, 22 May 2023 12:06:16 +0200 +Subject: [PATCH] test: fix a typo in the cleanup stuff + +(cherry picked from commit 7942811255f3d6973b246ebf6b26b690bbceab37) + +Resolves: RHEL-108584 +--- + test/units/testsuite-07.mount-invalid-chars.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh +index 617ea697c8..b70e621126 100755 +--- a/test/units/testsuite-07.mount-invalid-chars.sh ++++ b/test/units/testsuite-07.mount-invalid-chars.sh +@@ -7,7 +7,7 @@ set -o pipefail + + at_exit() { + mountpoint -q /proc/1/mountinfo && umount /proc/1/mountinfo +- [[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab /etc/fstab ++ [[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab.bak /etc/fstab + rm -f /run/systemd/system/foo-*.mount + systemctl daemon-reload + } diff --git a/SOURCES/1237-test-explicitly-specify-a-UTF-8-locale-for-UTF-8-she.patch b/SOURCES/1237-test-explicitly-specify-a-UTF-8-locale-for-UTF-8-she.patch new file mode 100644 index 0000000..0049646 --- /dev/null +++ b/SOURCES/1237-test-explicitly-specify-a-UTF-8-locale-for-UTF-8-she.patch @@ -0,0 +1,62 @@ +From 78641d8a552eb95dd85cad9686d829af48478727 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Mon, 14 Aug 2023 20:09:31 +0200 +Subject: [PATCH] test: explicitly specify a UTF-8 locale for UTF-8 shenanigans + +As things don't work well without it: + +$ LANG=C printf "\ufffe\n" +\uFFFE + +(cherry picked from commit 01febfcdce0326aa1888d085c1009c9399f6a930) + +Resolves: RHEL-108584 +--- + test/units/testsuite-07.mount-invalid-chars.sh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh +index b70e621126..5a07d14d04 100755 +--- a/test/units/testsuite-07.mount-invalid-chars.sh ++++ b/test/units/testsuite-07.mount-invalid-chars.sh +@@ -23,7 +23,7 @@ TMP_MOUNTINFO="$(mktemp)" + + cp /proc/1/mountinfo "$TMP_MOUNTINFO" + # Add a mount entry with a "Unicode non-character" in it +-echo -ne '69 1 252:2 / /foo/mountinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO" ++LANG="C.UTF-8" printf '69 1 252:2 / /foo/mountinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO" + mount --bind "$TMP_MOUNTINFO" /proc/1/mountinfo + systemctl daemon-reload + # On affected versions this would throw an error: +@@ -42,12 +42,12 @@ rm -f "$TMP_MOUNTINFO" + # a) Unit generated from /etc/fstab + [[ -e /etc/fstab ]] && cp -f /etc/fstab /tmp/fstab.bak + +-echo -ne '//localhost/foo\ufffebar /foo/fstab cifs defaults 0 0\n' >/etc/fstab ++LANG="C.UTF-8" printf '//localhost/foo\ufffebar /foo/fstab cifs defaults 0 0\n' >/etc/fstab + systemctl daemon-reload + [[ "$(systemctl show -P UnitFileState foo-fstab.mount)" == bad ]] + + # b) Unit generated from /etc/fstab (but the invalid character is in options) +-echo -ne '//localhost/foobar /foo/fstab/opt cifs nosuid,a\ufffeb,noexec 0 0\n' >/etc/fstab ++LANG="C.UTF-8" printf '//localhost/foobar /foo/fstab/opt cifs nosuid,a\ufffeb,noexec 0 0\n' >/etc/fstab + systemctl daemon-reload + [[ "$(systemctl show -P UnitFileState foo-fstab-opt.mount)" == bad ]] + rm -f /etc/fstab +@@ -57,14 +57,14 @@ systemctl daemon-reload + + # c) Mount unit + mkdir -p /run/systemd/system +-echo -ne '[Mount]\nWhat=//localhost/foo\ufffebar\nWhere=/foo/unit\nType=cifs\nOptions=noexec\n' >/run/systemd/system/foo-unit.mount ++LANG="C.UTF-8" printf '[Mount]\nWhat=//localhost/foo\ufffebar\nWhere=/foo/unit\nType=cifs\nOptions=noexec\n' >/run/systemd/system/foo-unit.mount + systemctl daemon-reload + [[ "$(systemctl show -P UnitFileState foo-unit.mount)" == bad ]] + rm -f /run/systemd/system/foo-unit.mount + + # d) Mount unit (but the invalid character is in Options=) + mkdir -p /run/systemd/system +-echo -ne '[Mount]\nWhat=//localhost/foobar\nWhere=/foo/unit/opt\nType=cifs\nOptions=noexec,a\ufffeb,nosuid\n' >/run/systemd/system/foo-unit-opt.mount ++LANG="C.UTF-8" printf '[Mount]\nWhat=//localhost/foobar\nWhere=/foo/unit/opt\nType=cifs\nOptions=noexec,a\ufffeb,nosuid\n' >/run/systemd/system/foo-unit-opt.mount + systemctl daemon-reload + [[ "$(systemctl show -P UnitFileState foo-unit-opt.mount)" == bad ]] + rm -f /run/systemd/system/foo-unit-opt.mount diff --git a/SOURCES/1238-test-use-the-correct-file-name-when-restoring-the-or.patch b/SOURCES/1238-test-use-the-correct-file-name-when-restoring-the-or.patch new file mode 100644 index 0000000..4710926 --- /dev/null +++ b/SOURCES/1238-test-use-the-correct-file-name-when-restoring-the-or.patch @@ -0,0 +1,26 @@ +From 15ad0f0a0145640ee290d805030338f8c01051f4 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Wed, 23 Aug 2023 15:10:23 +0200 +Subject: [PATCH] test: use the correct file name when restoring the original + fstab + +(cherry picked from commit 9541addff028b56724df79fcf5b88e1544403957) + +Resolves: RHEL-108584 +--- + test/units/testsuite-07.mount-invalid-chars.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh +index 5a07d14d04..a879334869 100755 +--- a/test/units/testsuite-07.mount-invalid-chars.sh ++++ b/test/units/testsuite-07.mount-invalid-chars.sh +@@ -52,7 +52,7 @@ systemctl daemon-reload + [[ "$(systemctl show -P UnitFileState foo-fstab-opt.mount)" == bad ]] + rm -f /etc/fstab + +-[[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab /etc/fstab ++[[ -e /tmp/fstab.bak ]] && mv -f /tmp/fstab.bak /etc/fstab + systemctl daemon-reload + + # c) Mount unit diff --git a/SOURCES/1239-core-escape-UTF-8-in-mount-unit-Where-field-before-s.patch b/SOURCES/1239-core-escape-UTF-8-in-mount-unit-Where-field-before-s.patch new file mode 100644 index 0000000..2a17e20 --- /dev/null +++ b/SOURCES/1239-core-escape-UTF-8-in-mount-unit-Where-field-before-s.patch @@ -0,0 +1,134 @@ +From b280191167ddc52a77da5b4047297d288f9ce73b Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 20 Jun 2025 13:16:10 +0200 +Subject: [PATCH] core: escape UTF-8 in mount unit Where field before sending + to clients + +Followup for: 4804da58536ab7ad46178a03f4d2da49fd8e4ba2 #27541 + +Fixes: #36206 +(cherry picked from commit 222b0b05ce9ac29283cd89cf98444c4da3373568) + +Resolves: RHEL-108584 +--- + src/core/dbus-mount.c | 23 ++++++++++++++++++- + src/core/mount.c | 16 ++++++++++++- + src/core/mount.h | 2 ++ + .../units/testsuite-07.mount-invalid-chars.sh | 5 ++-- + 4 files changed, 42 insertions(+), 4 deletions(-) + +diff --git a/src/core/dbus-mount.c b/src/core/dbus-mount.c +index 55ad4f2c98..7006ebbbba 100644 +--- a/src/core/dbus-mount.c ++++ b/src/core/dbus-mount.c +@@ -11,6 +11,27 @@ + #include "unit.h" + #include "utf8.h" + ++static int property_get_where( ++ sd_bus *bus, ++ const char *path, ++ const char *interface, ++ const char *property, ++ sd_bus_message *reply, ++ void *userdata, ++ sd_bus_error *error) { ++ ++ Mount *m = ASSERT_PTR(userdata); ++ ++ assert(bus); ++ assert(reply); ++ ++ _cleanup_free_ char *escaped = mount_get_where_escaped(m); ++ if (!escaped) ++ return -ENOMEM; ++ ++ return sd_bus_message_append_basic(reply, 's', escaped); ++} ++ + static int property_get_what( + sd_bus *bus, + const char *path, +@@ -84,7 +105,7 @@ static BUS_DEFINE_PROPERTY_GET_ENUM(property_get_result, mount_result, MountResu + + const sd_bus_vtable bus_mount_vtable[] = { + SD_BUS_VTABLE_START(0), +- SD_BUS_PROPERTY("Where", "s", NULL, offsetof(Mount, where), SD_BUS_VTABLE_PROPERTY_CONST), ++ SD_BUS_PROPERTY("Where", "s", property_get_where, 0, SD_BUS_VTABLE_PROPERTY_CONST), + SD_BUS_PROPERTY("What", "s", property_get_what, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("Options","s", property_get_options, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), + SD_BUS_PROPERTY("Type", "s", property_get_type, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), +diff --git a/src/core/mount.c b/src/core/mount.c +index cfe3f40302..79772fb6f1 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -31,6 +31,7 @@ + #include "strv.h" + #include "unit-name.h" + #include "unit.h" ++#include "utf8.h" + + #define RETRY_UMOUNT_MAX 32 + +@@ -657,7 +658,11 @@ static int mount_add_extras(Mount *m) { + path_simplify(m->where); + + if (!u->description) { +- r = unit_set_description(u, m->where); ++ _cleanup_free_ char *w = mount_get_where_escaped(m); ++ if (!w) ++ return log_oom(); ++ ++ r = unit_set_description(u, w); + if (r < 0) + return r; + } +@@ -2207,6 +2212,15 @@ static int mount_can_start(Unit *u) { + return 1; + } + ++char* mount_get_where_escaped(const Mount *m) { ++ assert(m); ++ ++ if (!m->where) ++ return strdup(""); ++ ++ return utf8_escape_invalid(m->where); ++} ++ + static const char* const mount_exec_command_table[_MOUNT_EXEC_COMMAND_MAX] = { + [MOUNT_EXEC_MOUNT] = "ExecMount", + [MOUNT_EXEC_UNMOUNT] = "ExecUnmount", +diff --git a/src/core/mount.h b/src/core/mount.h +index 1a0d9fc5e5..db4a915202 100644 +--- a/src/core/mount.h ++++ b/src/core/mount.h +@@ -93,6 +93,8 @@ extern const UnitVTable mount_vtable; + + void mount_fd_event(Manager *m, int events); + ++char* mount_get_where_escaped(const Mount *m); ++ + const char* mount_exec_command_to_string(MountExecCommand i) _const_; + MountExecCommand mount_exec_command_from_string(const char *s) _pure_; + +diff --git a/test/units/testsuite-07.mount-invalid-chars.sh b/test/units/testsuite-07.mount-invalid-chars.sh +index a879334869..cd2ca78fdf 100755 +--- a/test/units/testsuite-07.mount-invalid-chars.sh ++++ b/test/units/testsuite-07.mount-invalid-chars.sh +@@ -23,12 +23,13 @@ TMP_MOUNTINFO="$(mktemp)" + + cp /proc/1/mountinfo "$TMP_MOUNTINFO" + # Add a mount entry with a "Unicode non-character" in it +-LANG="C.UTF-8" printf '69 1 252:2 / /foo/mountinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO" ++LANG="C.UTF-8" printf '69 1 252:2 / /foo/mount\ufffeinfo rw,relatime shared:1 - cifs //foo\ufffebar rw,seclabel\n' >>"$TMP_MOUNTINFO" + mount --bind "$TMP_MOUNTINFO" /proc/1/mountinfo + systemctl daemon-reload + # On affected versions this would throw an error: + # Failed to get properties: Bad message +-systemctl status foo-mountinfo.mount ++systemctl list-units -t mount ++systemctl status foo-mount\\xef\\xbf\\xbeinfo.mount + + umount /proc/1/mountinfo + systemctl daemon-reload diff --git a/SOURCES/1229-Revert-test-time-util-disable-failing-tests.patch b/SOURCES/1240-Revert-test-time-util-disable-failing-tests.patch similarity index 95% rename from SOURCES/1229-Revert-test-time-util-disable-failing-tests.patch rename to SOURCES/1240-Revert-test-time-util-disable-failing-tests.patch index bd631ab..cfe78cc 100644 --- a/SOURCES/1229-Revert-test-time-util-disable-failing-tests.patch +++ b/SOURCES/1240-Revert-test-time-util-disable-failing-tests.patch @@ -1,4 +1,4 @@ -From bdbf4f6041c4d21d50c87ca05ab82e28e9eea338 Mon Sep 17 00:00:00 2001 +From 4d4f5e617bb467be81274dc32b7066fc5ce52b75 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 3 Sep 2025 13:55:00 +0200 Subject: [PATCH] Revert "test-time-util: disable failing tests" @@ -8,7 +8,7 @@ This won't be needed anymore. This reverts commit c7a62e108ffbe41ccf1bb5fba4b5a37daf317939. rhel-only: ci -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/SOURCES/1230-test-use-get_timezones-to-iterate-all-known-timezone.patch b/SOURCES/1241-test-use-get_timezones-to-iterate-all-known-timezone.patch similarity index 97% rename from SOURCES/1230-test-use-get_timezones-to-iterate-all-known-timezone.patch rename to SOURCES/1241-test-use-get_timezones-to-iterate-all-known-timezone.patch index d07ec05..301ab98 100644 --- a/SOURCES/1230-test-use-get_timezones-to-iterate-all-known-timezone.patch +++ b/SOURCES/1241-test-use-get_timezones-to-iterate-all-known-timezone.patch @@ -1,11 +1,11 @@ -From f54fa1e74a446bb0470ae321ddad090a3889fb4c Mon Sep 17 00:00:00 2001 +From 03dff755efde1a311969636e11fe95c398b7d878 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 3 Mar 2023 19:40:40 +0900 Subject: [PATCH] test: use get_timezones() to iterate all known timezones (cherry picked from commit 0b20d70d1c7c190fb943dd4d1f28e6f456d2193e) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 50 +++++++++------------------------------ 1 file changed, 11 insertions(+), 39 deletions(-) diff --git a/SOURCES/1231-test-time-util-do-not-fail-on-DST-change.patch b/SOURCES/1242-test-time-util-do-not-fail-on-DST-change.patch similarity index 97% rename from SOURCES/1231-test-time-util-do-not-fail-on-DST-change.patch rename to SOURCES/1242-test-time-util-do-not-fail-on-DST-change.patch index 2abe681..9d89d32 100644 --- a/SOURCES/1231-test-time-util-do-not-fail-on-DST-change.patch +++ b/SOURCES/1242-test-time-util-do-not-fail-on-DST-change.patch @@ -1,11 +1,11 @@ -From c3b2149222607cdf6a73cb6d268605f41f33b3dc Mon Sep 17 00:00:00 2001 +From c1e4badeadf75e75b6059a6d644d28414013c102 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 13 Mar 2023 03:47:45 +0900 Subject: [PATCH] test-time-util: do not fail on DST change (cherry picked from commit cfacd245e798282fcb9b3231bd6e857abfe124fc) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/SOURCES/1232-test-time-util-suppress-timestamp-conversion-failure.patch b/SOURCES/1243-test-time-util-suppress-timestamp-conversion-failure.patch similarity index 97% rename from SOURCES/1232-test-time-util-suppress-timestamp-conversion-failure.patch rename to SOURCES/1243-test-time-util-suppress-timestamp-conversion-failure.patch index b61dd65..f862985 100644 --- a/SOURCES/1232-test-time-util-suppress-timestamp-conversion-failure.patch +++ b/SOURCES/1243-test-time-util-suppress-timestamp-conversion-failure.patch @@ -1,4 +1,4 @@ -From ca17098a803ab2aa72a12237a383d649db973ba7 Mon Sep 17 00:00:00 2001 +From 8e8569467616ee982df2cc73ac39240482c92d36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sun, 26 Nov 2023 20:58:43 +0100 Subject: [PATCH] test-time-util: suppress timestamp conversion failures for @@ -30,7 +30,7 @@ Fixes https://github.com/systemd/systemd/issues/28472. (cherry picked from commit 78b95ccad864e1f993fe0776841dd8f39856581b) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/SOURCES/1233-test-time-util-do-more-suppression-of-time-zone-chec.patch b/SOURCES/1244-test-time-util-do-more-suppression-of-time-zone-chec.patch similarity index 97% rename from SOURCES/1233-test-time-util-do-more-suppression-of-time-zone-chec.patch rename to SOURCES/1244-test-time-util-do-more-suppression-of-time-zone-chec.patch index 2f7c25d..062f94f 100644 --- a/SOURCES/1233-test-time-util-do-more-suppression-of-time-zone-chec.patch +++ b/SOURCES/1244-test-time-util-do-more-suppression-of-time-zone-chec.patch @@ -1,4 +1,4 @@ -From 0078cf3a12a57fc0576407752c88881dfe7ed4d6 Mon Sep 17 00:00:00 2001 +From 846cb844c3e8b5621745798f62bfbfb4275735f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 5 Dec 2024 13:32:19 +0100 Subject: [PATCH] test-time-util: do more suppression of time zone checks @@ -31,7 +31,7 @@ Extend the override to suppress this. (cherry picked from commit 3cf362f6f57b7d0b5f6b86a49316303b0dda7599) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SOURCES/1234-test-time-util-fix-truncation-of-usec-to-sec.patch b/SOURCES/1245-test-time-util-fix-truncation-of-usec-to-sec.patch similarity index 96% rename from SOURCES/1234-test-time-util-fix-truncation-of-usec-to-sec.patch rename to SOURCES/1245-test-time-util-fix-truncation-of-usec-to-sec.patch index f0bb677..37b86a2 100644 --- a/SOURCES/1234-test-time-util-fix-truncation-of-usec-to-sec.patch +++ b/SOURCES/1245-test-time-util-fix-truncation-of-usec-to-sec.patch @@ -1,4 +1,4 @@ -From 442b74d5a4aca7f9bde1b8fb10bf295e26524a8d Mon Sep 17 00:00:00 2001 +From cb442eb90085aae9db3bdf0cd7a4730912dba3ef Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 14 Dec 2024 16:49:54 +0900 Subject: [PATCH] test-time-util: fix truncation of usec to sec @@ -9,7 +9,7 @@ Also (cherry picked from commit 3f1d499964abb6a4c0141d7ea8f852829880adff) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-time-util.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/SOURCES/1235-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch b/SOURCES/1246-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch similarity index 96% rename from SOURCES/1235-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch rename to SOURCES/1246-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch index 0a159fa..9ef5930 100644 --- a/SOURCES/1235-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch +++ b/SOURCES/1246-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch @@ -1,4 +1,4 @@ -From 7e8c2a88b4896519c83470e1a25983a5a89f7c2d Mon Sep 17 00:00:00 2001 +From e0ac4a4632c99750ad63476c3ae62a1988b2883b Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 26 Jan 2024 00:22:38 +0000 Subject: [PATCH] test: unset TZ before timezone-sensitive unit tests are run @@ -9,7 +9,7 @@ is the case during reproducible build tests. Unset it. (cherry picked from commit 1e902c3463024bb328bf0d01a5d58a69e1ccf739) -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/test-calendarspec.c | 9 ++++++++- src/test/test-date.c | 3 +++ diff --git a/SOURCES/1236-meson-extend-timeout-for-test-time-util.patch b/SOURCES/1247-meson-extend-timeout-for-test-time-util.patch similarity index 90% rename from SOURCES/1236-meson-extend-timeout-for-test-time-util.patch rename to SOURCES/1247-meson-extend-timeout-for-test-time-util.patch index bfd53f8..af6e0f1 100644 --- a/SOURCES/1236-meson-extend-timeout-for-test-time-util.patch +++ b/SOURCES/1247-meson-extend-timeout-for-test-time-util.patch @@ -1,4 +1,4 @@ -From 6960aaa9c4b19bfd73f7390ececf626ab29700e6 Mon Sep 17 00:00:00 2001 +From bef180f6ddc06bc6e669024b5d1fb9b97a1e3f4d Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 2 Sep 2025 17:33:35 +0200 Subject: [PATCH] meson: extend timeout for test-time-util @@ -9,7 +9,7 @@ running under sanitizers. Based on upstream's b66b3c409900a77b3da7b366ae5a0179abacea99. rhel-only: ci -Related: RHEL-110954 +Related: RHEL-109488 --- src/test/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SOURCES/1237-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch b/SOURCES/1248-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch similarity index 91% rename from SOURCES/1237-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch rename to SOURCES/1248-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch index 208c0af..6af5acc 100644 --- a/SOURCES/1237-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch +++ b/SOURCES/1248-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch @@ -1,11 +1,11 @@ -From a5eaf78908b562cdc63a916a479fce4b7a61ce8f Mon Sep 17 00:00:00 2001 +From c5bdf8c148fc9ab18d3412756ada7317caece6fe Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 01:40:56 +0900 Subject: [PATCH] time-util: use DEFINE_STRING_TABLE_LOOKUP_TO_STRING() macro (cherry picked from commit d227a42aadf04c23c668ac3089bc7b4a9baaf7e1) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SOURCES/1238-time-util-align-string-table.patch b/SOURCES/1249-time-util-align-string-table.patch similarity index 91% rename from SOURCES/1238-time-util-align-string-table.patch rename to SOURCES/1249-time-util-align-string-table.patch index 756faed..d80d901 100644 --- a/SOURCES/1238-time-util-align-string-table.patch +++ b/SOURCES/1249-time-util-align-string-table.patch @@ -1,11 +1,11 @@ -From 5b8414e3b28303c4b81148329f2b3d781701f20b Mon Sep 17 00:00:00 2001 +From 243ecafd63c2c0f8cbdecee770626143bf4def62 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 01:41:38 +0900 Subject: [PATCH] time-util: align string table (cherry picked from commit e01a8fdd2645c06cdb9057bd5b8a45ab02c0d6ee) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/SOURCES/1239-time-util-rename-variables.patch b/SOURCES/1250-time-util-rename-variables.patch similarity index 99% rename from SOURCES/1239-time-util-rename-variables.patch rename to SOURCES/1250-time-util-rename-variables.patch index 76715f9..f3f9fd3 100644 --- a/SOURCES/1239-time-util-rename-variables.patch +++ b/SOURCES/1250-time-util-rename-variables.patch @@ -1,11 +1,11 @@ -From c7d103bae26ae6eec9fc7f0a272ec7ea9eeede5c Mon Sep 17 00:00:00 2001 +From 753dd2e5f28a9b5a552efda75bcbec20ad501e69 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 02:04:31 +0900 Subject: [PATCH] time-util: rename variables (cherry picked from commit cf98b66d1ad0ff0e9ee0444861069ebade038dbb) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 86 +++++++++++++++++++++---------------------- src/basic/time-util.h | 16 ++++---- diff --git a/SOURCES/1240-time-util-add-assertions.patch b/SOURCES/1251-time-util-add-assertions.patch similarity index 97% rename from SOURCES/1240-time-util-add-assertions.patch rename to SOURCES/1251-time-util-add-assertions.patch index 92f9537..7cda869 100644 --- a/SOURCES/1240-time-util-add-assertions.patch +++ b/SOURCES/1251-time-util-add-assertions.patch @@ -1,11 +1,11 @@ -From 8763258128be54c83c480b72d64b7ac17f649087 Mon Sep 17 00:00:00 2001 +From 23f6608ffa05ce80ebfbca9a28369ff858e9d42e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 02:06:13 +0900 Subject: [PATCH] time-util: add assertions (cherry picked from commit dff3bddc5416834d42cc682cb544732a4b91db3b) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/SOURCES/1241-time-util-drop-redundant-else.patch b/SOURCES/1252-time-util-drop-redundant-else.patch similarity index 95% rename from SOURCES/1241-time-util-drop-redundant-else.patch rename to SOURCES/1252-time-util-drop-redundant-else.patch index cf31f95..156b0d7 100644 --- a/SOURCES/1241-time-util-drop-redundant-else.patch +++ b/SOURCES/1252-time-util-drop-redundant-else.patch @@ -1,11 +1,11 @@ -From c8e89ba084dd8c8984d546599a4f77f8d23436cd Mon Sep 17 00:00:00 2001 +From a3c08667c9abaf60793ed35e93123bc5f89981f3 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 03:43:58 +0900 Subject: [PATCH] time-util: drop redundant else (cherry picked from commit 17d1ebfc43c3b971d20ff2806acc634ee153eef6) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/SOURCES/1242-time-util-do-not-use-strdupa.patch b/SOURCES/1253-time-util-do-not-use-strdupa.patch similarity index 95% rename from SOURCES/1242-time-util-do-not-use-strdupa.patch rename to SOURCES/1253-time-util-do-not-use-strdupa.patch index 2dca859..f22276f 100644 --- a/SOURCES/1242-time-util-do-not-use-strdupa.patch +++ b/SOURCES/1253-time-util-do-not-use-strdupa.patch @@ -1,4 +1,4 @@ -From 9a60636d53e7a38445546e34231dbd2885d6beaf Mon Sep 17 00:00:00 2001 +From 50a7d58a24a381e265436c14303e7bb368a4b147 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 03:41:26 +0900 Subject: [PATCH] time-util: do not use strdupa() @@ -7,7 +7,7 @@ The input string may come from command line, config files. (cherry picked from commit 804537bdc420bb82e54b455b7a10d542c8f029dd) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/SOURCES/1243-time-util-use-result-from-startswith_no_case.patch b/SOURCES/1254-time-util-use-result-from-startswith_no_case.patch similarity index 94% rename from SOURCES/1243-time-util-use-result-from-startswith_no_case.patch rename to SOURCES/1254-time-util-use-result-from-startswith_no_case.patch index eacceb3..c10e267 100644 --- a/SOURCES/1243-time-util-use-result-from-startswith_no_case.patch +++ b/SOURCES/1254-time-util-use-result-from-startswith_no_case.patch @@ -1,4 +1,4 @@ -From a5bec1b4303dcc62be2cf58c1fb86e043011ee55 Mon Sep 17 00:00:00 2001 +From eabf4db441c885a78d5726838004bbb9436dbf91 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 04:14:24 +0900 Subject: [PATCH] time-util: use result from startswith_no_case() @@ -7,7 +7,7 @@ No functional change, just refactoring. (cherry picked from commit f2ecfd8bc1e6d09173e9f98c5ac1b19b755a3c25) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/SOURCES/1244-time-util-use-usec_add-and-usec_sub_unsigned.patch b/SOURCES/1255-time-util-use-usec_add-and-usec_sub_unsigned.patch similarity index 94% rename from SOURCES/1244-time-util-use-usec_add-and-usec_sub_unsigned.patch rename to SOURCES/1255-time-util-use-usec_add-and-usec_sub_unsigned.patch index 01274fa..d3f74ff 100644 --- a/SOURCES/1244-time-util-use-usec_add-and-usec_sub_unsigned.patch +++ b/SOURCES/1255-time-util-use-usec_add-and-usec_sub_unsigned.patch @@ -1,4 +1,4 @@ -From 66f38176c44a379f6ffdef619f7d83095469a77a Mon Sep 17 00:00:00 2001 +From 9f7d490b1c16f0444987dab7ce70287b59d98cf9 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 04:27:27 +0900 Subject: [PATCH] time-util: use usec_add() and usec_sub_unsigned() @@ -8,7 +8,7 @@ as usec_add() can handle overflow correctly. (cherry picked from commit db43717e982e1361eee4bdcd92167d6c47eb627c) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/SOURCES/1245-time-util-shorten-code-a-bit.patch b/SOURCES/1256-time-util-shorten-code-a-bit.patch similarity index 96% rename from SOURCES/1245-time-util-shorten-code-a-bit.patch rename to SOURCES/1256-time-util-shorten-code-a-bit.patch index 7efa35d..0296c4f 100644 --- a/SOURCES/1245-time-util-shorten-code-a-bit.patch +++ b/SOURCES/1256-time-util-shorten-code-a-bit.patch @@ -1,4 +1,4 @@ -From 634908732d300cc014368c95023e64dc8260759d Mon Sep 17 00:00:00 2001 +From 2dafd8e6be624f93c757ca9c739d502ed73d79c0 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 04:27:52 +0900 Subject: [PATCH] time-util: shorten code a bit @@ -7,7 +7,7 @@ No functional change, just refactoring. (cherry picked from commit 1d2c42c5dc765c57b4fba6b7c629093aa20685a8) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/SOURCES/1246-time-util-rename-variables.patch b/SOURCES/1257-time-util-rename-variables.patch similarity index 96% rename from SOURCES/1246-time-util-rename-variables.patch rename to SOURCES/1257-time-util-rename-variables.patch index 3b498cb..3855e9a 100644 --- a/SOURCES/1246-time-util-rename-variables.patch +++ b/SOURCES/1257-time-util-rename-variables.patch @@ -1,4 +1,4 @@ -From 8fb4c5d8a9df069effe63c66be9a7bfb8fe7e3e6 Mon Sep 17 00:00:00 2001 +From 5bfcf206bd16079ae8030a2c912ee8377a3f6d5f Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 15 Feb 2023 13:46:50 +0900 Subject: [PATCH] time-util: rename variables @@ -7,7 +7,7 @@ No functional changes, just refactoring. (cherry picked from commit a83c1baaeb510f1916d2d8cf0324d100708c7073) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/SOURCES/1247-time-util-drop-unnecessary-assignment-of-timezone-na.patch b/SOURCES/1258-time-util-drop-unnecessary-assignment-of-timezone-na.patch similarity index 94% rename from SOURCES/1247-time-util-drop-unnecessary-assignment-of-timezone-na.patch rename to SOURCES/1258-time-util-drop-unnecessary-assignment-of-timezone-na.patch index aaa41a3..7ec3a71 100644 --- a/SOURCES/1247-time-util-drop-unnecessary-assignment-of-timezone-na.patch +++ b/SOURCES/1258-time-util-drop-unnecessary-assignment-of-timezone-na.patch @@ -1,4 +1,4 @@ -From 270d5ab1358d916483f2da0a7b060c433ed35ecc Mon Sep 17 00:00:00 2001 +From a1a7ab09cf96e30cfd0c89efaf8d03a5dc81e928 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 15 Feb 2023 13:51:15 +0900 Subject: [PATCH] time-util: drop unnecessary assignment of timezone name @@ -7,7 +7,7 @@ As mktime() does not use timezone neme. (cherry picked from commit 97c5f7ba1f50fcd7b982b995b46692c8cad4afaa) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/SOURCES/1248-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch b/SOURCES/1259-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch similarity index 99% rename from SOURCES/1248-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch rename to SOURCES/1259-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch index af1d31a..7f5755d 100644 --- a/SOURCES/1248-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch +++ b/SOURCES/1259-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch @@ -1,4 +1,4 @@ -From cba84e37fc5b4968b3058e6af6a1ff64f1cc95b3 Mon Sep 17 00:00:00 2001 +From e4b1932cd1c0ad2d42a6271cb651e6979b5962ed Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Feb 2023 03:39:15 +0900 Subject: [PATCH] time-util: make parse_timestamp() use the RFC-822/ISO 8601 @@ -22,7 +22,7 @@ Fixes #26370. (cherry picked from commit 7a9afae6040af0417d893328cb44b622dcdcb94f) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 174 +++++++++++++++++++++++++++--------------- 1 file changed, 112 insertions(+), 62 deletions(-) diff --git a/SOURCES/1249-time-util-fix-typo.patch b/SOURCES/1260-time-util-fix-typo.patch similarity index 92% rename from SOURCES/1249-time-util-fix-typo.patch rename to SOURCES/1260-time-util-fix-typo.patch index 2b0c5ce..725290c 100644 --- a/SOURCES/1249-time-util-fix-typo.patch +++ b/SOURCES/1260-time-util-fix-typo.patch @@ -1,4 +1,4 @@ -From 17fc013d01a1c04de0841bd0b61644d70ba9e07a Mon Sep 17 00:00:00 2001 +From 008aed2736dac288700f1c177690904da9c5137d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 3 Mar 2023 15:24:23 +0900 Subject: [PATCH] time-util: fix typo @@ -7,7 +7,7 @@ Follow-up for 7a9afae6040af0417d893328cb44b622dcdcb94f. (cherry picked from commit ca9c9d8d8e999fd80fc43d002c8d5b20c4c1a0a4) -Related: RHEL-110954 +Related: RHEL-109488 --- src/basic/time-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SOURCES/1250-ci-bump-the-tools-tree-to-F42.patch b/SOURCES/1261-ci-bump-the-tools-tree-to-F42.patch similarity index 93% rename from SOURCES/1250-ci-bump-the-tools-tree-to-F42.patch rename to SOURCES/1261-ci-bump-the-tools-tree-to-F42.patch index 7ecad10..caab4ae 100644 --- a/SOURCES/1250-ci-bump-the-tools-tree-to-F42.patch +++ b/SOURCES/1261-ci-bump-the-tools-tree-to-F42.patch @@ -1,4 +1,4 @@ -From e6a8da48184d8054ab49f65decaaf339a2a608db Mon Sep 17 00:00:00 2001 +From 5e10617a3a450a2bb6fbe031d1861559192bc85c Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Thu, 4 Sep 2025 15:31:27 +0200 Subject: [PATCH] ci: bump the tools tree to F42 @@ -16,7 +16,7 @@ EFI stub: Loaded initrd from LINUX_EFI_INITRD_MEDIA_GUID device path EFI stub: Measured initrd data into PCR 9 rhel-only: ci -Related: RHEL-110954 +Related: RHEL-109488 --- .github/workflows/mkosi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SOURCES/1262-journald-extend-STDOUT_STREAMS_MAX-to-64k.patch b/SOURCES/1262-journald-extend-STDOUT_STREAMS_MAX-to-64k.patch new file mode 100644 index 0000000..a2fbf96 --- /dev/null +++ b/SOURCES/1262-journald-extend-STDOUT_STREAMS_MAX-to-64k.patch @@ -0,0 +1,27 @@ +From 8cec69eb3fe332ac618c34780dd5275d931d9bf8 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Sun, 1 Dec 2024 14:46:40 +0900 +Subject: [PATCH] journald: extend STDOUT_STREAMS_MAX to 64k + +Closes #35390. + +(cherry picked from commit c576ba7182f54f352c03f0768c9178b173fb8bcb) + +Resolves: RHEL-111065 +--- + src/journal/journald-stream.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c +index 8bdcd8c2ae..3ec6e7fcf3 100644 +--- a/src/journal/journald-stream.c ++++ b/src/journal/journald-stream.c +@@ -38,7 +38,7 @@ + #include "unit-name.h" + #include "user-util.h" + +-#define STDOUT_STREAMS_MAX 4096 ++#define STDOUT_STREAMS_MAX (64*1024) + + /* During the "setup" protocol phase of the stream logic let's define a different maximum line length than + * during the actual operational phase. We want to allow users to specify very short line lengths after all, diff --git a/SOURCES/1263-Revert-Revert-udev-builtin-net_id-use-firmware_node-.patch b/SOURCES/1263-Revert-Revert-udev-builtin-net_id-use-firmware_node-.patch new file mode 100644 index 0000000..010da3b --- /dev/null +++ b/SOURCES/1263-Revert-Revert-udev-builtin-net_id-use-firmware_node-.patch @@ -0,0 +1,163 @@ +From fa27bab14e2ede08dcac41ab78901ab3b653e556 Mon Sep 17 00:00:00 2001 +From: Jan Macku +Date: Tue, 26 Aug 2025 15:30:49 +0200 +Subject: [PATCH] Revert "Revert "udev-builtin-net_id: use firmware_node/sun + for ID_NET_NAME_SLOT"" + +This reverts commit ae92c09f0ddfea2ff6042e152eec9af86013da38. + +Also introduce rhel-9.8 naming scheme. + +rhel-only: policy + +Resolves: RHEL-50103 +--- + man/systemd.net-naming-scheme.xml | 9 ++++- + src/shared/netif-naming-scheme.c | 1 + + src/shared/netif-naming-scheme.h | 2 + + src/udev/udev-builtin-net_id.c | 66 +++++++++++++++++++++++++++---- + 4 files changed, 70 insertions(+), 8 deletions(-) + +diff --git a/man/systemd.net-naming-scheme.xml b/man/systemd.net-naming-scheme.xml +index 34e8e46459..c6ee7b4b6e 100644 +--- a/man/systemd.net-naming-scheme.xml ++++ b/man/systemd.net-naming-scheme.xml +@@ -526,6 +526,13 @@ + Same as naming scheme rhel-9.5. + + ++ ++ rhel-9.8 ++ ++ ++ PCI slot number is now read from firmware_node/sun sysfs file. ++ ++ + + + By default rhel-9.0 is used. +@@ -679,7 +686,7 @@ ID_NET_NAME_ONBOARD_LABEL=Ethernet Port 1 + + + +- PCI Ethernet card in hotplug slot with firmware index number ++ PCI Ethernet card in slot with firmware index number + + # /sys/devices/pci0000:00/0000:00:1c.3/0000:05:00.0/net/ens1 + ID_NET_NAME_MAC=enx000000000466 +diff --git a/src/shared/netif-naming-scheme.c b/src/shared/netif-naming-scheme.c +index a38c3f1e2f..4ed866491e 100644 +--- a/src/shared/netif-naming-scheme.c ++++ b/src/shared/netif-naming-scheme.c +@@ -47,6 +47,7 @@ static const NamingScheme naming_schemes[] = { + { "rhel-9.5", NAMING_RHEL_9_5 }, + { "rhel-9.6", NAMING_RHEL_9_6 }, + { "rhel-9.7", NAMING_RHEL_9_7 }, ++ { "rhel-9.8", NAMING_RHEL_9_8 }, + /* … add more schemes here, as the logic to name devices is updated … */ + + EXTRA_NET_NAMING_MAP +diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h +index 3cba656707..c16476522a 100644 +--- a/src/shared/netif-naming-scheme.h ++++ b/src/shared/netif-naming-scheme.h +@@ -42,6 +42,7 @@ typedef enum NamingSchemeFlags { + * This is disabled since rhel-9.5, as it seems not to work at least for some setups. See upstream issue #28929. */ + NAMING_DEVICETREE_ALIASES = 1 << 15, /* Generate names from devicetree aliases */ + NAMING_SR_IOV_R = 1 << 17, /* Use "r" suffix for SR-IOV VF representors */ ++ NAMING_FIRMWARE_NODE_SUN = 1 << 18, /* Use firmware_node/sun to get PCI slot number */ + + /* And now the masks that combine the features above */ + NAMING_V238 = 0, +@@ -76,6 +77,7 @@ typedef enum NamingSchemeFlags { + NAMING_RHEL_9_5 = NAMING_RHEL_9_4 & ~NAMING_BRIDGE_MULTIFUNCTION_SLOT, + NAMING_RHEL_9_6 = NAMING_RHEL_9_5, + NAMING_RHEL_9_7 = NAMING_RHEL_9_5, ++ NAMING_RHEL_9_8 = NAMING_RHEL_9_5 | NAMING_FIRMWARE_NODE_SUN, + + EXTRA_NET_NAMING_SCHEMES + +diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c +index 16c9971876..291fb4ba36 100644 +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -442,6 +442,51 @@ static int pci_get_hotplug_slot(sd_device *dev, uint32_t *ret) { + return -ENOENT; + } + ++static int get_device_firmware_node_sun(sd_device *dev, uint32_t *ret) { ++ const char *attr; ++ int r; ++ ++ assert(dev); ++ assert(ret); ++ ++ r = device_get_sysattr_value_filtered(dev, "firmware_node/sun", &attr); ++ if (r < 0) ++ return log_device_debug_errno(dev, r, "Failed to read firmware_node/sun, ignoring: %m"); ++ ++ r = safe_atou32(attr, ret); ++ if (r < 0) ++ return log_device_warning_errno(dev, r, "Failed to parse firmware_node/sun '%s', ignoring: %m", attr); ++ ++ return 0; ++} ++ ++static int pci_get_slot_from_firmware_node_sun(sd_device *dev, uint32_t *ret) { ++ int r; ++ sd_device *slot_dev; ++ ++ assert(dev); ++ assert(ret); ++ ++ /* Try getting the ACPI _SUN for the device */ ++ if (get_device_firmware_node_sun(dev, ret) >= 0) ++ return 0; ++ ++ r = sd_device_get_parent_with_subsystem_devtype(dev, "pci", NULL, &slot_dev); ++ if (r < 0) ++ return log_device_debug_errno(dev, r, "Failed to find pci parent, ignoring: %m"); ++ ++ if (is_pci_bridge(slot_dev) && is_pci_multifunction(dev) <= 0) ++ return log_device_debug_errno(dev, SYNTHETIC_ERRNO(ESTALE), ++ "Not using slot information because the parent pcieport " ++ "is a bridge and the PCI device is not multifunction."); ++ ++ /* Try getting the ACPI _SUN from the parent pcieport */ ++ if (get_device_firmware_node_sun(slot_dev, ret) >= 0) ++ return 0; ++ ++ return -ENOENT; ++} ++ + static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) { + const char *sysname, *attr; + unsigned domain, bus, slot, func; +@@ -517,13 +562,20 @@ static int dev_pci_slot(sd_device *dev, const LinkInfo *info, NetNames *names) { + domain, bus, slot, func, strempty(info->phys_port_name), dev_port, + special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), empty_to_na(names->pci_path)); + +- r = pci_get_hotplug_slot(names->pcidev, &hotplug_slot); +- if (r < 0) +- return r; +- if (r > 0) +- /* If the hotplug slot is found through the function ID, then drop the domain from the name. +- * See comments in parse_hotplug_slot_from_function_id(). */ +- domain = 0; ++ if (naming_scheme_has(NAMING_FIRMWARE_NODE_SUN)) ++ r = pci_get_slot_from_firmware_node_sun(names->pcidev, &hotplug_slot); ++ else ++ r = -1; ++ /* If we don't find a slot using firmware_node/sun, fallback to hotplug_slot */ ++ if (r < 0) { ++ r = pci_get_hotplug_slot(names->pcidev, &hotplug_slot); ++ if (r < 0) ++ return r; ++ if (r > 0) ++ /* If the hotplug slot is found through the function ID, then drop the domain from the name. ++ * See comments in parse_hotplug_slot_from_function_id(). */ ++ domain = 0; ++ } + + s = names->pci_slot; + l = sizeof(names->pci_slot); diff --git a/SOURCES/1264-udev-builtin-net_id-ignore-firmware_node-sun-0.patch b/SOURCES/1264-udev-builtin-net_id-ignore-firmware_node-sun-0.patch new file mode 100644 index 0000000..33dcf9b --- /dev/null +++ b/SOURCES/1264-udev-builtin-net_id-ignore-firmware_node-sun-0.patch @@ -0,0 +1,43 @@ +From 743c0fbd5ea56f926b36d6bbfc2d609bacd4353e Mon Sep 17 00:00:00 2001 +From: Etienne Champetier +Date: Thu, 22 Aug 2024 16:30:56 -0400 +Subject: [PATCH] udev-builtin-net_id: ignore firmware_node/sun == 0 + +Since ID_NET_NAME_SLOT was introduced we ignore slot == 0 +https://github.com/systemd/systemd/blob/0035597a30d120f70df2dd7da3d6128fb8ba6051/src/udev/udev-builtin-net_id.c#L139 + +Qemu sets _SUN to PCI_SLOT() for all NICs, so _SUN is not unique. +https://gitlab.com/qemu-project/qemu/-/issues/2530 + +In my tests with libvirt I can only set 'slot="0x00"' in interface definition, +so all NICs end up with _SUN == 0, and this commit is enough to avoid the issue. + +Fixes 0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb + +(cherry picked from commit 448f9f81fd32f8658449101ada2eadd853f6b06b) + +Resolves: RHEL-50103 +--- + src/udev/udev-builtin-net_id.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c +index 291fb4ba36..e1895a38c0 100644 +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -453,10 +453,14 @@ static int get_device_firmware_node_sun(sd_device *dev, uint32_t *ret) { + if (r < 0) + return log_device_debug_errno(dev, r, "Failed to read firmware_node/sun, ignoring: %m"); + +- r = safe_atou32(attr, ret); ++ uint32_t sun; ++ r = safe_atou32(attr, &sun); + if (r < 0) + return log_device_warning_errno(dev, r, "Failed to parse firmware_node/sun '%s', ignoring: %m", attr); ++ if (sun == 0) ++ return log_device_debug_errno(dev, SYNTHETIC_ERRNO(EINVAL), "firmware_node/sun == 0, ignoring: %m"); + ++ *ret = sun; + return 0; + } + diff --git a/SOURCES/1265-fundamental-fix-compile-check-for-explicit_bzero.patch b/SOURCES/1265-fundamental-fix-compile-check-for-explicit_bzero.patch new file mode 100644 index 0000000..d54bb61 --- /dev/null +++ b/SOURCES/1265-fundamental-fix-compile-check-for-explicit_bzero.patch @@ -0,0 +1,36 @@ +From c14ed0d0bf700b9959359004d5eef50d4d2db951 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 10 Jan 2023 14:08:41 +0100 +Subject: [PATCH] fundamental: fix compile check for explicit_bzero + +Our HAVE_* variables are defined to 0 or 1, so '#if defined(HAVE_*)' is always true. +The variable is not defined when compiling for EFI though, so we need the +additional guard. + +Fixup for 3f92dc2fd4070b213e6bc85263a9bef06ec9a486. + +(I don't want to do something like add -DHAVE_EXPLICIT_BZERO=0 to the commandline +in src/efi/boot/meson.build, because this quite verbose. Our compilation commandlines +are very long already. Let's instead keep this localized in this one spot in the +source file.)x + +(cherry picked from commit 5deb391c6e6d2b8fd7b94234efea49cd6bee0d76) + +Resolves: RHEL-108568 +--- + src/fundamental/memory-util-fundamental.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/fundamental/memory-util-fundamental.h b/src/fundamental/memory-util-fundamental.h +index 8f50d8b8e1..e0ae33dc0d 100644 +--- a/src/fundamental/memory-util-fundamental.h ++++ b/src/fundamental/memory-util-fundamental.h +@@ -11,7 +11,7 @@ + + #include "macro-fundamental.h" + +-#if defined(HAVE_EXPLICIT_BZERO) ++#if !defined(SD_BOOT) && HAVE_EXPLICIT_BZERO + static inline void *explicit_bzero_safe(void *p, size_t l) { + if (p && l > 0) + explicit_bzero(p, l); diff --git a/SOURCES/1255-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch b/SOURCES/1266-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch similarity index 97% rename from SOURCES/1255-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch rename to SOURCES/1266-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch index 907986b..c24a519 100644 --- a/SOURCES/1255-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch +++ b/SOURCES/1266-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch @@ -1,4 +1,4 @@ -From a8ef307f05961e142b99cbbdda8855a24a44d4a1 Mon Sep 17 00:00:00 2001 +From 9906687d228f71768ddf115799ebb39272d1f655 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 12 Mar 2023 20:57:16 +0900 Subject: [PATCH] time-util: make USEC_TIMESTAMP_FORMATTABLE_MAX for 32bit @@ -10,7 +10,7 @@ This also makes both upper bounds always defined for testing. (cherry picked from commit bd5770da76ee157d3b31323ed2d22f5d9082bb36) -Related: RHEL-118294 +Related: RHEL-109488 --- src/basic/time-util.h | 14 +++++++++----- src/test/test-date.c | 4 ++-- diff --git a/SOURCES/1262-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch b/SOURCES/1267-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch similarity index 97% rename from SOURCES/1262-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch rename to SOURCES/1267-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch index 6afb209..15e064f 100644 --- a/SOURCES/1262-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch +++ b/SOURCES/1267-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch @@ -1,4 +1,4 @@ -From 1e97dc426766eef1590d9054952aa0d7d5882b79 Mon Sep 17 00:00:00 2001 +From 0abac4254115db7d86549b517163a13de9377346 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 23 Sep 2025 14:28:33 +0200 Subject: [PATCH] test: rename TEST-53-ISSUE-16347 to TEST-53-TIMER @@ -7,7 +7,7 @@ And split the existing test into a separate subtest. (cherry picked from commit 953c347fb6f293acbd6da009646bfc071b68ddd7) -Related: RHEL-127022 +Related: RHEL-118215 --- .../Makefile | 0 .../test.sh | 0 diff --git a/SOURCES/1263-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch b/SOURCES/1268-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch similarity index 97% rename from SOURCES/1263-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch rename to SOURCES/1268-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch index 43879f4..a6915f4 100644 --- a/SOURCES/1263-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch +++ b/SOURCES/1268-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch @@ -1,4 +1,4 @@ -From 9fbd356a6453822d0472d8f1488adfc902a8d241 Mon Sep 17 00:00:00 2001 +From 53b158318d6bfbb1e59b91bfad15e7d128622efb Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 23 Sep 2025 17:42:01 +0200 Subject: [PATCH] test: restarting elapsed timer shouldn't trigger the @@ -10,7 +10,7 @@ Provides coverage for: (cherry picked from commit 5730a400fd5ee82566fe03eb832121a0d4bc26b6) -Related: RHEL-127022 +Related: RHEL-118215 --- test/units/testsuite-53.restart-trigger.sh | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/SOURCES/1264-test-check-the-next-elapse-timer-timestamp-after-des.patch b/SOURCES/1269-test-check-the-next-elapse-timer-timestamp-after-des.patch similarity index 98% rename from SOURCES/1264-test-check-the-next-elapse-timer-timestamp-after-des.patch rename to SOURCES/1269-test-check-the-next-elapse-timer-timestamp-after-des.patch index a7fbdf0..296c79c 100644 --- a/SOURCES/1264-test-check-the-next-elapse-timer-timestamp-after-des.patch +++ b/SOURCES/1269-test-check-the-next-elapse-timer-timestamp-after-des.patch @@ -1,4 +1,4 @@ -From c282dc4e58279b4db6f735228e210a6e46ec5638 Mon Sep 17 00:00:00 2001 +From 14aa00df0638e8011dd7360eb58d3b0ac64a818a Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Tue, 23 Sep 2025 21:04:12 +0200 Subject: [PATCH] test: check the next elapse timer timestamp after @@ -15,7 +15,7 @@ Provides coverage for: (cherry picked from commit f4c3c107d9be4e922a080fc292ed3889c4e0f4a5) -Related: RHEL-127022 +Related: RHEL-118215 --- .../testsuite-53.RandomizedDelaySec-reload.sh | 97 +++++++++++++++++++ test/units/util.sh | 18 ++++ diff --git a/SOURCES/1265-timer-don-t-run-service-immediately-after-restart-of.patch b/SOURCES/1270-timer-don-t-run-service-immediately-after-restart-of.patch similarity index 91% rename from SOURCES/1265-timer-don-t-run-service-immediately-after-restart-of.patch rename to SOURCES/1270-timer-don-t-run-service-immediately-after-restart-of.patch index aef5939..1903a87 100644 --- a/SOURCES/1265-timer-don-t-run-service-immediately-after-restart-of.patch +++ b/SOURCES/1270-timer-don-t-run-service-immediately-after-restart-of.patch @@ -1,4 +1,4 @@ -From 7dc588429e48ba6017fd75f6a266288768230025 Mon Sep 17 00:00:00 2001 +From a5e7446ae2442558f9c13d814e778f13a7018e23 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Tue, 9 Sep 2025 15:24:22 +0200 Subject: [PATCH] timer: don't run service immediately after restart of a timer @@ -9,7 +9,7 @@ This prevents the timer from triggering immediately. Fixes: #31231 (cherry picked from commit 3fc44a0f68412b649e16f12ff2f97a36c615457d) -Resolves: RHEL-127022 +Resolves: RHEL-118215 --- src/core/timer.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/SOURCES/1266-test-store-and-compare-just-the-property-value.patch b/SOURCES/1271-test-store-and-compare-just-the-property-value.patch similarity index 96% rename from SOURCES/1266-test-store-and-compare-just-the-property-value.patch rename to SOURCES/1271-test-store-and-compare-just-the-property-value.patch index 96fb11d..ad58cff 100644 --- a/SOURCES/1266-test-store-and-compare-just-the-property-value.patch +++ b/SOURCES/1271-test-store-and-compare-just-the-property-value.patch @@ -1,4 +1,4 @@ -From 5f0eda80175f04929c34cdb46cd85e3f4d64b6d1 Mon Sep 17 00:00:00 2001 +From c603c6cb569f0900ddf07f0311ffa038a242fac8 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 29 Sep 2025 16:11:27 +0200 Subject: [PATCH] test: store and compare just the property value @@ -7,7 +7,7 @@ Follow-up for 5730a400fd5ee82566fe03eb832121a0d4bc26b6. (cherry picked from commit 0cb252d50f35256bff569fa6213784f2d45ad6a1) -Related: RHEL-127022 +Related: RHEL-118215 --- test/units/testsuite-53.restart-trigger.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/SOURCES/1272-test-make-test-fd-util-more-lenient-when-using-fd_mo.patch b/SOURCES/1272-test-make-test-fd-util-more-lenient-when-using-fd_mo.patch new file mode 100644 index 0000000..dbc3ffd --- /dev/null +++ b/SOURCES/1272-test-make-test-fd-util-more-lenient-when-using-fd_mo.patch @@ -0,0 +1,94 @@ +From d4299294d40b7fe713d0c9df0f7a42c70654e886 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Fri, 5 Apr 2024 12:18:58 +0200 +Subject: [PATCH] test: make test-fd-util more lenient when using + fd_move_above_stdio() + +On s390x this test fails when the SUT uses the z90crypt kernel module, +as it's an another FD the test doesn't account for: + +/* test_rearrange_stdio */ +Successfully forked off 'rearrange' as PID 57293. +test_rearrange_stdio: r=0 +/proc/57293/fd: +total 0 +lrwx------. 1 root root 64 Apr 5 06:18 0 -> /dev/pts/0 +lrwx------. 1 root root 64 Apr 5 06:18 1 -> /dev/pts/0 +lrwx------. 1 root root 64 Apr 5 06:18 2 -> /dev/pts/0 +lrwx------. 1 root root 64 Apr 5 06:18 3 -> /dev/z90crypt +rearrange terminated by signal ABRT. + +Debugging this was pain, since the child process didn't log anything +once we closed stdout/stderr (for obvious reasons). Let's fix both +issues by switching logging to kmsg once we close stdin/stdout/stderr, +and also by making the test work fine when there are some extra FDs in +the child's environment. + +(cherry picked from commit a9805f8ca9c1561e373355fe7175579b31e1c08c) + +Related: RHEL-114974 +--- + src/test/test-fd-util.c | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + +diff --git a/src/test/test-fd-util.c b/src/test/test-fd-util.c +index 5b5a712469..5d6c5325a5 100644 +--- a/src/test/test-fd-util.c ++++ b/src/test/test-fd-util.c +@@ -127,6 +127,7 @@ TEST(rearrange_stdio) { + + if (r == 0) { + _cleanup_free_ char *path = NULL; ++ int pipe_read_fd, pair[2]; + char buffer[10]; + + /* Child */ +@@ -134,6 +135,10 @@ TEST(rearrange_stdio) { + safe_close(STDERR_FILENO); /* Let's close an fd < 2, to make it more interesting */ + + assert_se(rearrange_stdio(-1, -1, -1) >= 0); ++ /* Reconfigure logging after rearranging stdout/stderr, so we still log to somewhere if the ++ * following tests fail, making it slightly less annoying to debug */ ++ log_set_target(LOG_TARGET_KMSG); ++ log_open(); + + assert_se(fd_get_path(STDIN_FILENO, &path) >= 0); + assert_se(path_equal(path, "/dev/null")); +@@ -151,13 +156,12 @@ TEST(rearrange_stdio) { + safe_close(STDOUT_FILENO); + safe_close(STDERR_FILENO); + +- { +- int pair[2]; +- assert_se(pipe(pair) >= 0); +- assert_se(pair[0] == 0); +- assert_se(pair[1] == 1); +- assert_se(fd_move_above_stdio(0) == 3); +- } ++ assert_se(pipe(pair) >= 0); ++ assert_se(pair[0] == 0); ++ assert_se(pair[1] == 1); ++ pipe_read_fd = fd_move_above_stdio(0); ++ assert_se(pipe_read_fd >= 3); ++ + assert_se(open("/dev/full", O_WRONLY|O_CLOEXEC) == 0); + assert_se(acquire_data_fd("foobar", 6, 0) == 2); + +@@ -165,7 +169,7 @@ TEST(rearrange_stdio) { + + assert_se(write(1, "x", 1) < 0 && errno == ENOSPC); + assert_se(write(2, "z", 1) == 1); +- assert_se(read(3, buffer, sizeof(buffer)) == 1); ++ assert_se(read(pipe_read_fd, buffer, sizeof(buffer)) == 1); + assert_se(buffer[0] == 'z'); + assert_se(read(0, buffer, sizeof(buffer)) == 6); + assert_se(memcmp(buffer, "foobar", 6) == 0); +@@ -173,7 +177,7 @@ TEST(rearrange_stdio) { + assert_se(rearrange_stdio(-1, 1, 2) >= 0); + assert_se(write(1, "a", 1) < 0 && errno == ENOSPC); + assert_se(write(2, "y", 1) == 1); +- assert_se(read(3, buffer, sizeof(buffer)) == 1); ++ assert_se(read(pipe_read_fd, buffer, sizeof(buffer)) == 1); + assert_se(buffer[0] == 'y'); + + assert_se(fd_get_path(0, &path) >= 0); diff --git a/SOURCES/1254-basic-add-PIDFS-magic-31709.patch b/SOURCES/1273-basic-add-PIDFS-magic-31709.patch similarity index 95% rename from SOURCES/1254-basic-add-PIDFS-magic-31709.patch rename to SOURCES/1273-basic-add-PIDFS-magic-31709.patch index e531f77..a426fdc 100644 --- a/SOURCES/1254-basic-add-PIDFS-magic-31709.patch +++ b/SOURCES/1273-basic-add-PIDFS-magic-31709.patch @@ -1,4 +1,4 @@ -From 4d9bb355df2ba60d734a73a62bf489abbb8ec54c Mon Sep 17 00:00:00 2001 +From 2c74cdb28bad7e8122bfd51a6d4897f792ef3e2f Mon Sep 17 00:00:00 2001 From: cpackham-atlnz <85916201+cpackham-atlnz@users.noreply.github.com> Date: Tue, 12 Mar 2024 00:55:36 +1300 Subject: [PATCH] basic: add PIDFS magic (#31709) @@ -15,7 +15,7 @@ Filesystem found in kernel header but not in filesystems-gperf.gperf: PID_FS_MAG (cherry picked from commit ed01b92e1c92871bbd92711f280e2b2d15753f0e) -Resolves: RHEL-118294 +Resolves: RHEL-114974 --- src/basic/filesystems-gperf.gperf | 1 + src/basic/missing_magic.h | 5 +++++ diff --git a/SOURCES/1274-man-fix-a-missing-word.patch b/SOURCES/1274-man-fix-a-missing-word.patch new file mode 100644 index 0000000..1c9ec88 --- /dev/null +++ b/SOURCES/1274-man-fix-a-missing-word.patch @@ -0,0 +1,27 @@ +From 5844efbf70321f5dd902f987947786d1ab4409c6 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Wed, 8 Oct 2025 17:23:31 +0200 +Subject: [PATCH] man: fix a missing word + +Follow-up for 6d48c7cf736ced70c1c2fef1e1f03618911d04bc. + +(cherry picked from commit 67111e1bd918f9e1b4b542d1e0fe84f1d571876e) + +Resolves: RHEL-115182 +--- + man/systemd.resource-control.xml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml +index 2a0e40a17d..9431fb20a1 100644 +--- a/man/systemd.resource-control.xml ++++ b/man/systemd.resource-control.xml +@@ -365,7 +365,7 @@ + an absolute number of tasks or a percentage value that is taken relative to the configured maximum + number of tasks on the system. If assigned the special value infinity, no tasks + limit is applied. This controls the pids.max control group attribute. For +- details about this control group attribute, the ++ details about this control group attribute, see the + pids controller + . + diff --git a/SOURCES/1251-cryptsetup-Add-optional-support-for-linking-volume-k.patch b/SOURCES/1275-cryptsetup-Add-optional-support-for-linking-volume-k.patch similarity index 98% rename from SOURCES/1251-cryptsetup-Add-optional-support-for-linking-volume-k.patch rename to SOURCES/1275-cryptsetup-Add-optional-support-for-linking-volume-k.patch index e10fe61..2823ca1 100644 --- a/SOURCES/1251-cryptsetup-Add-optional-support-for-linking-volume-k.patch +++ b/SOURCES/1275-cryptsetup-Add-optional-support-for-linking-volume-k.patch @@ -1,4 +1,4 @@ -From a8c056f2847f080e8ceb5d43fe0d36b5c5ee8655 Mon Sep 17 00:00:00 2001 +From 26d6ea70cfb9232dc9ab66ee0927fb546fe0418b Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Wed, 31 Jan 2024 13:11:21 +0100 Subject: [PATCH] cryptsetup: Add optional support for linking volume key in @@ -15,7 +15,7 @@ in case of kernel crash. (cherry picked from commit c5daf14c88ba44cefabe052de93a29d28b6b0175) -Resolves: RHEL-118294 +Resolves: RHEL-97175 --- man/crypttab.xml | 21 ++++++++++++ meson.build | 3 +- diff --git a/SOURCES/1252-cryptsetup-fix-typo.patch b/SOURCES/1276-cryptsetup-fix-typo.patch similarity index 93% rename from SOURCES/1252-cryptsetup-fix-typo.patch rename to SOURCES/1276-cryptsetup-fix-typo.patch index 11bb7e1..a01aff9 100644 --- a/SOURCES/1252-cryptsetup-fix-typo.patch +++ b/SOURCES/1276-cryptsetup-fix-typo.patch @@ -1,4 +1,4 @@ -From 9807259b544cbf4f7a0a05bd426b95c788a89bd4 Mon Sep 17 00:00:00 2001 +From 44f65e9b9a0f67a69886d25367875e9707affc81 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 14 Feb 2024 04:01:36 +0900 Subject: [PATCH] cryptsetup: fix typo @@ -7,7 +7,7 @@ Follow-up for c5daf14c88ba44cefabe052de93a29d28b6b0175. (cherry picked from commit a14d3b48f7647676a0c43bceaecd56d9a77e3de6) -Resolves: RHEL-118294 +Resolves: RHEL-97175 --- src/cryptsetup/cryptsetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SOURCES/1253-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch b/SOURCES/1277-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch similarity index 92% rename from SOURCES/1253-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch rename to SOURCES/1277-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch index e7d5c1d..d459827 100644 --- a/SOURCES/1253-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch +++ b/SOURCES/1277-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch @@ -1,4 +1,4 @@ -From 4920d1ca6823abe29e8cf2eceea497d9b677ee95 Mon Sep 17 00:00:00 2001 +From be6acfdfd0ddd5625d68bdeb1fb5962d710557be Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 17 Aug 2025 21:05:24 +0900 Subject: [PATCH] cryptsetup: HAVE_CRYPT_SET_KEYRING_TO_LINK is always defined @@ -7,7 +7,7 @@ Follow-up for c5daf14c88ba44cefabe052de93a29d28b6b0175 (v256). (cherry picked from commit fb4aabf4432d523b97376099ce4353b5c268ae82) -Resolves: RHEL-118294 +Resolves: RHEL-97175 --- src/cryptsetup/cryptsetup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SOURCES/1256-coredump-make-check-that-all-argv-meta-data-fields-a.patch b/SOURCES/1278-coredump-make-check-that-all-argv-meta-data-fields-a.patch similarity index 95% rename from SOURCES/1256-coredump-make-check-that-all-argv-meta-data-fields-a.patch rename to SOURCES/1278-coredump-make-check-that-all-argv-meta-data-fields-a.patch index 3c805bd..ff50343 100644 --- a/SOURCES/1256-coredump-make-check-that-all-argv-meta-data-fields-a.patch +++ b/SOURCES/1278-coredump-make-check-that-all-argv-meta-data-fields-a.patch @@ -1,4 +1,4 @@ -From a257453e7febc1c984b180e14095c2e6092dc850 Mon Sep 17 00:00:00 2001 +From 9109aaae160fe7dcb9390829db619e4e8f90274f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 31 Oct 2024 17:02:59 +0100 Subject: [PATCH] coredump: make check that all argv[] meta data fields are diff --git a/SOURCES/1257-coredump-restore-compatibility-with-older-patterns.patch b/SOURCES/1279-coredump-restore-compatibility-with-older-patterns.patch similarity index 99% rename from SOURCES/1257-coredump-restore-compatibility-with-older-patterns.patch rename to SOURCES/1279-coredump-restore-compatibility-with-older-patterns.patch index 0403e83..90cabb3 100644 --- a/SOURCES/1257-coredump-restore-compatibility-with-older-patterns.patch +++ b/SOURCES/1279-coredump-restore-compatibility-with-older-patterns.patch @@ -1,4 +1,4 @@ -From de05f30a12a0f1ce03dc21a29a606c70e42d1de4 Mon Sep 17 00:00:00 2001 +From 38d7a52bcdad1cef1dba218f86e3905c24d51d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 29 Apr 2025 14:47:59 +0200 Subject: [PATCH] coredump: restore compatibility with older patterns diff --git a/SOURCES/1258-coredump-use-d-in-kernel-core-pattern.patch b/SOURCES/1280-coredump-use-d-in-kernel-core-pattern.patch similarity index 99% rename from SOURCES/1258-coredump-use-d-in-kernel-core-pattern.patch rename to SOURCES/1280-coredump-use-d-in-kernel-core-pattern.patch index e50a8d2..d6c53bf 100644 --- a/SOURCES/1258-coredump-use-d-in-kernel-core-pattern.patch +++ b/SOURCES/1280-coredump-use-d-in-kernel-core-pattern.patch @@ -1,4 +1,4 @@ -From 58550ccfee8cdf87e623aa70318a45a5e7c19901 Mon Sep 17 00:00:00 2001 +From fbc5015c95298c71c806b5e80207e52688aad69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 29 Apr 2025 14:47:59 +0200 Subject: [PATCH] coredump: use %d in kernel core pattern diff --git a/SOURCES/1259-pidref-add-structure-that-can-reference-a-pid-via-bo.patch b/SOURCES/1281-pidref-add-structure-that-can-reference-a-pid-via-bo.patch similarity index 98% rename from SOURCES/1259-pidref-add-structure-that-can-reference-a-pid-via-bo.patch rename to SOURCES/1281-pidref-add-structure-that-can-reference-a-pid-via-bo.patch index 1356990..906c988 100644 --- a/SOURCES/1259-pidref-add-structure-that-can-reference-a-pid-via-bo.patch +++ b/SOURCES/1281-pidref-add-structure-that-can-reference-a-pid-via-bo.patch @@ -1,4 +1,4 @@ -From c762a9a8764f8c6ce6640579ae8cf04f80360d16 Mon Sep 17 00:00:00 2001 +From e638eb667af0e8ac9d3d409edbbf51507a4eef0e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 9 Sep 2023 09:29:27 +0200 Subject: [PATCH] pidref: add structure that can reference a pid via both pidfd diff --git a/SOURCES/1260-fd-util-introduce-parse_fd.patch b/SOURCES/1282-fd-util-introduce-parse_fd.patch similarity index 95% rename from SOURCES/1260-fd-util-introduce-parse_fd.patch rename to SOURCES/1282-fd-util-introduce-parse_fd.patch index edb8207..0442124 100644 --- a/SOURCES/1260-fd-util-introduce-parse_fd.patch +++ b/SOURCES/1282-fd-util-introduce-parse_fd.patch @@ -1,4 +1,4 @@ -From 9cf24f219925df6e449eb0838af6e309d84cbb0c Mon Sep 17 00:00:00 2001 +From 8219e46540ddf0d6a7d3f97481debf297723a58f Mon Sep 17 00:00:00 2001 From: David Tardon Date: Fri, 5 May 2023 08:09:14 +0200 Subject: [PATCH] fd-util: introduce parse_fd() diff --git a/SOURCES/1261-coredump-add-support-for-new-F-PIDFD-specifier.patch b/SOURCES/1283-coredump-add-support-for-new-F-PIDFD-specifier.patch similarity index 99% rename from SOURCES/1261-coredump-add-support-for-new-F-PIDFD-specifier.patch rename to SOURCES/1283-coredump-add-support-for-new-F-PIDFD-specifier.patch index b41991a..ab2779e 100644 --- a/SOURCES/1261-coredump-add-support-for-new-F-PIDFD-specifier.patch +++ b/SOURCES/1283-coredump-add-support-for-new-F-PIDFD-specifier.patch @@ -1,4 +1,4 @@ -From bbd5aec472b90aa55e184f58691085142b7e3aaa Mon Sep 17 00:00:00 2001 +From 27faf1af778849841d7c3140bd3d92aceaea2ee3 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Sun, 13 Apr 2025 22:10:36 +0100 Subject: [PATCH] coredump: add support for new %F PIDFD specifier diff --git a/SOURCES/1267-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch b/SOURCES/1284-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch similarity index 99% rename from SOURCES/1267-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch rename to SOURCES/1284-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch index 8303a89..bc3eda2 100644 --- a/SOURCES/1267-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch +++ b/SOURCES/1284-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch @@ -1,4 +1,4 @@ -From e71140d217b3a2a75a52b488da39568d6ea942bd Mon Sep 17 00:00:00 2001 +From 69c124810e3b4bc4b7aa441cfed65d3d7594d443 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Mon, 13 Oct 2025 17:36:55 +0200 Subject: [PATCH] timer: rebase the next elapse timestamp only if timer didn't @@ -75,7 +75,7 @@ already run should prevent this from happening during daemon-reload. (cherry picked from commit bdb8e584f4509de0daebbe2357d23156160c3a90) -Related: RHEL-127022 +Related: RHEL-118215 --- src/core/timer.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/SOURCES/1285-strv-introduce-string_strv_hashmap_remove.patch b/SOURCES/1285-strv-introduce-string_strv_hashmap_remove.patch new file mode 100644 index 0000000..6d58343 --- /dev/null +++ b/SOURCES/1285-strv-introduce-string_strv_hashmap_remove.patch @@ -0,0 +1,85 @@ +From e16ede11dab405749b776aa6d58a9c7461a0dda5 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Tue, 28 Jan 2025 08:50:14 +0900 +Subject: [PATCH] strv: introduce string_strv_hashmap_remove() + +(cherry picked from commit c540875cd3b024f64980966376637ecc284d643c) + +Related: RHEL-14112 +--- + src/basic/strv.c | 17 +++++++++++++++++ + src/basic/strv.h | 5 +++++ + src/test/test-hashmap-plain.c | 16 ++++++++++++++++ + 3 files changed, 38 insertions(+) + +diff --git a/src/basic/strv.c b/src/basic/strv.c +index 66b70befd6..1f5d6f058f 100644 +--- a/src/basic/strv.c ++++ b/src/basic/strv.c +@@ -920,6 +920,23 @@ int fputstrv(FILE *f, char * const *l, const char *separator, bool *space) { + return 0; + } + ++void string_strv_hashmap_remove(Hashmap *h, const char *key, const char *value) { ++ assert(key); ++ ++ if (value) { ++ char **l = hashmap_get(h, key); ++ if (!l) ++ return; ++ ++ strv_remove(l, value); ++ if (!strv_isempty(l)) ++ return; ++ } ++ ++ _unused_ _cleanup_free_ char *key_free = NULL; ++ strv_free(hashmap_remove2(h, key, (void**) &key_free)); ++} ++ + static int string_strv_hashmap_put_internal(Hashmap *h, const char *key, const char *value) { + char **l; + int r; +diff --git a/src/basic/strv.h b/src/basic/strv.h +index 6c9fa47943..9eb685fb86 100644 +--- a/src/basic/strv.h ++++ b/src/basic/strv.h +@@ -261,6 +261,11 @@ int fputstrv(FILE *f, char * const *l, const char *separator, bool *space); + free_and_replace_full(a, b, strv_free) + + extern const struct hash_ops string_strv_hash_ops; ++ ++void string_strv_hashmap_remove(Hashmap *h, const char *key, const char *value); ++static inline void string_strv_ordered_hashmap_remove(OrderedHashmap *h, const char *key, const char *value) { ++ string_strv_hashmap_remove(PLAIN_HASHMAP(h), key, value); ++} + int _string_strv_hashmap_put(Hashmap **h, const char *key, const char *value HASHMAP_DEBUG_PARAMS); + int _string_strv_ordered_hashmap_put(OrderedHashmap **h, const char *key, const char *value HASHMAP_DEBUG_PARAMS); + #define string_strv_hashmap_put(h, k, v) _string_strv_hashmap_put(h, k, v HASHMAP_DEBUG_SRC_ARGS) +diff --git a/src/test/test-hashmap-plain.c b/src/test/test-hashmap-plain.c +index 36a775012b..3bc96fc944 100644 +--- a/src/test/test-hashmap-plain.c ++++ b/src/test/test-hashmap-plain.c +@@ -996,6 +996,22 @@ TEST(string_strv_hashmap) { + + s = hashmap_get(m, "xxx"); + assert_se(strv_equal(s, STRV_MAKE("bar", "BAR"))); ++ ++ string_strv_hashmap_remove(m, "foo", "bar"); ++ ASSERT_NOT_NULL(s = hashmap_get(m, "foo")); ++ ASSERT_TRUE(strv_equal(s, STRV_MAKE("BAR"))); ++ ++ string_strv_hashmap_remove(m, "foo", "BAR"); ++ ASSERT_NULL(hashmap_get(m, "foo")); ++ ++ string_strv_hashmap_remove(m, "xxx", "BAR"); ++ ASSERT_NOT_NULL(s = hashmap_get(m, "xxx")); ++ ASSERT_TRUE(strv_equal(s, STRV_MAKE("bar"))); ++ ++ string_strv_hashmap_remove(m, "xxx", "bar"); ++ ASSERT_NULL(hashmap_get(m, "xxx")); ++ ++ ASSERT_TRUE(hashmap_isempty(m)); + } + + /* Signal to test-hashmap.c that tests from this compilation unit were run. */ diff --git a/SOURCES/1286-unit-file-introduce-unit_file_remove_from_name_map.patch b/SOURCES/1286-unit-file-introduce-unit_file_remove_from_name_map.patch new file mode 100644 index 0000000..80413e8 --- /dev/null +++ b/SOURCES/1286-unit-file-introduce-unit_file_remove_from_name_map.patch @@ -0,0 +1,230 @@ +From fe5bad818a26875914f3b0c59fa3d4f5e6b3a41d Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Tue, 28 Jan 2025 09:55:12 +0900 +Subject: [PATCH] unit-file: introduce unit_file_remove_from_name_map() + +(cherry picked from commit d8b34aaef24599917d4e7fa04c78fffac3afe7cf) + +Related: RHEL-14112 + +[msekleta: I've backported strv_equal_ignore_order() in the same commit +in order to get this to compile.] +--- + src/basic/strv.c | 20 ++++++++++ + src/basic/strv.h | 1 + + src/basic/unit-file.c | 35 +++++++++++++++++ + src/basic/unit-file.h | 8 ++++ + src/test/test-unit-file.c | 81 +++++++++++++++++++++++++++++++++++++++ + 5 files changed, 145 insertions(+) + +diff --git a/src/basic/strv.c b/src/basic/strv.c +index 1f5d6f058f..47cc6931c1 100644 +--- a/src/basic/strv.c ++++ b/src/basic/strv.c +@@ -775,6 +775,26 @@ int strv_compare(char * const *a, char * const *b) { + return 0; + } + ++bool strv_equal_ignore_order(char **a, char **b) { ++ ++ /* Just like strv_equal(), but doesn't care about the order of elements or about redundant entries ++ * (i.e. it's even ok if the number of entries in the array differ, as long as the difference just ++ * consists of repititions) */ ++ ++ if (a == b) ++ return true; ++ ++ STRV_FOREACH(i, a) ++ if (!strv_contains(b, *i)) ++ return false; ++ ++ STRV_FOREACH(i, b) ++ if (!strv_contains(a, *i)) ++ return false; ++ ++ return true; ++} ++ + void strv_print(char * const *l) { + STRV_FOREACH(s, l) + puts(*s); +diff --git a/src/basic/strv.h b/src/basic/strv.h +index 9eb685fb86..1de3c98e5c 100644 +--- a/src/basic/strv.h ++++ b/src/basic/strv.h +@@ -160,6 +160,7 @@ bool strv_overlap(char * const *a, char * const *b) _pure_; + _STRV_FOREACH_PAIR(x, y, l, UNIQ_T(i, UNIQ)) + + char** strv_sort(char **l); ++bool strv_equal_ignore_order(char **a, char **b); + void strv_print(char * const *l); + + #define strv_from_stdarg_alloca(first) \ +diff --git a/src/basic/unit-file.c b/src/basic/unit-file.c +index c81c69db30..d7d7fd70f6 100644 +--- a/src/basic/unit-file.c ++++ b/src/basic/unit-file.c +@@ -627,6 +627,41 @@ int unit_file_build_name_map( + return 1; + } + ++int unit_file_remove_from_name_map( ++ const LookupPaths *lp, ++ uint64_t *cache_timestamp_hash, ++ Hashmap **unit_ids_map, ++ Hashmap **unit_names_map, ++ Set **path_cache, ++ const char *path) { ++ ++ int r; ++ ++ assert(path); ++ ++ /* This assumes the specified path is already removed, and drops the relevant entries from the maps. */ ++ ++ /* If one of the lookup paths we are monitoring is already changed, let's rebuild the map. Then, the ++ * new map should not contain entries relevant to the specified path. */ ++ r = unit_file_build_name_map(lp, cache_timestamp_hash, unit_ids_map, unit_names_map, path_cache); ++ if (r != 0) ++ return r; ++ ++ /* If not, drop the relevant entries. */ ++ ++ _cleanup_free_ char *name = NULL; ++ r = path_extract_filename(path, &name); ++ if (r < 0) ++ return log_warning_errno(r, "Failed to extract file name from '%s': %m", path); ++ ++ _unused_ _cleanup_free_ char *key = NULL; ++ free(hashmap_remove2(*unit_ids_map, name, (void**) &key)); ++ string_strv_hashmap_remove(*unit_names_map, name, name); ++ free(set_remove(*path_cache, path)); ++ ++ return 0; ++} ++ + static int add_name( + const char *unit_name, + Set **names, +diff --git a/src/basic/unit-file.h b/src/basic/unit-file.h +index 1c43861f00..78f65dbc8e 100644 +--- a/src/basic/unit-file.h ++++ b/src/basic/unit-file.h +@@ -52,6 +52,14 @@ int unit_file_build_name_map( + Hashmap **unit_names_map, + Set **path_cache); + ++int unit_file_remove_from_name_map( ++ const LookupPaths *lp, ++ uint64_t *cache_timestamp_hash, ++ Hashmap **unit_ids_map, ++ Hashmap **unit_names_map, ++ Set **path_cache, ++ const char *path); ++ + int unit_file_find_fragment( + Hashmap *unit_ids_map, + Hashmap *unit_name_map, +diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c +index dffa2822e6..389113c336 100644 +--- a/src/test/test-unit-file.c ++++ b/src/test/test-unit-file.c +@@ -1,10 +1,15 @@ + /* SPDX-License-Identifier: LGPL-2.1-or-later */ + ++#include "fileio.h" + #include "path-lookup.h" ++#include "path-util.h" ++#include "random-util.h" ++#include "rm-rf.h" + #include "set.h" + #include "special.h" + #include "strv.h" + #include "tests.h" ++#include "tmpfile-util.h" + #include "unit-file.h" + + TEST(unit_validate_alias_symlink_and_warn) { +@@ -85,6 +90,82 @@ TEST(unit_file_build_name_map) { + } + } + ++static bool test_unit_file_remove_from_name_map_trail(const LookupPaths *lp, size_t trial) { ++ int r; ++ ++ log_debug("/* %s(trial=%zu) */", __func__, trial); ++ ++ _cleanup_hashmap_free_ Hashmap *unit_ids = NULL, *unit_names = NULL; ++ _cleanup_set_free_ Set *path_cache = NULL; ++ assert_se(unit_file_build_name_map(lp, NULL, &unit_ids, &unit_names, &path_cache) > 0); ++ ++ _cleanup_free_ char *name = NULL; ++ for (size_t i = 0; i < 100; i++) { ++ ASSERT_OK(asprintf(&name, "test-unit-file-%"PRIx64".service", random_u64())); ++ if (!hashmap_contains(unit_ids, name)) ++ break; ++ name = mfree(name); ++ } ++ ASSERT_NOT_NULL(name); ++ ++ _cleanup_free_ char *path = path_join(lp->transient, name); ++ ASSERT_NOT_NULL(path); ++ ASSERT_OK(write_string_file(path, "[Unit]\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755)); ++ ++ uint64_t cache_timestamp_hash = 0; ++ assert_se(unit_file_build_name_map(lp, &cache_timestamp_hash, &unit_ids, &unit_names, &path_cache) > 0); ++ ++ ASSERT_STREQ(hashmap_get(unit_ids, name), path); ++ ASSERT_TRUE(strv_equal(hashmap_get(unit_names, name), STRV_MAKE(name))); ++ ASSERT_TRUE(set_contains(path_cache, path)); ++ ++ assert_se(unlink(path) >= 0); ++ ++ ASSERT_OK(r = unit_file_remove_from_name_map(lp, &cache_timestamp_hash, &unit_ids, &unit_names, &path_cache, path)); ++ if (r > 0) ++ return false; /* someone touches unit files. Retrying. */ ++ ++ ASSERT_FALSE(hashmap_contains(unit_ids, name)); ++ ASSERT_FALSE(hashmap_contains(unit_names, path)); ++ ASSERT_FALSE(set_contains(path_cache, path)); ++ ++ _cleanup_hashmap_free_ Hashmap *unit_ids_2 = NULL, *unit_names_2 = NULL; ++ _cleanup_set_free_ Set *path_cache_2 = NULL; ++ assert_se(unit_file_build_name_map(lp, NULL, &unit_ids_2, &unit_names_2, &path_cache_2) > 0); ++ ++ if (hashmap_size(unit_ids) != hashmap_size(unit_ids_2) || ++ hashmap_size(unit_names) != hashmap_size(unit_names_2) || ++ !set_equal(path_cache, path_cache_2)) ++ return false; ++ ++ const char *k, *v; ++ HASHMAP_FOREACH_KEY(v, k, unit_ids) ++ if (!streq_ptr(hashmap_get(unit_ids_2, k), v)) ++ return false; ++ ++ char **l; ++ HASHMAP_FOREACH_KEY(l, k, unit_names) ++ if (!strv_equal_ignore_order(hashmap_get(unit_names_2, k), l)) ++ return false; ++ ++ return true; ++} ++ ++ ++TEST(unit_file_remove_from_name_map) { ++ _cleanup_(rm_rf_physical_and_freep) char *d = NULL; ++ ++ _cleanup_(lookup_paths_free) LookupPaths lp = {}; ++ ASSERT_OK(lookup_paths_init(&lp, LOOKUP_SCOPE_SYSTEM, LOOKUP_PATHS_TEMPORARY_GENERATED, NULL)); ++ ASSERT_NOT_NULL(d = strdup(lp.temporary_dir)); ++ ++ for (size_t i = 0; i < 10; i++) ++ if (test_unit_file_remove_from_name_map_trail(&lp, i)) ++ return; ++ ++ assert_not_reached(); ++} ++ + TEST(runlevel_to_target) { + in_initrd_force(false); + assert_se(streq_ptr(runlevel_to_target(NULL), NULL)); diff --git a/SOURCES/1287-core-unit-remove-path-to-transient-unit-file-from-un.patch b/SOURCES/1287-core-unit-remove-path-to-transient-unit-file-from-un.patch new file mode 100644 index 0000000..9fd0e2e --- /dev/null +++ b/SOURCES/1287-core-unit-remove-path-to-transient-unit-file-from-un.patch @@ -0,0 +1,52 @@ +From 4726233b421628eae405b3b3fb08222cf0befae4 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Tue, 28 Jan 2025 10:09:32 +0900 +Subject: [PATCH] core/unit: remove path to transient unit file from unit name + maps on stop + +Fixes #35190. + +(cherry picked from commit fce94c5c563b8f6ede2b8f7f283d2d2faff4e062) + +Resolves: RHEL-14112 +--- + src/core/unit.c | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/src/core/unit.c b/src/core/unit.c +index 9e349402ff..afe3fdab04 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -598,13 +598,11 @@ static void unit_clear_dependencies(Unit *u) { + + static void unit_remove_transient(Unit *u) { + assert(u); ++ assert(u->manager); + + if (!u->transient) + return; + +- if (u->fragment_path) +- (void) unlink(u->fragment_path); +- + STRV_FOREACH(i, u->dropin_paths) { + _cleanup_free_ char *p = NULL, *pp = NULL; + +@@ -621,6 +619,17 @@ static void unit_remove_transient(Unit *u) { + (void) unlink(*i); + (void) rmdir(p); + } ++ ++ if (u->fragment_path) { ++ (void) unlink(u->fragment_path); ++ (void) unit_file_remove_from_name_map( ++ &u->manager->lookup_paths, ++ &u->manager->unit_cache_timestamp_hash, ++ &u->manager->unit_id_map, ++ &u->manager->unit_name_map, ++ &u->manager->unit_path_cache, ++ u->fragment_path); ++ } + } + + static void unit_free_requires_mounts_for(Unit *u) { diff --git a/SOURCES/1288-TEST-07-PID1-add-reprudcer-for-issue-35190.patch b/SOURCES/1288-TEST-07-PID1-add-reprudcer-for-issue-35190.patch new file mode 100644 index 0000000..2b076f0 --- /dev/null +++ b/SOURCES/1288-TEST-07-PID1-add-reprudcer-for-issue-35190.patch @@ -0,0 +1,33 @@ +From 1aa6c0d3bcac98d3442d07412f4296d5b9b18dc0 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Mon, 27 Jan 2025 22:24:16 +0900 +Subject: [PATCH] TEST-07-PID1: add reprudcer for issue #35190 + +(cherry picked from commit 448e99251aa47a5986425a1783da44d1200fe733) + +Related: RHEL-14112 +--- + test/units/testsuite-07.transient.sh | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + create mode 100755 test/units/testsuite-07.transient.sh + +diff --git a/test/units/testsuite-07.transient.sh b/test/units/testsuite-07.transient.sh +new file mode 100755 +index 0000000000..ae71a38143 +--- /dev/null ++++ b/test/units/testsuite-07.transient.sh +@@ -0,0 +1,14 @@ ++#!/usr/bin/env bash ++# SPDX-License-Identifier: LGPL-2.1-or-later ++set -ex ++set -o pipefail ++ ++journalctl --sync ++TS="$(date '+%H:%M:%S')" ++ ++systemd-run -u hogehoge.service sleep infinity ++systemctl daemon-reload ++systemctl stop hogehoge.service ++ ++journalctl --sync ++[[ -z "$(journalctl -b -q --since "$TS" -u hogehoge.service -p notice)" ]] diff --git a/SOURCES/1268-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch b/SOURCES/1289-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch similarity index 94% rename from SOURCES/1268-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch rename to SOURCES/1289-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch index 54acd91..1b7f6a5 100644 --- a/SOURCES/1268-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch +++ b/SOURCES/1289-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch @@ -1,4 +1,4 @@ -From 6ae4c19c78b0daac097b4a7d88566f95daa9e60b Mon Sep 17 00:00:00 2001 +From 2fe492a2f0fefa0f782cb04a248fc9dcd5667bf0 Mon Sep 17 00:00:00 2001 From: Michal Sekletar Date: Fri, 24 Oct 2025 12:55:20 +0200 Subject: [PATCH] coredump: handle ENOBUFS and EMSGSIZE the same way @@ -14,7 +14,7 @@ the message. (cherry picked from commit 28e62e684b631f928f1d857b04f45f0d34441675) -Resolves: RHEL-126114 +Resolves: RHEL-103801 --- src/coredump/coredump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SOURCES/1290-ukify-rstrip-and-escape-binary-null-characters-from-.patch b/SOURCES/1290-ukify-rstrip-and-escape-binary-null-characters-from-.patch new file mode 100644 index 0000000..1af21ae --- /dev/null +++ b/SOURCES/1290-ukify-rstrip-and-escape-binary-null-characters-from-.patch @@ -0,0 +1,32 @@ +From 2a16be65ca89cf18adf63a99ae1b1748e63d6773 Mon Sep 17 00:00:00 2001 +From: Li Tian <94442129+litian1992@users.noreply.github.com> +Date: Tue, 19 Aug 2025 05:43:41 +0800 +Subject: [PATCH] ukify: rstrip and escape binary null characters from + 'inspect' output (#38607) + +SBAT section of UKI may contain \u000 null characters. Rstrip them, and if there's anything left in the middle, +escape them so they are displayed as text. + +Fixes #38606 + +(cherry picked from commit 776991a3f349d9c99fd166a0c87fcd2bc1bf92a5) +Signed-off-by: Li Tian + +Resolves: RHEL-109558 +--- + src/ukify/ukify.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py +index 08f505a271..2d5050eaca 100755 +--- a/src/ukify/ukify.py ++++ b/src/ukify/ukify.py +@@ -986,7 +986,7 @@ def inspect_section(opts, section): + + if ttype == 'text': + try: +- struct['text'] = data.decode() ++ struct['text'] = data.rstrip(b'\0').replace(b'\0', b'\\0').decode() + except UnicodeDecodeError as e: + print(f"Section {name!r} is not valid text: {e}") + struct['text'] = '(not valid UTF-8)' diff --git a/SOURCES/1269-timer-rebase-last_trigger-timestamp-if-needed.patch b/SOURCES/1291-timer-rebase-last_trigger-timestamp-if-needed.patch similarity index 98% rename from SOURCES/1269-timer-rebase-last_trigger-timestamp-if-needed.patch rename to SOURCES/1291-timer-rebase-last_trigger-timestamp-if-needed.patch index 89b6218..ef16654 100644 --- a/SOURCES/1269-timer-rebase-last_trigger-timestamp-if-needed.patch +++ b/SOURCES/1291-timer-rebase-last_trigger-timestamp-if-needed.patch @@ -1,4 +1,4 @@ -From 6c05a35ce4d03cf25220de5e950970ef23417415 Mon Sep 17 00:00:00 2001 +From 6085358791b712a60fb22c7870abf0aa75c5f157 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Wed, 19 Nov 2025 14:44:13 +0100 Subject: [PATCH] timer: rebase last_trigger timestamp if needed @@ -21,7 +21,7 @@ Follow-up for bdb8e584f4509de0daebbe2357d23156160c3a90. (cherry picked from commit 3605b3ba87833a9919bfde05952a7d9de10499a2) -Related: RHEL-127022 +Related: RHEL-118215 --- src/core/timer.c | 15 +++-- ...tsuite-53.RandomizedDelaySec-persistent.sh | 67 +++++++++++++++++++ diff --git a/SOURCES/1292-cryptsetup-generator-refactor-add_crypttab_devices.patch b/SOURCES/1292-cryptsetup-generator-refactor-add_crypttab_devices.patch new file mode 100644 index 0000000..0ac252f --- /dev/null +++ b/SOURCES/1292-cryptsetup-generator-refactor-add_crypttab_devices.patch @@ -0,0 +1,130 @@ +From 01826a6ded513adea1dabeccc6b860baee277482 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 30 May 2024 10:44:36 +0200 +Subject: [PATCH] cryptsetup-generator: refactor add_crypttab_devices() + +Move the processing of a crypttab entry to a separate function. + +No functional changes, just refactoring. + +(cherry picked from commit a07cb7d404582f9c0bfaedb9dd07f93848aa91c6) + +Related: RHEL-127859 +--- + src/cryptsetup/cryptsetup-generator.c | 87 +++++++++++++++------------ + 1 file changed, 49 insertions(+), 38 deletions(-) + +diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c +index 9e8e7e746f..6ab3b85b6b 100644 +--- a/src/cryptsetup/cryptsetup-generator.c ++++ b/src/cryptsetup/cryptsetup-generator.c +@@ -779,6 +779,52 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat + return 0; + } + ++static int add_crypttab_device(const char *name, const char *device, const char *keyspec, const char *options) { ++ _cleanup_free_ char *keyfile = NULL, *keydev = NULL, *headerdev = NULL, *filtered_header = NULL; ++ crypto_device *d = NULL; ++ char *uuid; ++ int r; ++ ++ uuid = startswith(device, "UUID="); ++ if (!uuid) ++ uuid = path_startswith(device, "/dev/disk/by-uuid/"); ++ if (!uuid) ++ uuid = startswith(name, "luks-"); ++ if (uuid) ++ d = hashmap_get(arg_disks, uuid); ++ ++ if (arg_allow_list && !d) { ++ log_info("Not creating device '%s' because it was not specified on the kernel command line.", name); ++ return 0; ++ } ++ ++ r = split_locationspec(keyspec, &keyfile, &keydev); ++ if (r < 0) ++ return r; ++ ++ if (options && (!d || !d->options)) { ++ r = filter_header_device(options, &headerdev, &filtered_header); ++ if (r < 0) ++ return r; ++ options = filtered_header; ++ } ++ ++ r = create_disk(name, ++ device, ++ keyfile, ++ keydev, ++ (d && d->options) ? d->headerdev : headerdev, ++ (d && d->options) ? d->options : options, ++ arg_crypttab); ++ if (r < 0) ++ return r; ++ ++ if (d) ++ d->create = false; ++ ++ return 0; ++} ++ + static int add_crypttab_devices(void) { + _cleanup_fclose_ FILE *f = NULL; + unsigned crypttab_line = 0; +@@ -795,10 +841,8 @@ static int add_crypttab_devices(void) { + } + + for (;;) { +- _cleanup_free_ char *line = NULL, *name = NULL, *device = NULL, *keyspec = NULL, *options = NULL, +- *keyfile = NULL, *keydev = NULL, *headerdev = NULL, *filtered_header = NULL; +- crypto_device *d = NULL; +- char *l, *uuid; ++ _cleanup_free_ char *line = NULL, *name = NULL, *device = NULL, *keyspec = NULL, *options = NULL; ++ char *l; + int k; + + r = read_line(f, LONG_LINE_MAX, &line); +@@ -819,42 +863,9 @@ static int add_crypttab_devices(void) { + continue; + } + +- uuid = startswith(device, "UUID="); +- if (!uuid) +- uuid = path_startswith(device, "/dev/disk/by-uuid/"); +- if (!uuid) +- uuid = startswith(name, "luks-"); +- if (uuid) +- d = hashmap_get(arg_disks, uuid); +- +- if (arg_allow_list && !d) { +- log_info("Not creating device '%s' because it was not specified on the kernel command line.", name); +- continue; +- } +- +- r = split_locationspec(keyspec, &keyfile, &keydev); ++ r = add_crypttab_device(name, device, keyspec, options); + if (r < 0) + return r; +- +- if (options && (!d || !d->options)) { +- r = filter_header_device(options, &headerdev, &filtered_header); +- if (r < 0) +- return r; +- free_and_replace(options, filtered_header); +- } +- +- r = create_disk(name, +- device, +- keyfile, +- keydev, +- (d && d->options) ? d->headerdev : headerdev, +- (d && d->options) ? d->options : options, +- arg_crypttab); +- if (r < 0) +- return r; +- +- if (d) +- d->create = false; + } + + return 0; diff --git a/SOURCES/1293-cryptsetup-generator-continue-parsing-after-error.patch b/SOURCES/1293-cryptsetup-generator-continue-parsing-after-error.patch new file mode 100644 index 0000000..5f116f1 --- /dev/null +++ b/SOURCES/1293-cryptsetup-generator-continue-parsing-after-error.patch @@ -0,0 +1,43 @@ +From 238dadc16fb2bb6ad2fef5602dac5cd2c9aa31ed Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 30 May 2024 10:46:13 +0200 +Subject: [PATCH] cryptsetup-generator: continue parsing after error + +Let's make the crypttab parser more robust and continue even if parsing +of a line failed. + +(cherry picked from commit 83813bae7ae471862ff84b038b5e4eaefae41c98) + +Resolves: RHEL-127859 +--- + src/cryptsetup/cryptsetup-generator.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c +index 6ab3b85b6b..924a403ee5 100644 +--- a/src/cryptsetup/cryptsetup-generator.c ++++ b/src/cryptsetup/cryptsetup-generator.c +@@ -828,7 +828,7 @@ static int add_crypttab_device(const char *name, const char *device, const char + static int add_crypttab_devices(void) { + _cleanup_fclose_ FILE *f = NULL; + unsigned crypttab_line = 0; +- int r; ++ int r, ret = 0; + + if (!arg_read_crypttab) + return 0; +@@ -863,12 +863,10 @@ static int add_crypttab_devices(void) { + continue; + } + +- r = add_crypttab_device(name, device, keyspec, options); +- if (r < 0) +- return r; ++ RET_GATHER(ret, add_crypttab_device(name, device, keyspec, options)); + } + +- return 0; ++ return ret; + } + + static int add_proc_cmdline_devices(void) { diff --git a/SOURCES/1294-cryptsetup-generator-parse-all-cmdline-devices-too.patch b/SOURCES/1294-cryptsetup-generator-parse-all-cmdline-devices-too.patch new file mode 100644 index 0000000..ab8f684 --- /dev/null +++ b/SOURCES/1294-cryptsetup-generator-parse-all-cmdline-devices-too.patch @@ -0,0 +1,39 @@ +From 25a4e8e1d411f56fcee5b53d1620c42f3bba16e6 Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 30 May 2024 13:32:20 +0200 +Subject: [PATCH] cryptsetup-generator: parse all cmdline devices too + +(cherry picked from commit 47c703d949e84997d11d657fade68064c04a46c8) + +Related: RHEL-127859 +--- + src/cryptsetup/cryptsetup-generator.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c +index 924a403ee5..1136f5aed7 100644 +--- a/src/cryptsetup/cryptsetup-generator.c ++++ b/src/cryptsetup/cryptsetup-generator.c +@@ -870,7 +870,7 @@ static int add_crypttab_devices(void) { + } + + static int add_proc_cmdline_devices(void) { +- int r; ++ int r, ret = 0; + crypto_device *d; + + HASHMAP_FOREACH(d, arg_disks) { +@@ -896,11 +896,10 @@ static int add_proc_cmdline_devices(void) { + d->headerdev, + d->options ?: arg_default_options, + "/proc/cmdline"); +- if (r < 0) +- return r; ++ RET_GATHER(ret, r); + } + +- return 0; ++ return ret; + } + + DEFINE_PRIVATE_HASH_OPS_WITH_VALUE_DESTRUCTOR(crypt_device_hash_ops, char, string_hash_func, string_compare_func, diff --git a/SOURCES/1295-cryptsetup-generator-always-process-cmdline-devices.patch b/SOURCES/1295-cryptsetup-generator-always-process-cmdline-devices.patch new file mode 100644 index 0000000..204ca41 --- /dev/null +++ b/SOURCES/1295-cryptsetup-generator-always-process-cmdline-devices.patch @@ -0,0 +1,33 @@ +From 1ba4f74ed15a3b715eba0f21a12239af6e44146f Mon Sep 17 00:00:00 2001 +From: David Tardon +Date: Thu, 30 May 2024 13:33:57 +0200 +Subject: [PATCH] cryptsetup-generator: always process cmdline devices + +(cherry picked from commit d181939e2e382631d9b067e0b4cfbf11b709a297) + +Related: RHEL-127859 +--- + src/cryptsetup/cryptsetup-generator.c | 9 ++------- + 1 file changed, 2 insertions(+), 7 deletions(-) + +diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c +index 1136f5aed7..06292f7f73 100644 +--- a/src/cryptsetup/cryptsetup-generator.c ++++ b/src/cryptsetup/cryptsetup-generator.c +@@ -925,14 +925,9 @@ static int run(const char *dest, const char *dest_early, const char *dest_late) + return 0; + + r = add_crypttab_devices(); +- if (r < 0) +- return r; +- +- r = add_proc_cmdline_devices(); +- if (r < 0) +- return r; ++ RET_GATHER(r, add_proc_cmdline_devices()); + +- return 0; ++ return r; + } + + DEFINE_MAIN_GENERATOR_FUNCTION(run); diff --git a/SOURCES/1296-logind-add-background-light-session-class.patch b/SOURCES/1296-logind-add-background-light-session-class.patch new file mode 100644 index 0000000..18c2c08 --- /dev/null +++ b/SOURCES/1296-logind-add-background-light-session-class.patch @@ -0,0 +1,44 @@ +From a48488d06e60af0d02387488d4de0abbaddf93ad Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 27 Nov 2023 18:39:02 +0100 +Subject: [PATCH] logind: add "background-light" session class + +This is the same as the "background" class, but does *not* pull in a +service manager. It might be useful for things like select cron jobs +that do not intend to call per-user IPC calls. + +Replaces: #23569 +Fixes: #23978 + +(cherry picked from commit b5100c736f1fce2b6b22c07cf2725e4ec3764a75) + +Related: RHEL-109833 +--- + src/login/logind-session.c | 1 + + src/login/logind-session.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/src/login/logind-session.c b/src/login/logind-session.c +index 8c8dd0d43e..5ba1e690ac 100644 +--- a/src/login/logind-session.c ++++ b/src/login/logind-session.c +@@ -1525,6 +1525,7 @@ static const char* const session_class_table[_SESSION_CLASS_MAX] = { + [SESSION_GREETER] = "greeter", + [SESSION_LOCK_SCREEN] = "lock-screen", + [SESSION_BACKGROUND] = "background", ++ [SESSION_BACKGROUND_LIGHT] = "background-light", + }; + + DEFINE_STRING_TABLE_LOOKUP(session_class, SessionClass); +diff --git a/src/login/logind-session.h b/src/login/logind-session.h +index 5ee059aa4f..a02d72c211 100644 +--- a/src/login/logind-session.h ++++ b/src/login/logind-session.h +@@ -23,6 +23,7 @@ typedef enum SessionClass { + SESSION_GREETER, + SESSION_LOCK_SCREEN, + SESSION_BACKGROUND, ++ SESSION_BACKGROUND_LIGHT, /* Like SESSION_BACKGROUND, but without the service manager */ + _SESSION_CLASS_MAX, + _SESSION_CLASS_INVALID = -EINVAL, + } SessionClass; diff --git a/SOURCES/1297-pam_systemd-honor-session-class-provided-via-PAM-env.patch b/SOURCES/1297-pam_systemd-honor-session-class-provided-via-PAM-env.patch new file mode 100644 index 0000000..b18855f --- /dev/null +++ b/SOURCES/1297-pam_systemd-honor-session-class-provided-via-PAM-env.patch @@ -0,0 +1,118 @@ +From d5d08290cf66a0c491a875345902d5c3bfeb6c5a Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Mon, 25 Aug 2025 15:09:36 +0200 +Subject: [PATCH] pam_systemd: honor session class provided via PAM environment + +Replaces #38638 + +Co-authored-by: Lennart Poettering +(cherry picked from commit cf2630acaa87ded5ad99ea30ed4bd895e71ca503) + +Resolves: RHEL-109833 + +[msekleta: this is absolutely minimal version of the ideas implemented in +https://github.com/systemd/systemd/pull/30884. At this point I want to avoid +big/risky backports and what I am proposing here should suffice.] +--- + man/pam_systemd.xml | 11 ++++++++++- + src/login/logind-session.c | 5 +++-- + src/login/logind-user.c | 16 +++++++++++++++- + src/login/pam_systemd.c | 6 ++++-- + 4 files changed, 32 insertions(+), 6 deletions(-) + +diff --git a/man/pam_systemd.xml b/man/pam_systemd.xml +index 60b8577822..55239ea3d7 100644 +--- a/man/pam_systemd.xml ++++ b/man/pam_systemd.xml +@@ -95,8 +95,17 @@ + lock-screen or background. See + sd_session_get_class3 for + details about the session class. +- + ++ If no session class is specified via either the PAM module option or via the ++ $XDG_SESSION_CLASS environment variable, the class is automatically chosen, depending on ++ various session parameters, such as the session type (if known), whether the session has a TTY or X11 ++ display, and the user disposition. Note that various tools allow setting the session class for newly ++ allocated PAM sessions explicitly by means of the $XDG_SESSION_CLASS environment variable. ++ For example, classic UNIX cronjobs support environment variable assignments (see ++ crontab5), ++ which may be used to choose between the background and ++ background-light session class individually per cronjob. ++ + + type= + +diff --git a/src/login/logind-session.c b/src/login/logind-session.c +index 5ba1e690ac..2ad05e3798 100644 +--- a/src/login/logind-session.c ++++ b/src/login/logind-session.c +@@ -680,8 +680,9 @@ static int session_start_scope(Session *s, sd_bus_message *properties, sd_bus_er + s->user->slice, + description, + /* These two have StopWhenUnneeded= set, hence add a dep towards them */ +- STRV_MAKE(s->user->runtime_dir_service, +- s->user->service), ++ s->class == SESSION_BACKGROUND_LIGHT ? ++ STRV_MAKE(s->user->runtime_dir_service) : ++ STRV_MAKE(s->user->runtime_dir_service, s->user->service), + after, + user_record_home_directory(s->user->user_record), + properties, +diff --git a/src/login/logind-user.c b/src/login/logind-user.c +index e02ad754ee..ffa32c6ce5 100644 +--- a/src/login/logind-user.c ++++ b/src/login/logind-user.c +@@ -441,6 +441,19 @@ static int user_update_slice(User *u) { + return 0; + } + ++static bool user_wants_service_manager(User *u) { ++ assert(u); ++ ++ LIST_FOREACH(sessions_by_user, s, u->sessions) ++ if (s->class != SESSION_BACKGROUND_LIGHT) ++ return true; ++ ++ if (user_check_linger_file(u) > 0) ++ return true; ++ ++ return false; ++} ++ + int user_start(User *u) { + assert(u); + +@@ -464,7 +477,8 @@ int user_start(User *u) { + (void) user_update_slice(u); + + /* Start user@UID.service */ +- user_start_service(u); ++ if (user_wants_service_manager(u)) ++ user_start_service(u); + + if (!u->started) { + if (!dual_timestamp_is_set(&u->timestamp)) +diff --git a/src/login/pam_systemd.c b/src/login/pam_systemd.c +index a288b3602a..c7377e21a8 100644 +--- a/src/login/pam_systemd.c ++++ b/src/login/pam_systemd.c +@@ -753,14 +753,16 @@ _public_ PAM_EXTERN int pam_sm_open_session( + * (as they otherwise even try to update it!) — but cron doesn't actually allocate a TTY for its forked + * off processes.) */ + type = "unspecified"; +- class = "background"; ++ if (isempty(class)) ++ class = "background"; + tty = NULL; + + } else if (streq(tty, "ssh")) { + /* ssh has been setting PAM_TTY to "ssh" (for the same reason as cron does this, see above. For further + * details look for "PAM_TTY_KLUDGE" in the openssh sources). */ + type ="tty"; +- class = "user"; ++ if (isempty(class)) ++ class = "user"; + tty = NULL; /* This one is particularly sad, as this means that ssh sessions — even though usually + * associated with a pty — won't be tracked by their tty in logind. This is because ssh + * does the PAM session registration early for new connections, and registers a pty only diff --git a/SOURCES/1270-core-fix-array-size-in-unit_log_resources.patch b/SOURCES/1298-core-fix-array-size-in-unit_log_resources.patch similarity index 88% rename from SOURCES/1270-core-fix-array-size-in-unit_log_resources.patch rename to SOURCES/1298-core-fix-array-size-in-unit_log_resources.patch index f563377..a10593f 100644 --- a/SOURCES/1270-core-fix-array-size-in-unit_log_resources.patch +++ b/SOURCES/1298-core-fix-array-size-in-unit_log_resources.patch @@ -1,4 +1,4 @@ -From ca32ed0b2451453eaff579d08f9e188f9c79ab0c Mon Sep 17 00:00:00 2001 +From 52defa44074113197a8caade1254a61cfdcfa363 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 9 Nov 2023 08:59:59 +0100 Subject: [PATCH] core: fix array size in unit_log_resources() @@ -10,16 +10,16 @@ messages was not adjusted. Fixes: 0531bded79dc ("core: include peak memory in unit_log_resources()") (cherry picked from commit 893028523469b3ec459388428ddc466942cdaf4d) -Resolves: RHEL-132120 +Resolves: RHEL-131338 --- src/core/unit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c -index 9e349402ff..3e04b12951 100644 +index afe3fdab04..009f416280 100644 --- a/src/core/unit.c +++ b/src/core/unit.c -@@ -2233,12 +2233,12 @@ static int raise_level(int log_level, bool condition_info, bool condition_notice +@@ -2242,12 +2242,12 @@ static int raise_level(int log_level, bool condition_info, bool condition_notice } static int unit_log_resources(Unit *u) { diff --git a/SOURCES/1299-pid1-add-env-var-to-override-default-mount-rate-limi.patch b/SOURCES/1299-pid1-add-env-var-to-override-default-mount-rate-limi.patch new file mode 100644 index 0000000..78a9d18 --- /dev/null +++ b/SOURCES/1299-pid1-add-env-var-to-override-default-mount-rate-limi.patch @@ -0,0 +1,63 @@ +From 8e0da3f5c5518350215a7186dfa748207ba921e8 Mon Sep 17 00:00:00 2001 +From: Luca Boccassi +Date: Mon, 5 Dec 2022 21:05:54 +0000 +Subject: [PATCH] pid1: add env var to override default mount rate limit burst + +I am hitting the rate limit on a busy system with low resources, and +it stalls the boot process which is Very Bad (TM). + +(cherry picked from commit 24a4542cfa674ee80b54afcc223f2490a011966b) + +Related: RHEL-129153 +--- + docs/ENVIRONMENT.md | 7 +++++++ + src/core/mount.c | 11 ++++++++++- + 2 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md +index 54b779d312..88e6f5b372 100644 +--- a/docs/ENVIRONMENT.md ++++ b/docs/ENVIRONMENT.md +@@ -281,6 +281,13 @@ All tools: + type as unsupported may not prevent loading some units of that type if they + are referenced by other units of another supported type. + ++* `$SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST` — can be set to override the mount ++ units burst rate limit for parsing `/proc/self/mountinfo`. On a system with ++ few resources but many mounts the rate limit may be hit, which will cause the ++ processing of mount units to stall. The burst limit may be adjusted when the ++ default is not appropriate for a given system. Defaults to `5`, accepts ++ positive integers. ++ + `systemd-remount-fs`: + + * `$SYSTEMD_REMOUNT_ROOT_RW=1` — if set and no entry for the root directory +diff --git a/src/core/mount.c b/src/core/mount.c +index 79772fb6f1..a8e101aa64 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1910,6 +1910,7 @@ static void mount_enumerate(Manager *m) { + mnt_init_debug(0); + + if (!m->mount_monitor) { ++ unsigned mount_rate_limit_burst = 5; + int fd; + + m->mount_monitor = mnt_new_monitor(); +@@ -1949,7 +1950,15 @@ static void mount_enumerate(Manager *m) { + goto fail; + } + +- r = sd_event_source_set_ratelimit(m->mount_event_source, 1 * USEC_PER_SEC, 5); ++ /* Let users override the default (5 in 1s), as it stalls the boot sequence on busy systems. */ ++ const char *e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST"); ++ if (e) { ++ r = safe_atou(e, &mount_rate_limit_burst); ++ if (r < 0) ++ log_debug("Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST, ignoring: %s", e); ++ } ++ ++ r = sd_event_source_set_ratelimit(m->mount_event_source, 1 * USEC_PER_SEC, mount_rate_limit_burst); + if (r < 0) { + log_error_errno(r, "Failed to enable rate limit for mount events: %m"); + goto fail; diff --git a/SOURCES/1300-pid1-add-env-var-to-override-default-mount-rate-limi.patch b/SOURCES/1300-pid1-add-env-var-to-override-default-mount-rate-limi.patch new file mode 100644 index 0000000..60faff1 --- /dev/null +++ b/SOURCES/1300-pid1-add-env-var-to-override-default-mount-rate-limi.patch @@ -0,0 +1,75 @@ +From 4f880e4dfc1b2e25046be380182535c39a931109 Mon Sep 17 00:00:00 2001 +From: xujing +Date: Wed, 16 Oct 2024 15:19:09 +0800 +Subject: [PATCH] pid1: add env var to override default mount rate limit + interval + +Similar to 24a4542c. 24a4542c can only be set 1 in 1s at most, +sometimes we may need to set to something else(such as 1 in 2s). +So it's best to let the user decide. + +This also allows users to solve #34690. + +(cherry picked from commit cc2030f928981947db8fb9ec185a82024abab2c4) + +Related: RHEL-129153 +--- + docs/ENVIRONMENT.md | 7 +++++++ + src/core/mount.c | 14 +++++++++++--- + 2 files changed, 18 insertions(+), 3 deletions(-) + +diff --git a/docs/ENVIRONMENT.md b/docs/ENVIRONMENT.md +index 88e6f5b372..711364a2f7 100644 +--- a/docs/ENVIRONMENT.md ++++ b/docs/ENVIRONMENT.md +@@ -288,6 +288,13 @@ All tools: + default is not appropriate for a given system. Defaults to `5`, accepts + positive integers. + ++* `$SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_INTERVAL_SEC` — can be set to override the mount ++ units interval rate limit for parsing `/proc/self/mountinfo`. Similar to ++ `$SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST`, the interval limit maybe adjusted when ++ the default is not appropriate for a given system. The default value is 1 and the ++ default application time unit is second, and the time unit can beoverriden as usual ++ by specifying it explicitly, see the systemd.time(7) man page. ++ + `systemd-remount-fs`: + + * `$SYSTEMD_REMOUNT_ROOT_RW=1` — if set and no entry for the root directory +diff --git a/src/core/mount.c b/src/core/mount.c +index a8e101aa64..be6fbf4cc4 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -1910,6 +1910,7 @@ static void mount_enumerate(Manager *m) { + mnt_init_debug(0); + + if (!m->mount_monitor) { ++ usec_t mount_rate_limit_interval = 1 * USEC_PER_SEC; + unsigned mount_rate_limit_burst = 5; + int fd; + +@@ -1951,14 +1952,21 @@ static void mount_enumerate(Manager *m) { + } + + /* Let users override the default (5 in 1s), as it stalls the boot sequence on busy systems. */ +- const char *e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST"); ++ const char *e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_INTERVAL_SEC"); ++ if (e) { ++ r = parse_sec(e, &mount_rate_limit_interval); ++ if (r < 0) ++ log_debug_errno(r, "Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_INTERVAL_SEC, ignoring: %s", e); ++ } ++ ++ e = secure_getenv("SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST"); + if (e) { + r = safe_atou(e, &mount_rate_limit_burst); + if (r < 0) +- log_debug("Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST, ignoring: %s", e); ++ log_debug_errno(r, "Invalid value in $SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST, ignoring: %s", e); + } + +- r = sd_event_source_set_ratelimit(m->mount_event_source, 1 * USEC_PER_SEC, mount_rate_limit_burst); ++ r = sd_event_source_set_ratelimit(m->mount_event_source, mount_rate_limit_interval, mount_rate_limit_burst); + if (r < 0) { + log_error_errno(r, "Failed to enable rate limit for mount events: %m"); + goto fail; diff --git a/SOURCES/1301-core-service-fix-error-cause-in-the-log.patch b/SOURCES/1301-core-service-fix-error-cause-in-the-log.patch new file mode 100644 index 0000000..43e9025 --- /dev/null +++ b/SOURCES/1301-core-service-fix-error-cause-in-the-log.patch @@ -0,0 +1,28 @@ +From de696eb8fc5caf5d5ad0a314fa21f8ca78bf8071 Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Tue, 9 May 2023 00:21:20 +0900 +Subject: [PATCH] core/service: fix error cause in the log + +Fixes a bug caused by a5648b809457d120500b2acb18b31e2168a4817a. +Fixes #27575. + +(cherry picked from commit f86a388de339bc9fd3bc90df7de0d9693b52369f) + +Resolves: RHEL-138414 +--- + src/core/service.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/service.c b/src/core/service.c +index 305f3b7170..9c938aee91 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -989,7 +989,7 @@ static int service_load_pid_file(Service *s, bool may_warn) { + r = chase_symlinks(s->pid_file, NULL, 0, NULL, &fd); + } + if (r < 0) +- return log_unit_full_errno(UNIT(s), prio, fd, ++ return log_unit_full_errno(UNIT(s), prio, r, + "Can't open PID file %s (yet?) after %s: %m", s->pid_file, service_state_to_string(s->state)); + + /* Let's read the PID file now that we chased it down. But we need to convert the O_PATH fd diff --git a/SOURCES/1302-fstab-generator-drop-assertions-for-mount-opts.patch b/SOURCES/1302-fstab-generator-drop-assertions-for-mount-opts.patch new file mode 100644 index 0000000..c352e15 --- /dev/null +++ b/SOURCES/1302-fstab-generator-drop-assertions-for-mount-opts.patch @@ -0,0 +1,45 @@ +From 7640cebb70cc13ada4f0b6e3e26b7973be6d1b23 Mon Sep 17 00:00:00 2001 +From: Mike Yuan +Date: Fri, 26 Jan 2024 00:47:23 +0800 +Subject: [PATCH] fstab-generator: drop assertions for mount opts + +fstab_filter_options accepts NULL and (with later changes) +might even return NULL. + +(cherry picked from commit c521ce42b43ad542a8e3c6e5e83ceb653ca6a71e) + +Related: RHEL-92752 +--- + src/fstab-generator/fstab-generator.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c +index b9606a5341..fe0283b4e7 100644 +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -486,7 +486,6 @@ static int add_mount( + + assert(what); + assert(where); +- assert(opts); + assert(target_unit); + assert(source); + +@@ -797,6 +796,9 @@ static int add_sysusr_sysroot_usr_bind_mount(const char *source) { + static MountPointFlags fstab_options_to_flags(const char *options, bool is_swap) { + MountPointFlags flags = 0; + ++ if (isempty(options)) ++ return 0; ++ + if (fstab_test_option(options, "x-systemd.makefs\0")) + flags |= MOUNT_MAKEFS; + if (fstab_test_option(options, "x-systemd.growfs\0")) +@@ -872,7 +874,6 @@ static int parse_fstab_one( + + assert(what_original); + assert(fstype); +- assert(options); + + if (prefix_sysroot && !mount_in_initrd(where_original, options, accept_root)) + return 0; diff --git a/SOURCES/1303-fstab-generator-fix-options-in-systemd.mount-extra-a.patch b/SOURCES/1303-fstab-generator-fix-options-in-systemd.mount-extra-a.patch new file mode 100644 index 0000000..d015535 --- /dev/null +++ b/SOURCES/1303-fstab-generator-fix-options-in-systemd.mount-extra-a.patch @@ -0,0 +1,114 @@ +From 0a4f0be757c73e3320d1c611de9845f7713b10d0 Mon Sep 17 00:00:00 2001 +From: Jules Lamur +Date: Mon, 7 Apr 2025 18:49:26 +0200 +Subject: [PATCH] fstab-generator: fix options in systemd.mount-extra= arg + +Fixes a bug introduced by 55365b0a233ae3024411fd0815ad930e20f6a3d6 (v254). + +The arguments `(rd.)systemd.mount-extra` take a value that looks like +`WHAT:WHERE[:FSTYPE[:OPTIONS]]`. The `OPTIONS` were parsed into a nulstr +where a comma-separated c-string was expected. This leads to a bug where +only the first option was taken into account by the generator. + +For example, if you passed `systemd.mount-extra=/x:/y:baz:ro,defaults` +to the kernel, `systemd-fstab-generator` would translate that into a +nulstr: `ro\0defaults\0`. +Since methods processing options in the generator expected a +comma-separated c-string, they would only see the first option, `ro` in +this case. + +(cherry picked from commit 06fadc4286fee6a7505a88659e5ae2e6f3ee60ba) + +Resolves: RHEL-92752 +--- + src/fstab-generator/fstab-generator.c | 21 ++++--------------- + .../hoge-withx20space.mount | 2 +- + .../dev-sdy3.swap | 2 +- + .../dev-sdy3.swap | 0 + 4 files changed, 6 insertions(+), 19 deletions(-) + rename test/test-fstab-generator/test-20-swap-from-cmdline.expected/{swap.target.requires => swap.target.wants}/dev-sdy3.swap (100%) + +diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c +index fe0283b4e7..28677a2f39 100644 +--- a/src/fstab-generator/fstab-generator.c ++++ b/src/fstab-generator/fstab-generator.c +@@ -105,15 +105,15 @@ static int mount_array_add_internal( + char *in_what, + char *in_where, + const char *in_fstype, +- const char *in_options) { ++ char *in_options) { + + _cleanup_free_ char *what = NULL, *where = NULL, *fstype = NULL, *options = NULL; +- int r; + + /* This takes what and where. */ + + what = ASSERT_PTR(in_what); + where = in_where; ++ options = in_options; + + fstype = strdup(isempty(in_fstype) ? "auto" : in_fstype); + if (!fstype) +@@ -122,19 +122,6 @@ static int mount_array_add_internal( + if (streq(fstype, "swap")) + where = mfree(where); + +- if (!isempty(in_options)) { +- _cleanup_strv_free_ char **options_strv = NULL; +- +- r = strv_split_full(&options_strv, in_options, ",", 0); +- if (r < 0) +- return r; +- +- r = strv_make_nulstr(options_strv, &options, NULL); +- } else +- r = strv_make_nulstr(STRV_MAKE("defaults"), &options, NULL); +- if (r < 0) +- return r; +- + if (!GREEDY_REALLOC(arg_mounts, arg_n_mounts + 1)) + return -ENOMEM; + +@@ -164,7 +151,7 @@ static int mount_array_add(bool for_initrd, const char *str) { + if (!isempty(str)) + return -EINVAL; + +- return mount_array_add_internal(for_initrd, TAKE_PTR(what), TAKE_PTR(where), fstype, options); ++ return mount_array_add_internal(for_initrd, TAKE_PTR(what), TAKE_PTR(where), fstype, TAKE_PTR(options)); + } + + static int mount_array_add_swap(bool for_initrd, const char *str) { +@@ -182,7 +169,7 @@ static int mount_array_add_swap(bool for_initrd, const char *str) { + if (!isempty(str)) + return -EINVAL; + +- return mount_array_add_internal(for_initrd, TAKE_PTR(what), NULL, "swap", options); ++ return mount_array_add_internal(for_initrd, TAKE_PTR(what), NULL, "swap", TAKE_PTR(options)); + } + + static int write_options(FILE *f, const char *options) { +diff --git a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount +index e9ffb4bbd9..d3797c9706 100644 +--- a/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount ++++ b/test/test-fstab-generator/test-19-mounts-from-cmdline.expected/hoge-withx20space.mount +@@ -9,4 +9,4 @@ Before=remote-fs.target + What=//foo￾bar + Where=/hoge/with space + Type=cifs +-Options=rw ++Options=rw,seclabel +diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap +index 3b6563d216..1b4b53c9b8 100644 +--- a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap ++++ b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/dev-sdy3.swap +@@ -7,4 +7,4 @@ After=blockdev@dev-sdy3.target + + [Swap] + What=/dev/sdy3 +-Options=x-systemd.makefs ++Options=x-systemd.makefs,nofail +diff --git a/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy3.swap b/test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.wants/dev-sdy3.swap +similarity index 100% +rename from test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.requires/dev-sdy3.swap +rename to test/test-fstab-generator/test-20-swap-from-cmdline.expected/swap.target.wants/dev-sdy3.swap diff --git a/SOURCES/1304-core-reorder-systemd-arguments-on-reexec.patch b/SOURCES/1304-core-reorder-systemd-arguments-on-reexec.patch new file mode 100644 index 0000000..4c014c1 --- /dev/null +++ b/SOURCES/1304-core-reorder-systemd-arguments-on-reexec.patch @@ -0,0 +1,57 @@ +From 88dfaa167328461ac18e8e764c97e19632b34161 Mon Sep 17 00:00:00 2001 +From: Frantisek Sumsal +Date: Thu, 29 Jun 2023 13:31:19 +0200 +Subject: [PATCH] core: reorder systemd arguments on reexec + +When reexecuting system let's put our arguments carrying deserialization +info first followed by any existing arguments to make sure they get +parsed in case we get weird stuff from the kernel cmdline (like --). + +See: https://github.com/systemd/systemd/issues/28184 +(cherry picked from commit 06afda6b38d5d730fca3c65449096425933272bc) + +Resolves: RHEL-111135 +--- + src/core/main.c | 6 +++++- + test/TEST-01-BASIC/test.sh | 5 +++++ + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/src/core/main.c b/src/core/main.c +index f230270340..2eba3a3c50 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1814,13 +1814,17 @@ static int do_reexecute( + xsprintf(sfd, "%i", fileno(arg_serialization)); + + i = 1; /* Leave args[0] empty for now. */ +- filter_args(args, &i, argv, argc); + ++ /* Put our stuff first to make sure it always gets parsed in case ++ * we get weird stuff from the kernel cmdline (like --) */ + if (switch_root_dir) + args[i++] = "--switched-root"; + args[i++] = arg_system ? "--system" : "--user"; + args[i++] = "--deserialize"; + args[i++] = sfd; ++ ++ filter_args(args, &i, argv, argc); ++ + args[i++] = NULL; + + assert(i <= args_size); +diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh +index cc6d0651c1..d0e714ac30 100755 +--- a/test/TEST-01-BASIC/test.sh ++++ b/test/TEST-01-BASIC/test.sh +@@ -8,6 +8,11 @@ RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes} + TEST_REQUIRE_INSTALL_TESTS=0 + TEST_SUPPORTING_SERVICES_SHOULD_BE_MASKED=0 + ++# Check if we can correctly deserialize if the kernel cmdline contains "weird" stuff ++# like an invalid argument, "end of arguments" separator, or a sysvinit argument (-z) ++# See: https://github.com/systemd/systemd/issues/28184 ++KERNEL_APPEND="foo -- -z bar --- baz $KERNEL_APPEND" ++ + # shellcheck source=test/test-functions + . "${TEST_BASE_DIR:?}/test-functions" + diff --git a/SOURCES/1305-basic-add-RuntimeScope-enum.patch b/SOURCES/1305-basic-add-RuntimeScope-enum.patch new file mode 100644 index 0000000..db4d2d8 --- /dev/null +++ b/SOURCES/1305-basic-add-RuntimeScope-enum.patch @@ -0,0 +1,5322 @@ +From 8251c225f5c5290fbb8bcc757ae9d4170893083f Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Fri, 10 Mar 2023 09:47:10 +0100 +Subject: [PATCH] basic: add RuntimeScope enum + +In various tools and services we have a per-system and per-user concept. +So far we sometimes used a boolean indicating whether we are in system +mode, or a reversed boolean indicating whether we are in user mode, or +the LookupScope enum used by the lookup path logic. + +Let's address that, in introduce a common enum for this, we can use all +across the board. + +This is mostly just search/replace, no actual code changes. + +(cherry picked from commit 4870133bfaaf97189a970a29bf47e0e38fa721aa) + +Related: RHEL-137252 +--- + src/analyze/analyze-condition.c | 4 +- + src/analyze/analyze-plot.c | 8 +- + src/analyze/analyze-security.c | 50 +-- + src/analyze/analyze-time-data.c | 4 +- + src/analyze/analyze-unit-files.c | 2 +- + src/analyze/analyze-unit-paths.c | 2 +- + src/analyze/analyze-verify-util.c | 9 +- + src/analyze/analyze-verify-util.h | 2 +- + src/analyze/analyze-verify.c | 2 +- + src/analyze/analyze.c | 17 +- + src/analyze/analyze.h | 2 +- + src/basic/meson.build | 1 + + src/basic/path-lookup.c | 82 ++-- + src/basic/path-lookup.h | 17 +- + src/basic/runtime-scope.c | 12 + + src/basic/runtime-scope.h | 17 + + src/busctl/busctl.c | 24 +- + src/cgls/cgls.c | 7 +- + src/core/dbus-manager.c | 28 +- + src/core/dbus-unit.c | 4 +- + src/core/emergency-action.c | 4 +- + src/core/emergency-action.h | 4 +- + src/core/execute.c | 2 +- + src/core/fuzz-unit-file.c | 2 +- + src/core/load-fragment.c | 12 +- + src/core/main.c | 147 ++++--- + src/core/manager.c | 16 +- + src/core/manager.h | 9 +- + src/core/unit-printf.c | 4 +- + src/core/unit.c | 4 +- + src/home/homectl.c | 2 +- + src/hostname/hostnamectl.c | 2 +- + src/libsystemd/sd-bus/bus-internal.h | 7 +- + src/libsystemd/sd-bus/sd-bus.c | 47 +-- + src/libsystemd/sd-path/sd-path.c | 8 +- + src/locale/localectl.c | 2 +- + src/login/loginctl.c | 2 +- + src/machine/machine-dbus.c | 2 +- + src/machine/machinectl.c | 2 +- + src/mount/mount-tool.c | 17 +- + src/portable/portable.c | 12 +- + src/portable/portablectl.c | 2 +- + src/run/run.c | 36 +- + src/shared/bus-util.c | 57 ++- + src/shared/bus-util.h | 5 +- + src/shared/cgroup-show.c | 2 +- + src/shared/install-printf.c | 2 +- + src/shared/install-printf.h | 2 +- + src/shared/install.c | 92 ++--- + src/shared/install.h | 34 +- + src/shared/specifier.c | 24 +- + src/stdio-bridge/stdio-bridge.c | 8 +- + src/systemctl/systemctl-add-dependency.c | 2 +- + src/systemctl/systemctl-edit.c | 12 +- + src/systemctl/systemctl-enable.c | 18 +- + src/systemctl/systemctl-is-enabled.c | 4 +- + src/systemctl/systemctl-list-unit-files.c | 4 +- + src/systemctl/systemctl-preset-all.c | 2 +- + src/systemctl/systemctl-set-default.c | 4 +- + src/systemctl/systemctl-show.c | 2 +- + src/systemctl/systemctl-start-special.c | 4 +- + src/systemctl/systemctl-start-unit.c | 6 +- + src/systemctl/systemctl-sysv-compat.c | 6 +- + src/systemctl/systemctl-util.c | 16 +- + src/systemctl/systemctl.c | 12 +- + src/systemctl/systemctl.h | 2 +- + src/sysv-generator/sysv-generator.c | 4 +- + src/test/test-bpf-firewall.c | 2 +- + src/test/test-bpf-foreign-programs.c | 2 +- + src/test/test-bpf-lsm.c | 2 +- + src/test/test-cgroup-mask.c | 2 +- + src/test/test-cgroup-unit-default.c | 2 +- + src/test/test-emergency-action.c | 40 +- + src/test/test-engine.c | 2 +- + src/test/test-execute.c | 10 +- + src/test/test-install-root.c | 448 +++++++++++----------- + src/test/test-install.c | 72 ++-- + src/test/test-load-fragment.c | 96 ++--- + src/test/test-path-lookup.c | 30 +- + src/test/test-path.c | 2 +- + src/test/test-sched-prio.c | 2 +- + src/test/test-socket-bind.c | 2 +- + src/test/test-specifier.c | 2 +- + src/test/test-unit-file.c | 4 +- + src/test/test-unit-name.c | 2 +- + src/test/test-unit-serialize.c | 2 +- + src/test/test-watch-pid.c | 2 +- + src/timedate/timedatectl.c | 2 +- + src/tmpfiles/tmpfiles.c | 24 +- + 89 files changed, 921 insertions(+), 794 deletions(-) + create mode 100644 src/basic/runtime-scope.c + create mode 100644 src/basic/runtime-scope.h + +diff --git a/src/analyze/analyze-condition.c b/src/analyze/analyze-condition.c +index b29fc0cd71..6da61cd0cf 100644 +--- a/src/analyze/analyze-condition.c ++++ b/src/analyze/analyze-condition.c +@@ -72,7 +72,7 @@ static int log_helper(void *userdata, int level, int error, const char *file, in + return r; + } + +-static int verify_conditions(char **lines, LookupScope scope, const char *unit, const char *root) { ++static int verify_conditions(char **lines, RuntimeScope scope, const char *unit, const char *root) { + _cleanup_(manager_freep) Manager *m = NULL; + Unit *u; + int r, q = 1; +@@ -137,7 +137,7 @@ static int verify_conditions(char **lines, LookupScope scope, const char *unit, + int verb_condition(int argc, char *argv[], void *userdata) { + int r; + +- r = verify_conditions(strv_skip(argv, 1), arg_scope, arg_unit, arg_root); ++ r = verify_conditions(strv_skip(argv, 1), arg_runtime_scope, arg_unit, arg_root); + if (r < 0) + return r; + +diff --git a/src/analyze/analyze-plot.c b/src/analyze/analyze-plot.c +index 151d715c06..01c1a67c8b 100644 +--- a/src/analyze/analyze-plot.c ++++ b/src/analyze/analyze-plot.c +@@ -79,8 +79,8 @@ static int acquire_host_info(sd_bus *bus, HostInfo **hi) { + if (!host) + return log_oom(); + +- if (arg_scope != LOOKUP_SCOPE_SYSTEM) { +- r = bus_connect_transport(arg_transport, arg_host, false, &system_bus); ++ if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) { ++ r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &system_bus); + if (r < 0) { + log_debug_errno(r, "Failed to connect to system bus, ignoring: %m"); + goto manager; +@@ -430,7 +430,7 @@ int verb_plot(int argc, char *argv[], void *userdata) { + _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; + _cleanup_(unit_times_free_arrayp) UnitTimes *times = NULL; + _cleanup_free_ char *pretty_times = NULL; +- bool use_full_bus = arg_scope == LOOKUP_SCOPE_SYSTEM; ++ bool use_full_bus = arg_runtime_scope == RUNTIME_SCOPE_SYSTEM; + BootTimes *boot; + int n, r; + +@@ -446,7 +446,7 @@ int verb_plot(int argc, char *argv[], void *userdata) { + if (n < 0) + return n; + +- if (use_full_bus || arg_scope != LOOKUP_SCOPE_SYSTEM) { ++ if (use_full_bus || arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) { + n = acquire_host_info(bus, &host); + if (n < 0) + return n; +diff --git a/src/analyze/analyze-security.c b/src/analyze/analyze-security.c +index 69eab91bdb..73ee8ed04a 100644 +--- a/src/analyze/analyze-security.c ++++ b/src/analyze/analyze-security.c +@@ -2667,16 +2667,17 @@ static int offline_security_check(Unit *u, + return assess(info, overview_table, flags, threshold, policy, pager_flags, json_format_flags); + } + +-static int offline_security_checks(char **filenames, +- JsonVariant *policy, +- LookupScope scope, +- bool check_man, +- bool run_generators, +- unsigned threshold, +- const char *root, +- const char *profile, +- PagerFlags pager_flags, +- JsonFormatFlags json_format_flags) { ++static int offline_security_checks( ++ char **filenames, ++ JsonVariant *policy, ++ RuntimeScope scope, ++ bool check_man, ++ bool run_generators, ++ unsigned threshold, ++ const char *root, ++ const char *profile, ++ PagerFlags pager_flags, ++ JsonFormatFlags json_format_flags) { + + const ManagerTestRunFlags flags = + MANAGER_TEST_RUN_MINIMAL | +@@ -2781,7 +2782,7 @@ static int offline_security_checks(char **filenames, + static int analyze_security(sd_bus *bus, + char **units, + JsonVariant *policy, +- LookupScope scope, ++ RuntimeScope scope, + bool check_man, + bool run_generators, + bool offline, +@@ -2939,17 +2940,18 @@ int verb_security(int argc, char *argv[], void *userdata) { + } + } + +- return analyze_security(bus, +- strv_skip(argv, 1), +- policy, +- arg_scope, +- arg_man, +- arg_generators, +- arg_offline, +- arg_threshold, +- arg_root, +- arg_profile, +- arg_json_format_flags, +- arg_pager_flags, +- /*flags=*/ 0); ++ return analyze_security( ++ bus, ++ strv_skip(argv, 1), ++ policy, ++ arg_runtime_scope, ++ arg_man, ++ arg_generators, ++ arg_offline, ++ arg_threshold, ++ arg_root, ++ arg_profile, ++ arg_json_format_flags, ++ arg_pager_flags, ++ /*flags=*/ 0); + } +diff --git a/src/analyze/analyze-time-data.c b/src/analyze/analyze-time-data.c +index aa42d69322..07843f74bc 100644 +--- a/src/analyze/analyze-time-data.c ++++ b/src/analyze/analyze-time-data.c +@@ -67,9 +67,9 @@ int acquire_boot_times(sd_bus *bus, BootTimes **ret) { + "Please try again later.\n" + "Hint: Use 'systemctl%s list-jobs' to see active jobs", + times.finish_time, +- arg_scope == LOOKUP_SCOPE_SYSTEM ? "" : " --user"); ++ arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "" : " --user"); + +- if (arg_scope == LOOKUP_SCOPE_SYSTEM && times.security_start_time > 0) { ++ if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM && times.security_start_time > 0) { + /* security_start_time is set when systemd is not running under container environment. */ + if (times.initrd_time > 0) + times.kernel_done_time = times.initrd_time; +diff --git a/src/analyze/analyze-unit-files.c b/src/analyze/analyze-unit-files.c +index ec9be336e1..d9b3313be4 100644 +--- a/src/analyze/analyze-unit-files.c ++++ b/src/analyze/analyze-unit-files.c +@@ -21,7 +21,7 @@ int verb_unit_files(int argc, char *argv[], void *userdata) { + char **v; + int r; + +- r = lookup_paths_init_or_warn(&lp, arg_scope, 0, NULL); ++ r = lookup_paths_init_or_warn(&lp, arg_runtime_scope, 0, NULL); + if (r < 0) + return r; + +diff --git a/src/analyze/analyze-unit-paths.c b/src/analyze/analyze-unit-paths.c +index c2254619bc..bb00a4fcd2 100644 +--- a/src/analyze/analyze-unit-paths.c ++++ b/src/analyze/analyze-unit-paths.c +@@ -9,7 +9,7 @@ int verb_unit_paths(int argc, char *argv[], void *userdata) { + _cleanup_(lookup_paths_free) LookupPaths paths = {}; + int r; + +- r = lookup_paths_init_or_warn(&paths, arg_scope, 0, NULL); ++ r = lookup_paths_init_or_warn(&paths, arg_runtime_scope, 0, NULL); + if (r < 0) + return r; + +diff --git a/src/analyze/analyze-verify-util.c b/src/analyze/analyze-verify-util.c +index a646e5807c..3d4b440c30 100644 +--- a/src/analyze/analyze-verify-util.c ++++ b/src/analyze/analyze-verify-util.c +@@ -248,7 +248,14 @@ static void set_destroy_ignore_pointer_max(Set** s) { + set_free_free(*s); + } + +-int verify_units(char **filenames, LookupScope scope, bool check_man, bool run_generators, RecursiveErrors recursive_errors, const char *root) { ++int verify_units( ++ char **filenames, ++ RuntimeScope scope, ++ bool check_man, ++ bool run_generators, ++ RecursiveErrors recursive_errors, ++ const char *root) { ++ + const ManagerTestRunFlags flags = + MANAGER_TEST_RUN_MINIMAL | + MANAGER_TEST_RUN_ENV_GENERATORS | +diff --git a/src/analyze/analyze-verify-util.h b/src/analyze/analyze-verify-util.h +index 385d635e33..2e3b0604c3 100644 +--- a/src/analyze/analyze-verify-util.h ++++ b/src/analyze/analyze-verify-util.h +@@ -17,7 +17,7 @@ typedef enum RecursiveErrors { + int verify_generate_path(char **var, char **filenames); + int verify_prepare_filename(const char *filename, char **ret); + int verify_executable(Unit *u, const ExecCommand *exec, const char *root); +-int verify_units(char **filenames, LookupScope scope, bool check_man, bool run_generators, RecursiveErrors recursive_errors, const char *root); ++int verify_units(char **filenames, RuntimeScope scope, bool check_man, bool run_generators, RecursiveErrors recursive_errors, const char *root); + + const char* recursive_errors_to_string(RecursiveErrors i) _const_; + RecursiveErrors recursive_errors_from_string(const char *s) _pure_; +diff --git a/src/analyze/analyze-verify.c b/src/analyze/analyze-verify.c +index 35e4e1eb31..98d48f6276 100644 +--- a/src/analyze/analyze-verify.c ++++ b/src/analyze/analyze-verify.c +@@ -66,5 +66,5 @@ int verb_verify(int argc, char *argv[], void *userdata) { + if (r < 0) + return log_error_errno(r, "Couldn't process aliases: %m"); + +- return verify_units(filenames, arg_scope, arg_man, arg_generators, arg_recursive_errors, arg_root); ++ return verify_units(filenames, arg_runtime_scope, arg_man, arg_generators, arg_recursive_errors, arg_root); + } +diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c +index 825c19c6f4..8903d1703d 100644 +--- a/src/analyze/analyze.c ++++ b/src/analyze/analyze.c +@@ -90,7 +90,7 @@ usec_t arg_fuzz = 0; + PagerFlags arg_pager_flags = 0; + BusTransport arg_transport = BUS_TRANSPORT_LOCAL; + const char *arg_host = NULL; +-LookupScope arg_scope = LOOKUP_SCOPE_SYSTEM; ++RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + RecursiveErrors arg_recursive_errors = _RECURSIVE_ERRORS_INVALID; + bool arg_man = true; + bool arg_generators = false; +@@ -117,18 +117,17 @@ STATIC_DESTRUCTOR_REGISTER(arg_unit, freep); + STATIC_DESTRUCTOR_REGISTER(arg_profile, freep); + + int acquire_bus(sd_bus **bus, bool *use_full_bus) { +- bool user = arg_scope != LOOKUP_SCOPE_SYSTEM; + int r; + + if (use_full_bus && *use_full_bus) { +- r = bus_connect_transport(arg_transport, arg_host, user, bus); ++ r = bus_connect_transport(arg_transport, arg_host, arg_runtime_scope, bus); + if (IN_SET(r, 0, -EHOSTDOWN)) + return r; + + *use_full_bus = false; + } + +- return bus_connect_transport_systemd(arg_transport, arg_host, user, bus); ++ return bus_connect_transport_systemd(arg_transport, arg_host, arg_runtime_scope, bus); + } + + int bus_get_unit_property_strv(sd_bus *bus, const char *path, const char *property, char ***strv) { +@@ -365,15 +364,15 @@ static int parse_argv(int argc, char *argv[]) { + break; + + case ARG_SYSTEM: +- arg_scope = LOOKUP_SCOPE_SYSTEM; ++ arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + break; + + case ARG_USER: +- arg_scope = LOOKUP_SCOPE_USER; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + break; + + case ARG_GLOBAL: +- arg_scope = LOOKUP_SCOPE_GLOBAL; ++ arg_runtime_scope = RUNTIME_SCOPE_GLOBAL; + break; + + case ARG_ORDER: +@@ -521,12 +520,12 @@ static int parse_argv(int argc, char *argv[]) { + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Option --threshold= is only supported for security right now."); + +- if (arg_scope == LOOKUP_SCOPE_GLOBAL && ++ if (arg_runtime_scope == RUNTIME_SCOPE_GLOBAL && + !STR_IN_SET(argv[optind] ?: "time", "dot", "unit-paths", "verify")) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Option --global only makes sense with verbs dot, unit-paths, verify."); + +- if (streq_ptr(argv[optind], "cat-config") && arg_scope == LOOKUP_SCOPE_USER) ++ if (streq_ptr(argv[optind], "cat-config") && arg_runtime_scope == RUNTIME_SCOPE_USER) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Option --user is not supported for cat-config right now."); + +diff --git a/src/analyze/analyze.h b/src/analyze/analyze.h +index e4af7b47e0..6f66817e55 100644 +--- a/src/analyze/analyze.h ++++ b/src/analyze/analyze.h +@@ -22,7 +22,7 @@ extern usec_t arg_fuzz; + extern PagerFlags arg_pager_flags; + extern BusTransport arg_transport; + extern const char *arg_host; +-extern LookupScope arg_scope; ++extern RuntimeScope arg_runtime_scope; + extern RecursiveErrors arg_recursive_errors; + extern bool arg_man; + extern bool arg_generators; +diff --git a/src/basic/meson.build b/src/basic/meson.build +index b8b4213c70..79c74c5e4d 100644 +--- a/src/basic/meson.build ++++ b/src/basic/meson.build +@@ -204,6 +204,7 @@ basic_sources = files( + 'replace-var.h', + 'rlimit-util.c', + 'rlimit-util.h', ++ 'runtime-scope.c', + 'set.h', + 'sigbus.c', + 'sigbus.h', +diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c +index 36f386254b..e58d507679 100644 +--- a/src/basic/path-lookup.c ++++ b/src/basic/path-lookup.c +@@ -232,7 +232,7 @@ bool path_is_user_config_dir(const char *path) { + } + + static int acquire_generator_dirs( +- LookupScope scope, ++ RuntimeScope scope, + const char *tempdir, + char **generator, + char **generator_early, +@@ -244,17 +244,17 @@ static int acquire_generator_dirs( + assert(generator); + assert(generator_early); + assert(generator_late); +- assert(IN_SET(scope, LOOKUP_SCOPE_SYSTEM, LOOKUP_SCOPE_USER, LOOKUP_SCOPE_GLOBAL)); ++ assert(IN_SET(scope, RUNTIME_SCOPE_SYSTEM, RUNTIME_SCOPE_USER, RUNTIME_SCOPE_GLOBAL)); + +- if (scope == LOOKUP_SCOPE_GLOBAL) ++ if (scope == RUNTIME_SCOPE_GLOBAL) + return -EOPNOTSUPP; + + if (tempdir) + prefix = tempdir; +- else if (scope == LOOKUP_SCOPE_SYSTEM) ++ else if (scope == RUNTIME_SCOPE_SYSTEM) + prefix = "/run/systemd"; + else { +- /* LOOKUP_SCOPE_USER */ ++ /* RUNTIME_SCOPE_USER */ + const char *e; + + e = getenv("XDG_RUNTIME_DIR"); +@@ -288,21 +288,21 @@ static int acquire_generator_dirs( + } + + static int acquire_transient_dir( +- LookupScope scope, ++ RuntimeScope scope, + const char *tempdir, + char **ret) { + + char *transient; + + assert(ret); +- assert(IN_SET(scope, LOOKUP_SCOPE_SYSTEM, LOOKUP_SCOPE_USER, LOOKUP_SCOPE_GLOBAL)); ++ assert(IN_SET(scope, RUNTIME_SCOPE_SYSTEM, RUNTIME_SCOPE_USER, RUNTIME_SCOPE_GLOBAL)); + +- if (scope == LOOKUP_SCOPE_GLOBAL) ++ if (scope == RUNTIME_SCOPE_GLOBAL) + return -EOPNOTSUPP; + + if (tempdir) + transient = path_join(tempdir, "transient"); +- else if (scope == LOOKUP_SCOPE_SYSTEM) ++ else if (scope == RUNTIME_SCOPE_SYSTEM) + transient = strdup("/run/systemd/transient"); + else + return xdg_user_runtime_dir(ret, "/systemd/transient"); +@@ -313,7 +313,7 @@ static int acquire_transient_dir( + return 0; + } + +-static int acquire_config_dirs(LookupScope scope, char **persistent, char **runtime) { ++static int acquire_config_dirs(RuntimeScope scope, char **persistent, char **runtime) { + _cleanup_free_ char *a = NULL, *b = NULL; + int r; + +@@ -322,17 +322,17 @@ static int acquire_config_dirs(LookupScope scope, char **persistent, char **runt + + switch (scope) { + +- case LOOKUP_SCOPE_SYSTEM: ++ case RUNTIME_SCOPE_SYSTEM: + a = strdup(SYSTEM_CONFIG_UNIT_DIR); + b = strdup("/run/systemd/system"); + break; + +- case LOOKUP_SCOPE_GLOBAL: ++ case RUNTIME_SCOPE_GLOBAL: + a = strdup(USER_CONFIG_UNIT_DIR); + b = strdup("/run/systemd/user"); + break; + +- case LOOKUP_SCOPE_USER: ++ case RUNTIME_SCOPE_USER: + r = xdg_user_config_dir(&a, "/systemd/user"); + if (r < 0 && r != -ENXIO) + return r; +@@ -364,7 +364,7 @@ static int acquire_config_dirs(LookupScope scope, char **persistent, char **runt + return 0; + } + +-static int acquire_control_dirs(LookupScope scope, char **persistent, char **runtime) { ++static int acquire_control_dirs(RuntimeScope scope, char **persistent, char **runtime) { + _cleanup_free_ char *a = NULL; + int r; + +@@ -373,7 +373,7 @@ static int acquire_control_dirs(LookupScope scope, char **persistent, char **run + + switch (scope) { + +- case LOOKUP_SCOPE_SYSTEM: { ++ case RUNTIME_SCOPE_SYSTEM: { + _cleanup_free_ char *b = NULL; + + a = strdup("/etc/systemd/system.control"); +@@ -389,7 +389,7 @@ static int acquire_control_dirs(LookupScope scope, char **persistent, char **run + break; + } + +- case LOOKUP_SCOPE_USER: ++ case RUNTIME_SCOPE_USER: + r = xdg_user_config_dir(&a, "/systemd/user.control"); + if (r < 0 && r != -ENXIO) + return r; +@@ -406,7 +406,7 @@ static int acquire_control_dirs(LookupScope scope, char **persistent, char **run + + break; + +- case LOOKUP_SCOPE_GLOBAL: ++ case RUNTIME_SCOPE_GLOBAL: + return -EOPNOTSUPP; + + default: +@@ -419,7 +419,7 @@ static int acquire_control_dirs(LookupScope scope, char **persistent, char **run + } + + static int acquire_attached_dirs( +- LookupScope scope, ++ RuntimeScope scope, + char **ret_persistent, + char **ret_runtime) { + +@@ -429,7 +429,7 @@ static int acquire_attached_dirs( + assert(ret_runtime); + + /* Portable services are not available to regular users for now. */ +- if (scope != LOOKUP_SCOPE_SYSTEM) ++ if (scope != RUNTIME_SCOPE_SYSTEM) + return -EOPNOTSUPP; + + a = strdup("/etc/systemd/system.attached"); +@@ -509,7 +509,7 @@ static int get_paths_from_environ(const char *var, char ***paths, bool *append) + + int lookup_paths_init( + LookupPaths *lp, +- LookupScope scope, ++ RuntimeScope scope, + LookupPathsFlags flags, + const char *root_dir) { + +@@ -528,14 +528,14 @@ int lookup_paths_init( + + assert(lp); + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + + #if HAVE_SPLIT_USR + flags |= LOOKUP_PATHS_SPLIT_USR; + #endif + + if (!empty_or_root(root_dir)) { +- if (scope == LOOKUP_SCOPE_USER) ++ if (scope == RUNTIME_SCOPE_USER) + return -EINVAL; + + r = is_dir(root_dir, true); +@@ -560,8 +560,8 @@ int lookup_paths_init( + if (r < 0) + return r; + +- if (scope == LOOKUP_SCOPE_USER) { +- r = acquire_config_dirs(LOOKUP_SCOPE_GLOBAL, &global_persistent_config, &global_runtime_config); ++ if (scope == RUNTIME_SCOPE_USER) { ++ r = acquire_config_dirs(RUNTIME_SCOPE_GLOBAL, &global_persistent_config, &global_runtime_config); + if (r < 0) + return r; + } +@@ -606,7 +606,7 @@ int lookup_paths_init( + + switch (scope) { + +- case LOOKUP_SCOPE_SYSTEM: ++ case RUNTIME_SCOPE_SYSTEM: + add = strv_new( + /* If you modify this you also want to modify + * systemdsystemunitpath= in systemd.pc.in! */ +@@ -629,7 +629,7 @@ int lookup_paths_init( + STRV_IFNOTNULL(generator_late)); + break; + +- case LOOKUP_SCOPE_GLOBAL: ++ case RUNTIME_SCOPE_GLOBAL: + add = strv_new( + /* If you modify this you also want to modify + * systemduserunitpath= in systemd.pc.in, and +@@ -652,7 +652,7 @@ int lookup_paths_init( + STRV_IFNOTNULL(generator_late)); + break; + +- case LOOKUP_SCOPE_USER: ++ case RUNTIME_SCOPE_USER: + add = user_dirs(persistent_config, runtime_config, + global_persistent_config, global_runtime_config, + generator, generator_early, generator_late, +@@ -741,7 +741,7 @@ int lookup_paths_init( + return 0; + } + +-int lookup_paths_init_or_warn(LookupPaths *lp, LookupScope scope, LookupPathsFlags flags, const char *root_dir) { ++int lookup_paths_init_or_warn(LookupPaths *lp, RuntimeScope scope, LookupPathsFlags flags, const char *root_dir) { + int r; + + r = lookup_paths_init(lp, scope, flags, root_dir); +@@ -790,7 +790,7 @@ void lookup_paths_log(LookupPaths *lp) { + } + } + +-char **generator_binary_paths(LookupScope scope) { ++char **generator_binary_paths(RuntimeScope scope) { + bool append = false; /* Add items from SYSTEMD_GENERATOR_PATH before normal directories */ + _cleanup_strv_free_ char **paths = NULL; + int r; +@@ -805,15 +805,15 @@ char **generator_binary_paths(LookupScope scope) { + + switch (scope) { + +- case LOOKUP_SCOPE_SYSTEM: ++ case RUNTIME_SCOPE_SYSTEM: + add = strv_new("/run/systemd/system-generators", + "/etc/systemd/system-generators", + "/usr/local/lib/systemd/system-generators", + SYSTEM_GENERATOR_DIR); + break; + +- case LOOKUP_SCOPE_GLOBAL: +- case LOOKUP_SCOPE_USER: ++ case RUNTIME_SCOPE_GLOBAL: ++ case RUNTIME_SCOPE_USER: + add = strv_new("/run/systemd/user-generators", + "/etc/systemd/user-generators", + "/usr/local/lib/systemd/user-generators", +@@ -823,7 +823,6 @@ char **generator_binary_paths(LookupScope scope) { + default: + assert_not_reached(); + } +- + if (!add) + return NULL; + +@@ -840,10 +839,9 @@ char **generator_binary_paths(LookupScope scope) { + return TAKE_PTR(paths); + } + +-char **env_generator_binary_paths(bool is_system) { ++char **env_generator_binary_paths(RuntimeScope runtime_scope) { ++ _cleanup_strv_free_ char **paths = NULL, **add = NULL; + bool append = false; /* Add items from SYSTEMD_ENVIRONMENT_GENERATOR_PATH before normal directories */ +- _cleanup_strv_free_ char **paths = NULL; +- _cleanup_strv_free_ char **add = NULL; + int r; + + /* First priority is whatever has been passed to us via env vars */ +@@ -852,17 +850,25 @@ char **env_generator_binary_paths(bool is_system) { + return NULL; + + if (!paths || append) { +- if (is_system) ++ switch (runtime_scope) { ++ ++ case RUNTIME_SCOPE_SYSTEM: + add = strv_new("/run/systemd/system-environment-generators", + "/etc/systemd/system-environment-generators", + "/usr/local/lib/systemd/system-environment-generators", + SYSTEM_ENV_GENERATOR_DIR); +- else ++ break; ++ ++ case RUNTIME_SCOPE_USER: + add = strv_new("/run/systemd/user-environment-generators", + "/etc/systemd/user-environment-generators", + "/usr/local/lib/systemd/user-environment-generators", + USER_ENV_GENERATOR_DIR); ++ break; + ++ default: ++ assert_not_reached(); ++ } + if (!add) + return NULL; + } +diff --git a/src/basic/path-lookup.h b/src/basic/path-lookup.h +index aed72defe7..fb9fbbb6ce 100644 +--- a/src/basic/path-lookup.h ++++ b/src/basic/path-lookup.h +@@ -5,6 +5,7 @@ + + #include "def.h" + #include "macro.h" ++#include "runtime-scope.h" + + typedef enum LookupPathsFlags { + LOOKUP_PATHS_EXCLUDE_GENERATED = 1 << 0, +@@ -12,14 +13,6 @@ typedef enum LookupPathsFlags { + LOOKUP_PATHS_SPLIT_USR = 1 << 2, + } LookupPathsFlags; + +-typedef enum LookupScope { +- LOOKUP_SCOPE_SYSTEM, +- LOOKUP_SCOPE_GLOBAL, +- LOOKUP_SCOPE_USER, +- _LOOKUP_SCOPE_MAX, +- _LOOKUP_SCOPE_INVALID = -EINVAL, +-} LookupScope; +- + typedef struct LookupPaths { + /* Where we look for unit files. This includes the individual special paths below, but also any vendor + * supplied, static unit file paths. */ +@@ -59,8 +52,8 @@ typedef struct LookupPaths { + char *temporary_dir; + } LookupPaths; + +-int lookup_paths_init(LookupPaths *lp, LookupScope scope, LookupPathsFlags flags, const char *root_dir); +-int lookup_paths_init_or_warn(LookupPaths *lp, LookupScope scope, LookupPathsFlags flags, const char *root_dir); ++int lookup_paths_init(LookupPaths *lp, RuntimeScope scope, LookupPathsFlags flags, const char *root_dir); ++int lookup_paths_init_or_warn(LookupPaths *lp, RuntimeScope scope, LookupPathsFlags flags, const char *root_dir); + + int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs); + int xdg_user_runtime_dir(char **ret, const char *suffix); +@@ -73,8 +66,8 @@ bool path_is_user_config_dir(const char *path); + void lookup_paths_log(LookupPaths *p); + void lookup_paths_free(LookupPaths *p); + +-char **generator_binary_paths(LookupScope scope); +-char **env_generator_binary_paths(bool is_system); ++char **generator_binary_paths(RuntimeScope scope); ++char **env_generator_binary_paths(RuntimeScope scope); + + #define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network")) + #define NETWORK_DIRS_NULSTR CONF_PATHS_NULSTR("systemd/network") +diff --git a/src/basic/runtime-scope.c b/src/basic/runtime-scope.c +new file mode 100644 +index 0000000000..88afb53d0b +--- /dev/null ++++ b/src/basic/runtime-scope.c +@@ -0,0 +1,12 @@ ++/* SPDX-License-Identifier: LGPL-2.1-or-later */ ++ ++#include "runtime-scope.h" ++#include "string-table.h" ++ ++static const char* const runtime_scope_table[_RUNTIME_SCOPE_MAX] = { ++ [RUNTIME_SCOPE_SYSTEM] = "system", ++ [RUNTIME_SCOPE_USER] = "user", ++ [RUNTIME_SCOPE_GLOBAL] = "global", ++}; ++ ++DEFINE_STRING_TABLE_LOOKUP(runtime_scope, RuntimeScope); +diff --git a/src/basic/runtime-scope.h b/src/basic/runtime-scope.h +new file mode 100644 +index 0000000000..6a7f9e65d4 +--- /dev/null ++++ b/src/basic/runtime-scope.h +@@ -0,0 +1,17 @@ ++/* SPDX-License-Identifier: LGPL-2.1-or-later */ ++#pragma once ++ ++#include ++ ++#include "macro.h" ++ ++typedef enum RuntimeScope { ++ RUNTIME_SCOPE_SYSTEM, /* for the system */ ++ RUNTIME_SCOPE_USER, /* for a user */ ++ RUNTIME_SCOPE_GLOBAL, /* for all users */ ++ _RUNTIME_SCOPE_MAX, ++ _RUNTIME_SCOPE_INVALID = -EINVAL, ++} RuntimeScope; ++ ++const char *runtime_scope_to_string(RuntimeScope scope) _const_; ++RuntimeScope runtime_scope_from_string(const char *s) _const_; +diff --git a/src/busctl/busctl.c b/src/busctl/busctl.c +index 901b0e15f6..c7273ad51f 100644 +--- a/src/busctl/busctl.c ++++ b/src/busctl/busctl.c +@@ -26,6 +26,7 @@ + #include "parse-util.h" + #include "path-util.h" + #include "pretty-print.h" ++#include "runtime-scope.h" + #include "set.h" + #include "sort-util.h" + #include "strv.h" +@@ -46,7 +47,7 @@ static bool arg_show_machine = false; + static char **arg_matches = NULL; + static BusTransport arg_transport = BUS_TRANSPORT_LOCAL; + static const char *arg_host = NULL; +-static bool arg_user = false; ++static RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + static size_t arg_snaplen = 4096; + static bool arg_list = false; + static bool arg_quiet = false; +@@ -108,10 +109,21 @@ static int acquire_bus(bool set_monitor, sd_bus **ret) { + switch (arg_transport) { + + case BUS_TRANSPORT_LOCAL: +- if (arg_user) ++ ++ switch (arg_runtime_scope) { ++ ++ case RUNTIME_SCOPE_USER: + r = bus_set_address_user(bus); +- else ++ break; ++ ++ case RUNTIME_SCOPE_SYSTEM: + r = bus_set_address_system(bus); ++ break; ++ ++ default: ++ assert_not_reached(); ++ } ++ + break; + + case BUS_TRANSPORT_REMOTE: +@@ -119,7 +131,7 @@ static int acquire_bus(bool set_monitor, sd_bus **ret) { + break; + + case BUS_TRANSPORT_MACHINE: +- r = bus_set_address_machine(bus, arg_user, arg_host); ++ r = bus_set_address_machine(bus, arg_runtime_scope, arg_host); + break; + + default: +@@ -2404,11 +2416,11 @@ static int parse_argv(int argc, char *argv[]) { + break; + + case ARG_USER: +- arg_user = true; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + break; + + case ARG_SYSTEM: +- arg_user = false; ++ arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + break; + + case ARG_ADDRESS: +diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c +index 6af95204e3..48034104cc 100644 +--- a/src/cgls/cgls.c ++++ b/src/cgls/cgls.c +@@ -215,9 +215,10 @@ static int run(int argc, char *argv[]) { + + if (!bus) { + /* Connect to the bus only if necessary */ +- r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, +- arg_show_unit == SHOW_UNIT_USER, +- &bus); ++ r = bus_connect_transport_systemd( ++ BUS_TRANSPORT_LOCAL, NULL, ++ arg_show_unit == SHOW_UNIT_USER ? RUNTIME_SCOPE_USER : RUNTIME_SCOPE_SYSTEM, ++ &bus); + if (r < 0) + return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL); + } +diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c +index 386b319c86..3f62b30745 100644 +--- a/src/core/dbus-manager.c ++++ b/src/core/dbus-manager.c +@@ -2073,7 +2073,7 @@ static int list_unit_files_by_patterns(sd_bus_message *message, void *userdata, + if (!h) + return -ENOMEM; + +- r = unit_file_get_list(m->unit_file_scope, NULL, h, states, patterns); ++ r = unit_file_get_list(m->runtime_scope, NULL, h, states, patterns); + if (r < 0) + goto fail; + +@@ -2139,7 +2139,7 @@ static int method_get_unit_file_state(sd_bus_message *message, void *userdata, s + if (r < 0) + return r; + +- r = unit_file_get_state(m->unit_file_scope, NULL, name, &state); ++ r = unit_file_get_state(m->runtime_scope, NULL, name, &state); + if (r < 0) + return r; + +@@ -2159,7 +2159,7 @@ static int method_get_default_target(sd_bus_message *message, void *userdata, sd + if (r < 0) + return r; + +- r = unit_file_get_default(m->unit_file_scope, NULL, &default_target); ++ r = unit_file_get_default(m->runtime_scope, NULL, &default_target); + if (r < 0) + return r; + +@@ -2353,7 +2353,7 @@ fail: + static int method_enable_unit_files_generic( + sd_bus_message *message, + Manager *m, +- int (*call)(LookupScope scope, UnitFileFlags flags, const char *root_dir, char *files[], InstallChange **changes, size_t *n_changes), ++ int (*call)(RuntimeScope scope, UnitFileFlags flags, const char *root_dir, char *files[], InstallChange **changes, size_t *n_changes), + bool carries_install_info, + sd_bus_error *error) { + +@@ -2394,7 +2394,7 @@ static int method_enable_unit_files_generic( + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + +- r = call(m->unit_file_scope, flags, NULL, l, &changes, &n_changes); ++ r = call(m->runtime_scope, flags, NULL, l, &changes, &n_changes); + if (r < 0) + return install_error(error, r, changes, n_changes); + +@@ -2417,7 +2417,7 @@ static int method_link_unit_files(sd_bus_message *message, void *userdata, sd_bu + return method_enable_unit_files_generic(message, userdata, unit_file_link, false, error); + } + +-static int unit_file_preset_without_mode(LookupScope scope, UnitFileFlags flags, const char *root_dir, char **files, InstallChange **changes, size_t *n_changes) { ++static int unit_file_preset_without_mode(RuntimeScope scope, UnitFileFlags flags, const char *root_dir, char **files, InstallChange **changes, size_t *n_changes) { + return unit_file_preset(scope, flags, root_dir, files, UNIT_FILE_PRESET_FULL, changes, n_changes); + } + +@@ -2466,7 +2466,7 @@ static int method_preset_unit_files_with_mode(sd_bus_message *message, void *use + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + +- r = unit_file_preset(m->unit_file_scope, flags, NULL, l, preset_mode, &changes, &n_changes); ++ r = unit_file_preset(m->runtime_scope, flags, NULL, l, preset_mode, &changes, &n_changes); + if (r < 0) + return install_error(error, r, changes, n_changes); + +@@ -2476,7 +2476,7 @@ static int method_preset_unit_files_with_mode(sd_bus_message *message, void *use + static int method_disable_unit_files_generic( + sd_bus_message *message, + Manager *m, +- int (*call)(LookupScope scope, UnitFileFlags flags, const char *root_dir, char *files[], InstallChange **changes, size_t *n_changes), ++ int (*call)(RuntimeScope scope, UnitFileFlags flags, const char *root_dir, char *files[], InstallChange **changes, size_t *n_changes), + bool carries_install_info, + sd_bus_error *error) { + +@@ -2519,7 +2519,7 @@ static int method_disable_unit_files_generic( + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + +- r = call(m->unit_file_scope, flags, NULL, l, &changes, &n_changes); ++ r = call(m->runtime_scope, flags, NULL, l, &changes, &n_changes); + if (r < 0) + return install_error(error, r, changes, n_changes); + +@@ -2561,7 +2561,7 @@ static int method_revert_unit_files(sd_bus_message *message, void *userdata, sd_ + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + +- r = unit_file_revert(m->unit_file_scope, NULL, l, &changes, &n_changes); ++ r = unit_file_revert(m->runtime_scope, NULL, l, &changes, &n_changes); + if (r < 0) + return install_error(error, r, changes, n_changes); + +@@ -2591,7 +2591,7 @@ static int method_set_default_target(sd_bus_message *message, void *userdata, sd + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + +- r = unit_file_set_default(m->unit_file_scope, force ? UNIT_FILE_FORCE : 0, NULL, name, &changes, &n_changes); ++ r = unit_file_set_default(m->runtime_scope, force ? UNIT_FILE_FORCE : 0, NULL, name, &changes, &n_changes); + if (r < 0) + return install_error(error, r, changes, n_changes); + +@@ -2633,7 +2633,7 @@ static int method_preset_all_unit_files(sd_bus_message *message, void *userdata, + if (r == 0) + return 1; /* No authorization for now, but the async polkit stuff will call us again when it has it */ + +- r = unit_file_preset_all(m->unit_file_scope, flags, NULL, preset_mode, &changes, &n_changes); ++ r = unit_file_preset_all(m->runtime_scope, flags, NULL, preset_mode, &changes, &n_changes); + if (r < 0) + return install_error(error, r, changes, n_changes); + +@@ -2672,7 +2672,7 @@ static int method_add_dependency_unit_files(sd_bus_message *message, void *userd + if (dep < 0) + return -EINVAL; + +- r = unit_file_add_dependency(m->unit_file_scope, flags, NULL, l, target, dep, &changes, &n_changes); ++ r = unit_file_add_dependency(m->runtime_scope, flags, NULL, l, target, dep, &changes, &n_changes); + if (r < 0) + return install_error(error, r, changes, n_changes); + +@@ -2699,7 +2699,7 @@ static int method_get_unit_file_links(sd_bus_message *message, void *userdata, s + if (r < 0) + return r; + +- r = unit_file_disable(m->unit_file_scope, ++ r = unit_file_disable(m->runtime_scope, + UNIT_FILE_DRY_RUN | (runtime ? UNIT_FILE_RUNTIME : 0), + NULL, STRV_MAKE(name), &changes, &n_changes); + if (r < 0) { +diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c +index 22a29ba0cb..c9104308ca 100644 +--- a/src/core/dbus-unit.c ++++ b/src/core/dbus-unit.c +@@ -2012,7 +2012,6 @@ static int bus_set_transient_emergency_action( + const char *s; + EmergencyAction v; + int r; +- bool system; + + assert(p); + +@@ -2020,8 +2019,7 @@ static int bus_set_transient_emergency_action( + if (r < 0) + return r; + +- system = MANAGER_IS_SYSTEM(u->manager); +- r = parse_emergency_action(s, system, &v); ++ r = parse_emergency_action(s, u->manager->runtime_scope, &v); + if (r < 0) + return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, + r == -EOPNOTSUPP ? "%s setting invalid for manager type: %s" +diff --git a/src/core/emergency-action.c b/src/core/emergency-action.c +index 0234772b95..5b9ec75922 100644 +--- a/src/core/emergency-action.c ++++ b/src/core/emergency-action.c +@@ -154,7 +154,7 @@ DEFINE_STRING_TABLE_LOOKUP(emergency_action, EmergencyAction); + + int parse_emergency_action( + const char *value, +- bool system, ++ RuntimeScope runtime_scope, + EmergencyAction *ret) { + + EmergencyAction x; +@@ -163,7 +163,7 @@ int parse_emergency_action( + if (x < 0) + return -EINVAL; + +- if (!system && x != EMERGENCY_ACTION_NONE && x < _EMERGENCY_ACTION_FIRST_USER_ACTION) ++ if (runtime_scope != RUNTIME_SCOPE_SYSTEM && x != EMERGENCY_ACTION_NONE && x < _EMERGENCY_ACTION_FIRST_USER_ACTION) + return -EOPNOTSUPP; + + *ret = x; +diff --git a/src/core/emergency-action.h b/src/core/emergency-action.h +index 4d7e755ae1..89a1dead23 100644 +--- a/src/core/emergency-action.h ++++ b/src/core/emergency-action.h +@@ -3,6 +3,8 @@ + + #include + ++#include "runtime-scope.h" ++ + typedef enum EmergencyAction { + EMERGENCY_ACTION_NONE, + EMERGENCY_ACTION_REBOOT, +@@ -33,4 +35,4 @@ void emergency_action(Manager *m, + const char* emergency_action_to_string(EmergencyAction i) _const_; + EmergencyAction emergency_action_from_string(const char *s) _pure_; + +-int parse_emergency_action(const char *value, bool system, EmergencyAction *ret); ++int parse_emergency_action(const char *value, RuntimeScope runtime_scope, EmergencyAction *ret); +diff --git a/src/core/execute.c b/src/core/execute.c +index 13222ddea3..35f8ccf770 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -4261,7 +4261,7 @@ static int exec_child( + * invocations themselves. Also note that while we'll only invoke NSS modules involved in user management they + * might internally call into other NSS modules that are involved in hostname resolution, we never know. */ + if (setenv("SYSTEMD_ACTIVATION_UNIT", unit->id, true) != 0 || +- setenv("SYSTEMD_ACTIVATION_SCOPE", MANAGER_IS_SYSTEM(unit->manager) ? "system" : "user", true) != 0) { ++ setenv("SYSTEMD_ACTIVATION_SCOPE", runtime_scope_to_string(unit->manager->runtime_scope), true) != 0) { + *exit_status = EXIT_MEMORY; + return log_unit_error_errno(unit, errno, "Failed to update environment: %m"); + } +diff --git a/src/core/fuzz-unit-file.c b/src/core/fuzz-unit-file.c +index 7b393386ff..8e0ace2540 100644 +--- a/src/core/fuzz-unit-file.c ++++ b/src/core/fuzz-unit-file.c +@@ -66,7 +66,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + if (!getenv("SYSTEMD_LOG_LEVEL")) + log_set_max_level(LOG_CRIT); + +- assert_se(manager_new(LOOKUP_SCOPE_SYSTEM, MANAGER_TEST_RUN_MINIMAL, &m) >= 0); ++ assert_se(manager_new(RUNTIME_SCOPE_SYSTEM, MANAGER_TEST_RUN_MINIMAL, &m) >= 0); + + name = strjoina("a.", unit_type_to_string(t)); + assert_se(unit_new_for_name(m, unit_vtable[t]->object_size, name, &u) >= 0); +diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c +index 26f42a9cf6..2699ccf6ef 100644 +--- a/src/core/load-fragment.c ++++ b/src/core/load-fragment.c +@@ -5577,8 +5577,8 @@ int config_parse_emergency_action( + void *data, + void *userdata) { + +- Manager *m = NULL; + EmergencyAction *x = ASSERT_PTR(data); ++ RuntimeScope runtime_scope; + int r; + + assert(filename); +@@ -5586,13 +5586,13 @@ int config_parse_emergency_action( + assert(rvalue); + + if (unit) +- m = ((Unit*) userdata)->manager; ++ runtime_scope = ((Unit*) ASSERT_PTR(userdata))->manager->runtime_scope; + else +- m = data; ++ runtime_scope = ltype; /* otherwise, assume the scope is passed in via ltype */ + +- r = parse_emergency_action(rvalue, MANAGER_IS_SYSTEM(m), x); ++ r = parse_emergency_action(rvalue, runtime_scope, x); + if (r < 0) { +- if (r == -EOPNOTSUPP && MANAGER_IS_USER(m)) { ++ if (r == -EOPNOTSUPP && runtime_scope == RUNTIME_SCOPE_USER) { + /* Compat mode: remove for systemd 241. */ + + log_syntax(unit, LOG_INFO, filename, line, r, +@@ -5605,7 +5605,7 @@ int config_parse_emergency_action( + if (r == -EOPNOTSUPP) + log_syntax(unit, LOG_WARNING, filename, line, r, + "%s= specified as %s mode action, ignoring: %s", +- lvalue, MANAGER_IS_SYSTEM(m) ? "user" : "system", rvalue); ++ lvalue, runtime_scope_to_string(runtime_scope), rvalue); + else + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to parse %s=, ignoring: %s", lvalue, rvalue); +diff --git a/src/core/main.c b/src/core/main.c +index 2eba3a3c50..3ef613a8b1 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -118,7 +118,7 @@ static const char *arg_bus_introspect = NULL; + /* Those variables are initialized to 0 automatically, so we avoid uninitialized memory access. Real + * defaults are assigned in reset_arguments() below. */ + static char *arg_default_unit; +-static bool arg_system; ++static RuntimeScope arg_runtime_scope; + bool arg_dump_core; + int arg_crash_chvt; + bool arg_crash_shell; +@@ -634,8 +634,8 @@ static int parse_config_file(void) { + { "Manager", "DefaultStartLimitInterval", config_parse_sec, 0, &arg_default_start_limit_interval }, /* obsolete alias */ + { "Manager", "DefaultStartLimitIntervalSec", config_parse_sec, 0, &arg_default_start_limit_interval }, + { "Manager", "DefaultStartLimitBurst", config_parse_unsigned, 0, &arg_default_start_limit_burst }, +- { "Manager", "DefaultEnvironment", config_parse_environ, 0, &arg_default_environment }, +- { "Manager", "ManagerEnvironment", config_parse_environ, 0, &arg_manager_environment }, ++ { "Manager", "DefaultEnvironment", config_parse_environ, arg_runtime_scope, &arg_default_environment }, ++ { "Manager", "ManagerEnvironment", config_parse_environ, arg_runtime_scope, &arg_manager_environment }, + { "Manager", "DefaultLimitCPU", config_parse_rlimit, RLIMIT_CPU, arg_default_rlimit }, + { "Manager", "DefaultLimitFSIZE", config_parse_rlimit, RLIMIT_FSIZE, arg_default_rlimit }, + { "Manager", "DefaultLimitDATA", config_parse_rlimit, RLIMIT_DATA, arg_default_rlimit }, +@@ -659,7 +659,7 @@ static int parse_config_file(void) { + { "Manager", "DefaultMemoryAccounting", config_parse_bool, 0, &arg_default_memory_accounting }, + { "Manager", "DefaultTasksAccounting", config_parse_bool, 0, &arg_default_tasks_accounting }, + { "Manager", "DefaultTasksMax", config_parse_tasks_max, 0, &arg_default_tasks_max }, +- { "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, 0, &arg_cad_burst_action }, ++ { "Manager", "CtrlAltDelBurstAction", config_parse_emergency_action, arg_runtime_scope, &arg_cad_burst_action }, + { "Manager", "DefaultOOMPolicy", config_parse_oom_policy, 0, &arg_default_oom_policy }, + { "Manager", "DefaultOOMScoreAdjust", config_parse_oom_score_adjust, 0, NULL }, + #if ENABLE_SMACK +@@ -674,9 +674,11 @@ static int parse_config_file(void) { + const char *suffix; + int r; + +- if (arg_system) ++ if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM) + suffix = "system.conf.d"; + else { ++ assert(arg_runtime_scope == RUNTIME_SCOPE_USER); ++ + r = manager_find_user_config_paths(&files, &dirs); + if (r < 0) + return log_error_errno(r, "Failed to determine config file paths: %m"); +@@ -922,11 +924,11 @@ static int parse_argv(int argc, char *argv[]) { + break; + + case ARG_SYSTEM: +- arg_system = true; ++ arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + break; + + case ARG_USER: +- arg_system = false; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + user_arg_seen = true; + break; + +@@ -1067,7 +1069,7 @@ static int parse_argv(int argc, char *argv[]) { + /* Hmm, when we aren't run as init system let's complain about excess arguments */ + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Excess arguments."); + +- if (arg_action == ACTION_RUN && !arg_system && !user_arg_seen) ++ if (arg_action == ACTION_RUN && arg_runtime_scope == RUNTIME_SCOPE_USER && !user_arg_seen) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Explicit --user argument required to run as user manager."); + +@@ -1819,7 +1821,7 @@ static int do_reexecute( + * we get weird stuff from the kernel cmdline (like --) */ + if (switch_root_dir) + args[i++] = "--switched-root"; +- args[i++] = arg_system ? "--system" : "--user"; ++ args[i++] = arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "--system" : "--user"; + args[i++] = "--deserialize"; + args[i++] = sfd; + +@@ -2050,10 +2052,13 @@ static int invoke_main_loop( + + static void log_execution_mode(bool *ret_first_boot) { + bool first_boot = false; ++ int r; + + assert(ret_first_boot); + +- if (arg_system) { ++ switch (arg_runtime_scope) { ++ ++ case RUNTIME_SCOPE_SYSTEM: { + struct utsname uts; + int v; + +@@ -2074,7 +2079,6 @@ static void log_execution_mode(bool *ret_first_boot) { + if (in_initrd()) + log_info("Running in initrd."); + else { +- int r; + _cleanup_free_ char *id_text = NULL; + + /* Let's check whether we are in first boot. First, check if an override was +@@ -2115,7 +2119,11 @@ static void log_execution_mode(bool *ret_first_boot) { + "Your mileage may vary.", uts.release, KERNEL_BASELINE_VERSION); + else + log_debug("Kernel version %s, our baseline is %s", uts.release, KERNEL_BASELINE_VERSION); +- } else { ++ ++ break; ++ } ++ ++ case RUNTIME_SCOPE_USER: + if (DEBUG_LOGGING) { + _cleanup_free_ char *t = NULL; + +@@ -2124,6 +2132,11 @@ static void log_execution_mode(bool *ret_first_boot) { + arg_action == ACTION_TEST ? " test" : "", + getuid(), strna(t), systemd_features); + } ++ ++ break; ++ ++ default: ++ assert_not_reached(); + } + + *ret_first_boot = first_boot; +@@ -2152,7 +2165,9 @@ static int initialize_runtime( + update_cpu_affinity(skip_setup); + update_numa_policy(skip_setup); + +- if (arg_system) { ++ switch (arg_runtime_scope) { ++ ++ case RUNTIME_SCOPE_SYSTEM: + /* Make sure we leave a core dump without panicking the kernel. */ + install_crash_handler(); + +@@ -2177,7 +2192,10 @@ static int initialize_runtime( + r = watchdog_set_device(arg_watchdog_device); + if (r < 0) + log_warning_errno(r, "Failed to set watchdog device to %s, ignoring: %m", arg_watchdog_device); +- } else { ++ ++ break; ++ ++ case RUNTIME_SCOPE_USER: { + _cleanup_free_ char *p = NULL; + + /* Create the runtime directory and place the inaccessible device nodes there, if we run in +@@ -2191,30 +2209,38 @@ static int initialize_runtime( + + (void) mkdir_p_label(p, 0755); + (void) make_inaccessible_nodes(p, UID_INVALID, GID_INVALID); ++ break; ++ } ++ ++ default: ++ assert_not_reached(); + } + + if (arg_timer_slack_nsec != NSEC_INFINITY) + if (prctl(PR_SET_TIMERSLACK, arg_timer_slack_nsec) < 0) + log_warning_errno(errno, "Failed to adjust timer slack, ignoring: %m"); + +- if (arg_system && !cap_test_all(arg_capability_bounding_set)) { +- r = capability_bounding_set_drop_usermode(arg_capability_bounding_set); +- if (r < 0) { +- *ret_error_message = "Failed to drop capability bounding set of usermode helpers"; +- return log_emergency_errno(r, "Failed to drop capability bounding set of usermode helpers: %m"); +- } ++ if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM) { + +- r = capability_bounding_set_drop(arg_capability_bounding_set, true); +- if (r < 0) { +- *ret_error_message = "Failed to drop capability bounding set"; +- return log_emergency_errno(r, "Failed to drop capability bounding set: %m"); ++ if (!cap_test_all(arg_capability_bounding_set)) { ++ r = capability_bounding_set_drop_usermode(arg_capability_bounding_set); ++ if (r < 0) { ++ *ret_error_message = "Failed to drop capability bounding set of usermode helpers"; ++ return log_emergency_errno(r, "Failed to drop capability bounding set of usermode helpers: %m"); ++ } ++ ++ r = capability_bounding_set_drop(arg_capability_bounding_set, true); ++ if (r < 0) { ++ *ret_error_message = "Failed to drop capability bounding set"; ++ return log_emergency_errno(r, "Failed to drop capability bounding set: %m"); ++ } + } +- } + +- if (arg_system && arg_no_new_privs) { +- if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) { +- *ret_error_message = "Failed to disable new privileges"; +- return log_emergency_errno(errno, "Failed to disable new privileges: %m"); ++ if (arg_no_new_privs) { ++ if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) < 0) { ++ *ret_error_message = "Failed to disable new privileges"; ++ return log_emergency_errno(errno, "Failed to disable new privileges: %m"); ++ } + } + } + +@@ -2226,7 +2252,7 @@ static int initialize_runtime( + } + } + +- if (!arg_system) ++ if (arg_runtime_scope == RUNTIME_SCOPE_USER) + /* Become reaper of our children */ + if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) + log_warning_errno(errno, "Failed to make us a subreaper, ignoring: %m"); +@@ -2236,7 +2262,7 @@ static int initialize_runtime( + (void) bump_rlimit_memlock(saved_rlimit_memlock); + + /* Pull credentials from various sources into a common credential directory */ +- if (arg_system && !skip_setup) ++ if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM && !skip_setup) + (void) import_credentials(); + + return 0; +@@ -2348,7 +2374,7 @@ static void fallback_rlimit_nofile(const struct rlimit *saved_rlimit_nofile) { + * (and thus use poll()/epoll instead of select(), the way everybody should) can + * explicitly opt into high fds by bumping their soft limit beyond 1024, to the hard limit + * we pass. */ +- if (arg_system) { ++ if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM) { + int nr; + + /* Get the underlying absolute limit the kernel enforces */ +@@ -2379,7 +2405,7 @@ static void fallback_rlimit_memlock(const struct rlimit *saved_rlimit_memlock) { + return; + } + +- if (arg_system) { ++ if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM) { + /* Raise the default limit to 8M also on old kernels and in containers (8M is the kernel + * default for this since kernel 5.16) */ + rl->rlim_max = MAX(rl->rlim_max, (rlim_t) DEFAULT_RLIMIT_MEMLOCK); +@@ -2406,7 +2432,7 @@ static void reset_arguments(void) { + + arg_default_unit = mfree(arg_default_unit); + +- /* arg_system — ignore */ ++ /* arg_runtime_scope — ignore */ + + arg_dump_core = true; + arg_crash_chvt = -1; +@@ -2512,7 +2538,7 @@ static int parse_configuration(const struct rlimit *saved_rlimit_nofile, + if (r < 0) + log_warning_errno(r, "Failed to parse config file, ignoring: %m"); + +- if (arg_system) { ++ if (arg_runtime_scope == RUNTIME_SCOPE_SYSTEM) { + r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, 0); + if (r < 0) + log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m"); +@@ -2549,12 +2575,12 @@ static int safety_checks(void) { + "Unsupported execution mode while PID 1."); + + if (getpid_cached() == 1 && +- !arg_system) ++ arg_runtime_scope == RUNTIME_SCOPE_USER) + return log_error_errno(SYNTHETIC_ERRNO(EPERM), + "Can't run --user mode as PID 1."); + + if (arg_action == ACTION_RUN && +- arg_system && ++ arg_runtime_scope == RUNTIME_SCOPE_SYSTEM && + getpid_cached() != 1) + return log_error_errno(SYNTHETIC_ERRNO(EPERM), + "Can't run system mode unless PID 1."); +@@ -2564,23 +2590,32 @@ static int safety_checks(void) { + return log_error_errno(SYNTHETIC_ERRNO(EPERM), + "Don't run test mode as root."); + +- if (!arg_system && +- arg_action == ACTION_RUN && +- sd_booted() <= 0) +- return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), +- "Trying to run as user instance, but the system has not been booted with systemd."); ++ switch (arg_runtime_scope) { ++ ++ case RUNTIME_SCOPE_USER: ++ ++ if (arg_action == ACTION_RUN && ++ sd_booted() <= 0) ++ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), ++ "Trying to run as user instance, but the system has not been booted with systemd."); + +- if (!arg_system && +- arg_action == ACTION_RUN && +- !getenv("XDG_RUNTIME_DIR")) +- return log_error_errno(SYNTHETIC_ERRNO(EUNATCH), +- "Trying to run as user instance, but $XDG_RUNTIME_DIR is not set."); ++ if (arg_action == ACTION_RUN && ++ !getenv("XDG_RUNTIME_DIR")) ++ return log_error_errno(SYNTHETIC_ERRNO(EUNATCH), ++ "Trying to run as user instance, but $XDG_RUNTIME_DIR is not set."); ++ ++ break; + +- if (arg_system && +- arg_action == ACTION_RUN && +- running_in_chroot() > 0) +- return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), +- "Cannot be run in a chroot() environment."); ++ case RUNTIME_SCOPE_SYSTEM: ++ if (arg_action == ACTION_RUN && ++ running_in_chroot() > 0) ++ return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP), ++ "Cannot be run in a chroot() environment."); ++ break; ++ ++ default: ++ assert_not_reached(); ++ } + + return 0; + } +@@ -2650,7 +2685,7 @@ static int collect_fds(FDSet **ret_fds, const char **ret_error_message) { + + static void setup_console_terminal(bool skip_setup) { + +- if (!arg_system) ++ if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + return; + + /* Become a session leader if we aren't one yet. */ +@@ -2748,7 +2783,7 @@ int main(int argc, char *argv[]) { + + if (getpid_cached() == 1) { + /* When we run as PID 1 force system mode */ +- arg_system = true; ++ arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + + /* Disable the umask logic */ + umask(0); +@@ -2857,7 +2892,7 @@ int main(int argc, char *argv[]) { + (void) cache_efi_options_variable(); + } else { + /* Running as user instance */ +- arg_system = false; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + log_set_always_reopen_console(true); + log_set_target(LOG_TARGET_AUTO); + log_open(); +@@ -2964,7 +2999,7 @@ int main(int argc, char *argv[]) { + if (r < 0) + goto finish; + +- r = manager_new(arg_system ? LOOKUP_SCOPE_SYSTEM : LOOKUP_SCOPE_USER, ++ r = manager_new(arg_runtime_scope, + arg_action == ACTION_TEST ? MANAGER_TEST_FULL : 0, + &m); + if (r < 0) { +diff --git a/src/core/manager.c b/src/core/manager.c +index 653b0c2d22..a5337594f7 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -812,19 +812,19 @@ void manager_set_switching_root(Manager *m, bool switching_root) { + m->switching_root = MANAGER_IS_SYSTEM(m) && switching_root; + } + +-int manager_new(LookupScope scope, ManagerTestRunFlags test_run_flags, Manager **_m) { ++int manager_new(RuntimeScope runtime_scope, ManagerTestRunFlags test_run_flags, Manager **_m) { + _cleanup_(manager_freep) Manager *m = NULL; + int r; + + assert(_m); +- assert(IN_SET(scope, LOOKUP_SCOPE_SYSTEM, LOOKUP_SCOPE_USER)); ++ assert(IN_SET(runtime_scope, RUNTIME_SCOPE_SYSTEM, RUNTIME_SCOPE_USER)); + + m = new(Manager, 1); + if (!m) + return -ENOMEM; + + *m = (Manager) { +- .unit_file_scope = scope, ++ .runtime_scope = runtime_scope, + .objective = _MANAGER_OBJECTIVE_INVALID, + + .status_unit_format = STATUS_UNIT_FORMAT_DEFAULT, +@@ -1751,7 +1751,7 @@ static void manager_preset_all(Manager *m) { + /* If this is the first boot, and we are in the host system, then preset everything */ + UnitFilePresetMode mode = FIRST_BOOT_FULL_PRESET ? UNIT_FILE_PRESET_FULL : UNIT_FILE_PRESET_ENABLE_ONLY; + +- r = unit_file_preset_all(LOOKUP_SCOPE_SYSTEM, 0, NULL, mode, NULL, 0); ++ r = unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, 0, NULL, mode, NULL, 0); + if (r < 0) + log_full_errno(r == -EEXIST ? LOG_NOTICE : LOG_WARNING, r, + "Failed to populate /etc with preset unit settings, ignoring: %m"); +@@ -1800,7 +1800,7 @@ int manager_startup(Manager *m, FILE *serialization, FDSet *fds, const char *roo + + /* If we are running in test mode, we still want to run the generators, + * but we should not touch the real generator directories. */ +- r = lookup_paths_init_or_warn(&m->lookup_paths, m->unit_file_scope, ++ r = lookup_paths_init_or_warn(&m->lookup_paths, m->runtime_scope, + MANAGER_IS_TEST_RUN(m) ? LOOKUP_PATHS_TEMPORARY_GENERATED : 0, + root); + if (r < 0) +@@ -3374,7 +3374,7 @@ int manager_reload(Manager *m) { + m->uid_refs = hashmap_free(m->uid_refs); + m->gid_refs = hashmap_free(m->gid_refs); + +- r = lookup_paths_init_or_warn(&m->lookup_paths, m->unit_file_scope, 0, NULL); ++ r = lookup_paths_init_or_warn(&m->lookup_paths, m->runtime_scope, 0, NULL); + if (r < 0) + return r; + +@@ -3719,7 +3719,7 @@ static int build_generator_environment(Manager *m, char ***ret) { + if (!nl) + return -ENOMEM; + +- r = strv_env_assign(&nl, "SYSTEMD_SCOPE", MANAGER_IS_SYSTEM(m) ? "system" : "user"); ++ r = strv_env_assign(&nl, "SYSTEMD_SCOPE", runtime_scope_to_string(m->runtime_scope)); + if (r < 0) + return r; + +@@ -3780,7 +3780,7 @@ static int manager_run_generators(Manager *m) { + if (MANAGER_IS_TEST_RUN(m) && !(m->test_run_flags & MANAGER_TEST_RUN_GENERATORS)) + return 0; + +- paths = generator_binary_paths(m->unit_file_scope); ++ paths = generator_binary_paths(m->runtime_scope); + if (!paths) + return log_oom(); + +diff --git a/src/core/manager.h b/src/core/manager.h +index a96ba7bf9d..4d5b2e0602 100644 +--- a/src/core/manager.h ++++ b/src/core/manager.h +@@ -235,7 +235,8 @@ struct Manager { + int user_lookup_fds[2]; + sd_event_source *user_lookup_event_source; + +- LookupScope unit_file_scope; ++ RuntimeScope runtime_scope; ++ + LookupPaths lookup_paths; + Hashmap *unit_id_map; + Hashmap *unit_name_map; +@@ -471,8 +472,8 @@ static inline usec_t manager_default_timeout_abort_usec(Manager *m) { + return m->default_timeout_abort_set ? m->default_timeout_abort_usec : m->default_timeout_stop_usec; + } + +-#define MANAGER_IS_SYSTEM(m) ((m)->unit_file_scope == LOOKUP_SCOPE_SYSTEM) +-#define MANAGER_IS_USER(m) ((m)->unit_file_scope != LOOKUP_SCOPE_SYSTEM) ++#define MANAGER_IS_SYSTEM(m) ((m)->runtime_scope == RUNTIME_SCOPE_SYSTEM) ++#define MANAGER_IS_USER(m) ((m)->runtime_scope == RUNTIME_SCOPE_USER) + + #define MANAGER_IS_RELOADING(m) ((m)->n_reloading > 0) + +@@ -485,7 +486,7 @@ static inline usec_t manager_default_timeout_abort_usec(Manager *m) { + + #define MANAGER_IS_TEST_RUN(m) ((m)->test_run_flags != 0) + +-int manager_new(LookupScope scope, ManagerTestRunFlags test_run_flags, Manager **m); ++int manager_new(RuntimeScope scope, ManagerTestRunFlags test_run_flags, Manager **m); + Manager* manager_free(Manager *m); + DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_free); + +diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c +index e454df0405..1b267d4fdd 100644 +--- a/src/core/unit-printf.c ++++ b/src/core/unit-printf.c +@@ -183,7 +183,7 @@ int unit_name_printf(const Unit *u, const char* format, char **ret) { + + COMMON_SYSTEM_SPECIFIERS, + +- COMMON_CREDS_SPECIFIERS(u->manager->unit_file_scope), ++ COMMON_CREDS_SPECIFIERS(u->manager->runtime_scope), + {} + }; + +@@ -253,7 +253,7 @@ int unit_full_printf_full(const Unit *u, const char *format, size_t max_length, + + COMMON_SYSTEM_SPECIFIERS, + +- COMMON_CREDS_SPECIFIERS(u->manager->unit_file_scope), ++ COMMON_CREDS_SPECIFIERS(u->manager->runtime_scope), + + COMMON_TMP_SPECIFIERS, + {} +diff --git a/src/core/unit.c b/src/core/unit.c +index 009f416280..e90b51d8c4 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -4092,7 +4092,7 @@ UnitFileState unit_get_unit_file_state(Unit *u) { + + if (u->unit_file_state < 0 && u->fragment_path) { + r = unit_file_get_state( +- u->manager->unit_file_scope, ++ u->manager->runtime_scope, + NULL, + u->id, + &u->unit_file_state); +@@ -4108,7 +4108,7 @@ int unit_get_unit_file_preset(Unit *u) { + + if (u->unit_file_preset < 0 && u->fragment_path) + u->unit_file_preset = unit_file_query_preset( +- u->manager->unit_file_scope, ++ u->manager->runtime_scope, + NULL, + basename(u->fragment_path), + NULL); +diff --git a/src/home/homectl.c b/src/home/homectl.c +index 8534953f2c..c2c6f7e045 100644 +--- a/src/home/homectl.c ++++ b/src/home/homectl.c +@@ -108,7 +108,7 @@ static int acquire_bus(sd_bus **bus) { + if (*bus) + return 0; + +- r = bus_connect_transport(arg_transport, arg_host, false, bus); ++ r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/hostname/hostnamectl.c b/src/hostname/hostnamectl.c +index 924684685c..e82062b9e7 100644 +--- a/src/hostname/hostnamectl.c ++++ b/src/hostname/hostnamectl.c +@@ -691,7 +691,7 @@ static int run(int argc, char *argv[]) { + if (r <= 0) + return r; + +- r = bus_connect_transport(arg_transport, arg_host, false, &bus); ++ r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/libsystemd/sd-bus/bus-internal.h b/src/libsystemd/sd-bus/bus-internal.h +index 603a53fb10..ac3728ea91 100644 +--- a/src/libsystemd/sd-bus/bus-internal.h ++++ b/src/libsystemd/sd-bus/bus-internal.h +@@ -12,6 +12,7 @@ + #include "hashmap.h" + #include "list.h" + #include "prioq.h" ++#include "runtime-scope.h" + #include "socket-util.h" + #include "time-util.h" + +@@ -201,8 +202,6 @@ struct sd_bus { + bool nodes_modified:1; + bool trusted:1; + bool manual_peer_interface:1; +- bool is_system:1; +- bool is_user:1; + bool allow_interactive_authorization:1; + bool exit_on_disconnect:1; + bool exited:1; +@@ -215,6 +214,8 @@ struct sd_bus { + bool connected_signal:1; + bool close_on_exit:1; + ++ RuntimeScope runtime_scope; ++ + signed int use_memfd:2; + + void *rbuffer; +@@ -409,7 +410,7 @@ int bus_add_match_full( + int bus_set_address_system(sd_bus *bus); + int bus_set_address_user(sd_bus *bus); + int bus_set_address_system_remote(sd_bus *b, const char *host); +-int bus_set_address_machine(sd_bus *b, bool user, const char *machine); ++int bus_set_address_machine(sd_bus *b, RuntimeScope runtime_scope, const char *machine); + + int bus_maybe_reply_error(sd_bus_message *m, int r, sd_bus_error *error); + +diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c +index c2dded43ad..8cb013b54e 100644 +--- a/src/libsystemd/sd-bus/sd-bus.c ++++ b/src/libsystemd/sd-bus/sd-bus.c +@@ -251,6 +251,7 @@ _public_ int sd_bus_new(sd_bus **ret) { + .n_groups = SIZE_MAX, + .close_on_exit = true, + .ucred = UCRED_INVALID, ++ .runtime_scope = _RUNTIME_SCOPE_INVALID, + }; + + /* We guarantee that wqueue always has space for at least one entry */ +@@ -1280,8 +1281,10 @@ int bus_set_address_system(sd_bus *b) { + e = secure_getenv("DBUS_SYSTEM_BUS_ADDRESS"); + + r = sd_bus_set_address(b, e ?: DEFAULT_SYSTEM_BUS_ADDRESS); +- if (r >= 0) +- b->is_system = true; ++ if (r < 0) ++ return r; ++ ++ b->runtime_scope = RUNTIME_SCOPE_SYSTEM; + return r; + } + +@@ -1352,8 +1355,10 @@ int bus_set_address_user(sd_bus *b) { + } + + r = sd_bus_set_address(b, a); +- if (r >= 0) +- b->is_user = true; ++ if (r < 0) ++ return r; ++ ++ b->runtime_scope = RUNTIME_SCOPE_USER; + return r; + } + +@@ -1502,7 +1507,7 @@ _public_ int sd_bus_open_system_remote(sd_bus **ret, const char *host) { + + b->bus_client = true; + b->trusted = false; +- b->is_system = true; ++ b->runtime_scope = RUNTIME_SCOPE_SYSTEM; + b->is_local = false; + + r = sd_bus_start(b); +@@ -1513,7 +1518,7 @@ _public_ int sd_bus_open_system_remote(sd_bus **ret, const char *host) { + return 0; + } + +-int bus_set_address_machine(sd_bus *b, bool user, const char *machine) { ++int bus_set_address_machine(sd_bus *b, RuntimeScope runtime_scope, const char *machine) { + _cleanup_free_ char *a = NULL; + const char *rhs; + +@@ -1521,7 +1526,7 @@ int bus_set_address_machine(sd_bus *b, bool user, const char *machine) { + assert(machine); + + rhs = strchr(machine, '@'); +- if (rhs || user) { ++ if (rhs || runtime_scope == RUNTIME_SCOPE_USER) { + _cleanup_free_ char *u = NULL, *eu = NULL, *erhs = NULL; + + /* If there's an "@" in the container specification, we'll connect as a user specified at its +@@ -1577,7 +1582,7 @@ int bus_set_address_machine(sd_bus *b, bool user, const char *machine) { + if (!a) + return -ENOMEM; + +- if (user) { ++ if (runtime_scope == RUNTIME_SCOPE_USER) { + /* Ideally we'd use the "--user" switch to systemd-stdio-bridge here, but it's only + * available in recent systemd versions. Using the "-p" switch with the explicit path + * is a working alternative, and is compatible with older versions, hence that's what +@@ -1695,12 +1700,12 @@ _public_ int sd_bus_open_system_machine(sd_bus **ret, const char *user_and_machi + if (r < 0) + return r; + +- r = bus_set_address_machine(b, false, user_and_machine); ++ r = bus_set_address_machine(b, RUNTIME_SCOPE_SYSTEM, user_and_machine); + if (r < 0) + return r; + + b->bus_client = true; +- b->is_system = true; ++ b->runtime_scope = RUNTIME_SCOPE_SYSTEM; + + r = sd_bus_start(b); + if (r < 0) +@@ -1731,7 +1736,7 @@ _public_ int sd_bus_open_user_machine(sd_bus **ret, const char *user_and_machine + if (r < 0) + return r; + +- r = bus_set_address_machine(b, true, user_and_machine); ++ r = bus_set_address_machine(b, RUNTIME_SCOPE_USER, user_and_machine); + if (r < 0) + return r; + +@@ -4177,12 +4182,8 @@ _public_ int sd_bus_get_description(sd_bus *bus, const char **description) { + + if (bus->description) + *description = bus->description; +- else if (bus->is_system) +- *description = "system"; +- else if (bus->is_user) +- *description = "user"; + else +- *description = NULL; ++ *description = runtime_scope_to_string(bus->runtime_scope); + + return 0; + } +@@ -4193,17 +4194,11 @@ _public_ int sd_bus_get_scope(sd_bus *bus, const char **scope) { + assert_return(scope, -EINVAL); + assert_return(!bus_pid_changed(bus), -ECHILD); + +- if (bus->is_user) { +- *scope = "user"; +- return 0; +- } +- +- if (bus->is_system) { +- *scope = "system"; +- return 0; +- } ++ if (bus->runtime_scope < 0) ++ return -ENODATA; + +- return -ENODATA; ++ *scope = runtime_scope_to_string(bus->runtime_scope); ++ return 0; + } + + _public_ int sd_bus_get_address(sd_bus *bus, const char **address) { +diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c +index ac33e349c0..2c8181fbfb 100644 +--- a/src/libsystemd/sd-path/sd-path.c ++++ b/src/libsystemd/sd-path/sd-path.c +@@ -601,8 +601,8 @@ static int get_search(uint64_t type, char ***list) { + case SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT: + case SD_PATH_SYSTEMD_SEARCH_USER_UNIT: { + _cleanup_(lookup_paths_free) LookupPaths lp = {}; +- const LookupScope scope = type == SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT ? +- LOOKUP_SCOPE_SYSTEM : LOOKUP_SCOPE_USER; ++ RuntimeScope scope = type == SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT ? ++ RUNTIME_SCOPE_SYSTEM : RUNTIME_SCOPE_USER; + + r = lookup_paths_init(&lp, scope, 0, NULL); + if (r < 0) +@@ -614,9 +614,9 @@ static int get_search(uint64_t type, char ***list) { + + case SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR: + case SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR: { ++ RuntimeScope scope = type == SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR ? ++ RUNTIME_SCOPE_SYSTEM : RUNTIME_SCOPE_USER; + char **t; +- const LookupScope scope = type == SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR ? +- LOOKUP_SCOPE_SYSTEM : LOOKUP_SCOPE_USER; + + t = generator_binary_paths(scope); + if (!t) +diff --git a/src/locale/localectl.c b/src/locale/localectl.c +index c23f1fa3f6..3444b5fcbe 100644 +--- a/src/locale/localectl.c ++++ b/src/locale/localectl.c +@@ -530,7 +530,7 @@ static int run(int argc, char *argv[]) { + if (r <= 0) + return r; + +- r = bus_connect_transport(arg_transport, arg_host, false, &bus); ++ r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/login/loginctl.c b/src/login/loginctl.c +index e2eda66da7..20b03cef87 100644 +--- a/src/login/loginctl.c ++++ b/src/login/loginctl.c +@@ -1503,7 +1503,7 @@ static int run(int argc, char *argv[]) { + if (r <= 0) + return r; + +- r = bus_connect_transport(arg_transport, arg_host, false, &bus); ++ r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c +index 0a245247ec..c124b50ced 100644 +--- a/src/machine/machine-dbus.c ++++ b/src/machine/machine-dbus.c +@@ -502,7 +502,7 @@ static int container_bus_new(Machine *m, sd_bus_error *error, sd_bus **ret) { + bus->address = address; + bus->bus_client = true; + bus->trusted = false; +- bus->is_system = true; ++ bus->runtime_scope = RUNTIME_SCOPE_SYSTEM; + + r = sd_bus_start(bus); + if (r == -ENOENT) +diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c +index 14085f7397..6617e1c593 100644 +--- a/src/machine/machinectl.c ++++ b/src/machine/machinectl.c +@@ -2807,7 +2807,7 @@ static int run(int argc, char *argv[]) { + if (r <= 0) + return r; + +- r = bus_connect_transport(arg_transport, arg_host, false, &bus); ++ r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/mount/mount-tool.c b/src/mount/mount-tool.c +index 25e18d279c..32beffe6ad 100644 +--- a/src/mount/mount-tool.c ++++ b/src/mount/mount-tool.c +@@ -53,7 +53,7 @@ static bool arg_full = false; + static bool arg_ask_password = true; + static bool arg_quiet = false; + static BusTransport arg_transport = BUS_TRANSPORT_LOCAL; +-static bool arg_user = false; ++static RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + static const char *arg_host = NULL; + static bool arg_discover = false; + static char *arg_mount_what = NULL; +@@ -222,11 +222,11 @@ static int parse_argv(int argc, char *argv[]) { + break; + + case ARG_USER: +- arg_user = true; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + break; + + case ARG_SYSTEM: +- arg_user = false; ++ arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + break; + + case 'H': +@@ -333,12 +333,13 @@ static int parse_argv(int argc, char *argv[]) { + assert_not_reached(); + } + +- if (arg_user) ++ if (arg_runtime_scope == RUNTIME_SCOPE_USER) { + arg_ask_password = false; + +- if (arg_user && arg_transport != BUS_TRANSPORT_LOCAL) +- return log_error_errno(SYNTHETIC_ERRNO(EINVAL), +- "Execution in user context is not supported on non-local systems."); ++ if (arg_transport != BUS_TRANSPORT_LOCAL) ++ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), ++ "Execution in user context is not supported on non-local systems."); ++ } + + if (arg_action == ACTION_LIST) { + if (optind < argc) +@@ -1455,7 +1456,7 @@ static int run(int argc, char* argv[]) { + if (arg_action == ACTION_LIST) + return list_devices(); + +- r = bus_connect_transport_systemd(arg_transport, arg_host, arg_user, &bus); ++ r = bus_connect_transport_systemd(arg_transport, arg_host, arg_runtime_scope, &bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/portable/portable.c b/src/portable/portable.c +index 8a989ed526..adc67c76e4 100644 +--- a/src/portable/portable.c ++++ b/src/portable/portable.c +@@ -232,7 +232,7 @@ static int extract_now( + /* Then, send unit file data to the parent (or/and add it to the hashmap). For that we use our usual unit + * discovery logic. Note that we force looking inside of /lib/systemd/system/ for units too, as we mightbe + * compiled for a split-usr system but the image might be a legacy-usr one. */ +- r = lookup_paths_init(&paths, LOOKUP_SCOPE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, where); ++ r = lookup_paths_init(&paths, RUNTIME_SCOPE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, where); + if (r < 0) + return log_debug_errno(r, "Failed to acquire lookup paths: %m"); + +@@ -1371,13 +1371,13 @@ int portable_attach( + strempty(extensions_joined)); + } + +- r = lookup_paths_init(&paths, LOOKUP_SCOPE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, NULL); ++ r = lookup_paths_init(&paths, RUNTIME_SCOPE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, NULL); + if (r < 0) + return r; + + if (!FLAGS_SET(flags, PORTABLE_REATTACH) && !FLAGS_SET(flags, PORTABLE_FORCE_ATTACH)) + HASHMAP_FOREACH(item, unit_files) { +- r = unit_file_exists(LOOKUP_SCOPE_SYSTEM, &paths, item->name); ++ r = unit_file_exists(RUNTIME_SCOPE_SYSTEM, &paths, item->name); + if (r < 0) + return sd_bus_error_set_errnof(error, r, "Failed to determine whether unit '%s' exists on the host: %m", item->name); + if (r > 0) +@@ -1571,7 +1571,7 @@ int portable_detach( + + assert(name_or_path); + +- r = lookup_paths_init(&paths, LOOKUP_SCOPE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, NULL); ++ r = lookup_paths_init(&paths, RUNTIME_SCOPE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, NULL); + if (r < 0) + return r; + +@@ -1758,7 +1758,7 @@ static int portable_get_state_internal( + assert(name_or_path); + assert(ret); + +- r = lookup_paths_init(&paths, LOOKUP_SCOPE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, NULL); ++ r = lookup_paths_init(&paths, RUNTIME_SCOPE_SYSTEM, LOOKUP_PATHS_SPLIT_USR, NULL); + if (r < 0) + return r; + +@@ -1794,7 +1794,7 @@ static int portable_get_state_internal( + if (r == 0) + continue; + +- r = unit_file_lookup_state(LOOKUP_SCOPE_SYSTEM, &paths, de->d_name, &state); ++ r = unit_file_lookup_state(RUNTIME_SCOPE_SYSTEM, &paths, de->d_name, &state); + if (r < 0) + return log_debug_errno(r, "Failed to determine unit file state of '%s': %m", de->d_name); + if (!IN_SET(state, UNIT_FILE_STATIC, UNIT_FILE_DISABLED, UNIT_FILE_LINKED, UNIT_FILE_LINKED_RUNTIME)) +diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c +index dbae8a4d47..687141075a 100644 +--- a/src/portable/portablectl.c ++++ b/src/portable/portablectl.c +@@ -218,7 +218,7 @@ static int acquire_bus(sd_bus **bus) { + if (*bus) + return 0; + +- r = bus_connect_transport(arg_transport, arg_host, false, bus); ++ r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/run/run.c b/src/run/run.c +index 9ddb90595b..b667e46d2c 100644 +--- a/src/run/run.c ++++ b/src/run/run.c +@@ -47,7 +47,7 @@ static bool arg_slice_inherit = false; + static bool arg_send_sighup = false; + static BusTransport arg_transport = BUS_TRANSPORT_LOCAL; + static const char *arg_host = NULL; +-static bool arg_user = false; ++static RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + static const char *arg_service_type = NULL; + static const char *arg_exec_user = NULL; + static const char *arg_exec_group = NULL; +@@ -256,11 +256,11 @@ static int parse_argv(int argc, char *argv[]) { + break; + + case ARG_USER: +- arg_user = true; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + break; + + case ARG_SYSTEM: +- arg_user = false; ++ arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + break; + + case ARG_SCOPE: +@@ -508,7 +508,7 @@ static int parse_argv(int argc, char *argv[]) { + } + + /* If we are talking to the per-user instance PolicyKit isn't going to help */ +- if (arg_user) ++ if (arg_runtime_scope == RUNTIME_SCOPE_USER) + arg_ask_password = false; + + with_trigger = !!arg_path_property || !!arg_socket_property || arg_with_timer; +@@ -581,7 +581,7 @@ static int parse_argv(int argc, char *argv[]) { + } else if (!arg_unit || !with_trigger) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Command line to execute required."); + +- if (arg_user && arg_transport == BUS_TRANSPORT_REMOTE) ++ if (arg_runtime_scope == RUNTIME_SCOPE_USER && arg_transport == BUS_TRANSPORT_REMOTE) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Execution in user context is not supported on remote systems."); + +@@ -655,10 +655,20 @@ static int transient_cgroup_set_properties(sd_bus_message *m) { + if (arg_slice_inherit) { + char *end; + +- if (arg_user) ++ switch (arg_runtime_scope) { ++ ++ case RUNTIME_SCOPE_USER: + r = cg_pid_get_user_slice(0, &name); +- else ++ break; ++ ++ case RUNTIME_SCOPE_SYSTEM: + r = cg_pid_get_slice(0, &name); ++ break; ++ ++ default: ++ assert_not_reached(); ++ } ++ + if (r < 0) + return log_error_errno(r, "Failed to get PID slice: %m"); + +@@ -1229,7 +1239,7 @@ static int start_transient_service( + if (r < 0) + return bus_log_parse_error(r); + +- r = bus_wait_for_jobs_one(w, object, arg_quiet, arg_user ? STRV_MAKE_CONST("--user") : NULL); ++ r = bus_wait_for_jobs_one(w, object, arg_quiet, arg_runtime_scope == RUNTIME_SCOPE_USER ? STRV_MAKE_CONST("--user") : NULL); + if (r < 0) + return r; + } +@@ -1469,7 +1479,7 @@ static int start_transient_scope(sd_bus *bus) { + if (r < 0) + return bus_log_parse_error(r); + +- r = bus_wait_for_jobs_one(w, object, arg_quiet, arg_user ? STRV_MAKE_CONST("--user") : NULL); ++ r = bus_wait_for_jobs_one(w, object, arg_quiet, arg_runtime_scope == RUNTIME_SCOPE_USER ? STRV_MAKE_CONST("--user") : NULL); + if (r < 0) + return r; + +@@ -1692,7 +1702,7 @@ static int start_transient_trigger( + if (r < 0) + return bus_log_parse_error(r); + +- r = bus_wait_for_jobs_one(w, object, arg_quiet, arg_user ? STRV_MAKE_CONST("--user") : NULL); ++ r = bus_wait_for_jobs_one(w, object, arg_quiet, arg_runtime_scope == RUNTIME_SCOPE_USER ? STRV_MAKE_CONST("--user") : NULL); + if (r < 0) + return r; + +@@ -1760,10 +1770,10 @@ static int run(int argc, char* argv[]) { + + /* If --wait is used connect via the bus, unconditionally, as ref/unref is not supported via the limited direct + * connection */ +- if (arg_wait || arg_stdio != ARG_STDIO_NONE || (arg_user && arg_transport != BUS_TRANSPORT_LOCAL)) +- r = bus_connect_transport(arg_transport, arg_host, arg_user, &bus); ++ if (arg_wait || arg_stdio != ARG_STDIO_NONE || (arg_runtime_scope == RUNTIME_SCOPE_USER && arg_transport != BUS_TRANSPORT_LOCAL)) ++ r = bus_connect_transport(arg_transport, arg_host, arg_runtime_scope, &bus); + else +- r = bus_connect_transport_systemd(arg_transport, arg_host, arg_user, &bus); ++ r = bus_connect_transport_systemd(arg_transport, arg_host, arg_runtime_scope, &bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/shared/bus-util.c b/src/shared/bus-util.c +index 7c8d2aa6f5..d36b577c1c 100644 +--- a/src/shared/bus-util.c ++++ b/src/shared/bus-util.c +@@ -267,7 +267,7 @@ int bus_connect_user_systemd(sd_bus **ret_bus) { + int bus_connect_transport( + BusTransport transport, + const char *host, +- bool user, ++ RuntimeScope runtime_scope, + sd_bus **ret) { + + _cleanup_(sd_bus_close_unrefp) sd_bus *bus = NULL; +@@ -278,19 +278,28 @@ int bus_connect_transport( + assert(ret); + + assert_return((transport == BUS_TRANSPORT_LOCAL) == !host, -EINVAL); +- assert_return(transport != BUS_TRANSPORT_REMOTE || !user, -EOPNOTSUPP); ++ assert_return(transport != BUS_TRANSPORT_REMOTE || runtime_scope == RUNTIME_SCOPE_SYSTEM, -EOPNOTSUPP); + + switch (transport) { + + case BUS_TRANSPORT_LOCAL: +- if (user) ++ ++ switch (runtime_scope) { ++ ++ case RUNTIME_SCOPE_USER: + r = sd_bus_default_user(&bus); +- else { ++ break; ++ ++ case RUNTIME_SCOPE_SYSTEM: + if (sd_booted() <= 0) + /* Print a friendly message when the local system is actually not running systemd as PID 1. */ + return log_error_errno(SYNTHETIC_ERRNO(EHOSTDOWN), + "System has not been booted with systemd as init system (PID 1). Can't operate."); + r = sd_bus_default_system(&bus); ++ break; ++ ++ default: ++ assert_not_reached(); + } + break; + +@@ -299,10 +308,21 @@ int bus_connect_transport( + break; + + case BUS_TRANSPORT_MACHINE: +- if (user) ++ ++ switch (runtime_scope) { ++ ++ case RUNTIME_SCOPE_USER: + r = sd_bus_open_user_machine(&bus, host); +- else ++ break; ++ ++ case RUNTIME_SCOPE_SYSTEM: + r = sd_bus_open_system_machine(&bus, host); ++ break; ++ ++ default: ++ assert_not_reached(); ++ } ++ + break; + + default: +@@ -319,25 +339,34 @@ int bus_connect_transport( + return 0; + } + +-int bus_connect_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus) { ++int bus_connect_transport_systemd(BusTransport transport, const char *host, RuntimeScope runtime_scope, sd_bus **bus) { + assert(transport >= 0); + assert(transport < _BUS_TRANSPORT_MAX); + assert(bus); + + assert_return((transport == BUS_TRANSPORT_LOCAL) == !host, -EINVAL); +- assert_return(transport == BUS_TRANSPORT_LOCAL || !user, -EOPNOTSUPP); ++ assert_return(transport == BUS_TRANSPORT_LOCAL || runtime_scope == RUNTIME_SCOPE_SYSTEM, -EOPNOTSUPP); + + switch (transport) { + + case BUS_TRANSPORT_LOCAL: +- if (user) ++ switch (runtime_scope) { ++ ++ case RUNTIME_SCOPE_USER: + return bus_connect_user_systemd(bus); + +- if (sd_booted() <= 0) +- /* Print a friendly message when the local system is actually not running systemd as PID 1. */ +- return log_error_errno(SYNTHETIC_ERRNO(EHOSTDOWN), +- "System has not been booted with systemd as init system (PID 1). Can't operate."); +- return bus_connect_system_systemd(bus); ++ case RUNTIME_SCOPE_SYSTEM: ++ if (sd_booted() <= 0) ++ /* Print a friendly message when the local system is actually not running systemd as PID 1. */ ++ return log_error_errno(SYNTHETIC_ERRNO(EHOSTDOWN), ++ "System has not been booted with systemd as init system (PID 1). Can't operate."); ++ return bus_connect_system_systemd(bus); ++ ++ default: ++ assert_not_reached(); ++ } ++ ++ break; + + case BUS_TRANSPORT_REMOTE: + return sd_bus_open_system_remote(bus, host); +diff --git a/src/shared/bus-util.h b/src/shared/bus-util.h +index e1fdf2ef48..4bb8c85921 100644 +--- a/src/shared/bus-util.h ++++ b/src/shared/bus-util.h +@@ -11,6 +11,7 @@ + + #include "errno-util.h" + #include "macro.h" ++#include "runtime-scope.h" + #include "string-util.h" + #include "time-util.h" + +@@ -36,8 +37,8 @@ int bus_check_peercred(sd_bus *c); + int bus_connect_system_systemd(sd_bus **ret_bus); + int bus_connect_user_systemd(sd_bus **ret_bus); + +-int bus_connect_transport(BusTransport transport, const char *host, bool user, sd_bus **bus); +-int bus_connect_transport_systemd(BusTransport transport, const char *host, bool user, sd_bus **bus); ++int bus_connect_transport(BusTransport transport, const char *host, RuntimeScope runtime_scope, sd_bus **bus); ++int bus_connect_transport_systemd(BusTransport transport, const char *host, RuntimeScope runtime_scope, sd_bus **bus); + + int bus_log_address_error(int r, BusTransport transport); + int bus_log_connect_error(int r, BusTransport transport); +diff --git a/src/shared/cgroup-show.c b/src/shared/cgroup-show.c +index e34a68ef86..78dfded701 100644 +--- a/src/shared/cgroup-show.c ++++ b/src/shared/cgroup-show.c +@@ -465,7 +465,7 @@ int show_cgroup_get_path_and_warn( + if (r < 0) + return log_error_errno(r, "Failed to load machine data: %m"); + +- r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, false, &bus); ++ r = bus_connect_transport_systemd(BUS_TRANSPORT_LOCAL, NULL, RUNTIME_SCOPE_SYSTEM, &bus); + if (r < 0) + return bus_log_connect_error(r, BUS_TRANSPORT_LOCAL); + +diff --git a/src/shared/install-printf.c b/src/shared/install-printf.c +index e2a4a481ea..3cc709308d 100644 +--- a/src/shared/install-printf.c ++++ b/src/shared/install-printf.c +@@ -98,7 +98,7 @@ static int specifier_last_component(char specifier, const void *data, const char + } + + int install_name_printf( +- LookupScope scope, ++ RuntimeScope scope, + const InstallInfo *info, + const char *format, + char **ret) { +diff --git a/src/shared/install-printf.h b/src/shared/install-printf.h +index 46a7514504..8c7842ba2c 100644 +--- a/src/shared/install-printf.h ++++ b/src/shared/install-printf.h +@@ -5,7 +5,7 @@ + #include "unit-name.h" + + int install_name_printf( +- LookupScope scope, ++ RuntimeScope scope, + const InstallInfo *info, + const char *format, + char **ret); +diff --git a/src/shared/install.c b/src/shared/install.c +index eaad368d1c..35e797293f 100644 +--- a/src/shared/install.c ++++ b/src/shared/install.c +@@ -47,7 +47,7 @@ typedef enum SearchFlags { + } SearchFlags; + + typedef struct { +- LookupScope scope; ++ RuntimeScope scope; + OrderedHashmap *will_process; + OrderedHashmap *have_processed; + } InstallContext; +@@ -964,7 +964,7 @@ static int find_symlinks( + } + + static int find_symlinks_in_scope( +- LookupScope scope, ++ RuntimeScope scope, + const LookupPaths *lp, + const InstallInfo *info, + bool match_name, +@@ -998,7 +998,7 @@ static int find_symlinks_in_scope( + } + + /* look for global enablement of user units */ +- if (scope == LOOKUP_SCOPE_USER && path_is_user_config_dir(*p)) { ++ if (scope == RUNTIME_SCOPE_USER && path_is_user_config_dir(*p)) { + *state = UNIT_FILE_ENABLED; + return 1; + } +@@ -1876,7 +1876,7 @@ int unit_file_verify_alias( + } + + static int install_info_symlink_alias( +- LookupScope scope, ++ RuntimeScope scope, + InstallInfo *info, + const LookupPaths *lp, + const char *config_path, +@@ -1920,7 +1920,7 @@ static int install_info_symlink_alias( + } + + static int install_info_symlink_wants( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags file_flags, + InstallInfo *info, + const LookupPaths *lp, +@@ -2055,7 +2055,7 @@ static int install_info_symlink_link( + } + + static int install_info_apply( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags file_flags, + InstallInfo *info, + const LookupPaths *lp, +@@ -2232,7 +2232,7 @@ static int install_context_mark_for_removal( + } + + int unit_file_mask( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names, +@@ -2244,7 +2244,7 @@ int unit_file_mask( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + + r = lookup_paths_init(&lp, scope, 0, root_dir); + if (r < 0) +@@ -2277,7 +2277,7 @@ int unit_file_mask( + } + + int unit_file_unmask( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names, +@@ -2292,7 +2292,7 @@ int unit_file_unmask( + int r, q; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + + r = lookup_paths_init(&lp, scope, 0, root_dir); + if (r < 0) +@@ -2392,7 +2392,7 @@ int unit_file_unmask( + } + + int unit_file_link( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **files, +@@ -2406,7 +2406,7 @@ int unit_file_link( + int r, q; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + + r = lookup_paths_init(&lp, scope, 0, root_dir); + if (r < 0) +@@ -2500,7 +2500,7 @@ static int path_shall_revert(const LookupPaths *lp, const char *path) { + } + + int unit_file_revert( +- LookupScope scope, ++ RuntimeScope scope, + const char *root_dir, + char **names, + InstallChange **changes, +@@ -2656,7 +2656,7 @@ int unit_file_revert( + } + + int unit_file_add_dependency( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags file_flags, + const char *root_dir, + char **names, +@@ -2672,7 +2672,7 @@ int unit_file_add_dependency( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + assert(target); + assert(IN_SET(dep, UNIT_WANTS, UNIT_REQUIRES)); + +@@ -2726,7 +2726,7 @@ int unit_file_add_dependency( + + static int do_unit_file_enable( + const LookupPaths *lp, +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *config_path, + char **names_or_paths, +@@ -2757,7 +2757,7 @@ static int do_unit_file_enable( + } + + int unit_file_enable( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names_or_paths, +@@ -2768,7 +2768,7 @@ int unit_file_enable( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + + r = lookup_paths_init(&lp, scope, 0, root_dir); + if (r < 0) +@@ -2783,7 +2783,7 @@ int unit_file_enable( + + static int do_unit_file_disable( + const LookupPaths *lp, +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *config_path, + char **names, +@@ -2825,7 +2825,7 @@ static int do_unit_file_disable( + } + + int unit_file_disable( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **files, +@@ -2836,7 +2836,7 @@ int unit_file_disable( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + + r = lookup_paths_init(&lp, scope, 0, root_dir); + if (r < 0) +@@ -2850,7 +2850,7 @@ int unit_file_disable( + } + + static int normalize_linked_files( +- LookupScope scope, ++ RuntimeScope scope, + const LookupPaths *lp, + char **names_or_paths, + char ***ret_names, +@@ -2908,7 +2908,7 @@ static int normalize_linked_files( + } + + int unit_file_reenable( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names_or_paths, +@@ -2920,7 +2920,7 @@ int unit_file_reenable( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + + r = lookup_paths_init(&lp, scope, 0, root_dir); + if (r < 0) +@@ -2944,7 +2944,7 @@ int unit_file_reenable( + } + + int unit_file_set_default( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + const char *name, +@@ -2958,7 +2958,7 @@ int unit_file_set_default( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + assert(name); + + if (unit_name_to_type(name) != UNIT_TARGET) /* this also validates the name */ +@@ -2979,7 +2979,7 @@ int unit_file_set_default( + } + + int unit_file_get_default( +- LookupScope scope, ++ RuntimeScope scope, + const char *root_dir, + char **name) { + +@@ -2990,7 +2990,7 @@ int unit_file_get_default( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + assert(name); + + r = lookup_paths_init(&lp, scope, 0, root_dir); +@@ -3014,7 +3014,7 @@ int unit_file_get_default( + } + + int unit_file_lookup_state( +- LookupScope scope, ++ RuntimeScope scope, + const LookupPaths *lp, + const char *name, + UnitFileState *ret) { +@@ -3112,7 +3112,7 @@ int unit_file_lookup_state( + } + + int unit_file_get_state( +- LookupScope scope, ++ RuntimeScope scope, + const char *root_dir, + const char *name, + UnitFileState *ret) { +@@ -3121,7 +3121,7 @@ int unit_file_get_state( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + assert(name); + + r = lookup_paths_init(&lp, scope, 0, root_dir); +@@ -3131,7 +3131,7 @@ int unit_file_get_state( + return unit_file_lookup_state(scope, &lp, name, ret); + } + +-int unit_file_exists(LookupScope scope, const LookupPaths *lp, const char *name) { ++int unit_file_exists(RuntimeScope scope, const LookupPaths *lp, const char *name) { + _cleanup_(install_context_done) InstallContext c = { .scope = scope }; + int r; + +@@ -3183,17 +3183,17 @@ static int split_pattern_into_name_and_instances(const char *pattern, char **out + return 0; + } + +-static int presets_find_config(LookupScope scope, const char *root_dir, char ***files) { ++static int presets_find_config(RuntimeScope scope, const char *root_dir, char ***files) { + static const char* const system_dirs[] = {CONF_PATHS("systemd/system-preset"), NULL}; + static const char* const user_dirs[] = {CONF_PATHS_USR("systemd/user-preset"), NULL}; + const char* const* dirs; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + +- if (scope == LOOKUP_SCOPE_SYSTEM) ++ if (scope == RUNTIME_SCOPE_SYSTEM) + dirs = system_dirs; +- else if (IN_SET(scope, LOOKUP_SCOPE_GLOBAL, LOOKUP_SCOPE_USER)) ++ else if (IN_SET(scope, RUNTIME_SCOPE_GLOBAL, RUNTIME_SCOPE_USER)) + dirs = user_dirs; + else + assert_not_reached(); +@@ -3201,13 +3201,13 @@ static int presets_find_config(LookupScope scope, const char *root_dir, char *** + return conf_files_list_strv(files, ".preset", root_dir, 0, dirs); + } + +-static int read_presets(LookupScope scope, const char *root_dir, UnitFilePresets *presets) { ++static int read_presets(RuntimeScope scope, const char *root_dir, UnitFilePresets *presets) { + _cleanup_(unit_file_presets_freep) UnitFilePresets ps = {}; + _cleanup_strv_free_ char **files = NULL; + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + assert(presets); + + r = presets_find_config(scope, root_dir, &files); +@@ -3381,7 +3381,7 @@ static int query_presets(const char *name, const UnitFilePresets *presets, char + } + } + +-int unit_file_query_preset(LookupScope scope, const char *root_dir, const char *name, UnitFilePresets *cached) { ++int unit_file_query_preset(RuntimeScope scope, const char *root_dir, const char *name, UnitFilePresets *cached) { + _cleanup_(unit_file_presets_freep) UnitFilePresets tmp = {}; + int r; + +@@ -3445,7 +3445,7 @@ static int execute_preset( + } + + static int preset_prepare_one( +- LookupScope scope, ++ RuntimeScope scope, + InstallContext *plus, + InstallContext *minus, + LookupPaths *lp, +@@ -3498,7 +3498,7 @@ static int preset_prepare_one( + } + + int unit_file_preset( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags file_flags, + const char *root_dir, + char **names, +@@ -3513,7 +3513,7 @@ int unit_file_preset( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + assert(mode < _UNIT_FILE_PRESET_MODE_MAX); + + r = lookup_paths_init(&lp, scope, 0, root_dir); +@@ -3538,7 +3538,7 @@ int unit_file_preset( + } + + int unit_file_preset_all( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags file_flags, + const char *root_dir, + UnitFilePresetMode mode, +@@ -3552,7 +3552,7 @@ int unit_file_preset_all( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + assert(mode < _UNIT_FILE_PRESET_MODE_MAX); + + r = lookup_paths_init(&lp, scope, 0, root_dir); +@@ -3613,7 +3613,7 @@ Hashmap* unit_file_list_free(Hashmap *h) { + DEFINE_TRIVIAL_CLEANUP_FUNC(UnitFileList*, unit_file_list_free_one); + + int unit_file_get_list( +- LookupScope scope, ++ RuntimeScope scope, + const char *root_dir, + Hashmap *h, + char **states, +@@ -3623,7 +3623,7 @@ int unit_file_get_list( + int r; + + assert(scope >= 0); +- assert(scope < _LOOKUP_SCOPE_MAX); ++ assert(scope < _RUNTIME_SCOPE_MAX); + assert(h); + + r = lookup_paths_init(&lp, scope, 0, root_dir); +diff --git a/src/shared/install.h b/src/shared/install.h +index 0abc73897e..0f9724f999 100644 +--- a/src/shared/install.h ++++ b/src/shared/install.h +@@ -102,28 +102,28 @@ struct InstallInfo { + }; + + int unit_file_enable( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names_or_paths, + InstallChange **changes, + size_t *n_changes); + int unit_file_disable( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names, + InstallChange **changes, + size_t *n_changes); + int unit_file_reenable( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names_or_paths, + InstallChange **changes, + size_t *n_changes); + int unit_file_preset( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names, +@@ -131,52 +131,52 @@ int unit_file_preset( + InstallChange **changes, + size_t *n_changes); + int unit_file_preset_all( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + UnitFilePresetMode mode, + InstallChange **changes, + size_t *n_changes); + int unit_file_mask( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names, + InstallChange **changes, + size_t *n_changes); + int unit_file_unmask( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names, + InstallChange **changes, + size_t *n_changes); + int unit_file_link( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **files, + InstallChange **changes, + size_t *n_changes); + int unit_file_revert( +- LookupScope scope, ++ RuntimeScope scope, + const char *root_dir, + char **names, + InstallChange **changes, + size_t *n_changes); + int unit_file_set_default( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + const char *name, + InstallChange **changes, + size_t *n_changes); + int unit_file_get_default( +- LookupScope scope, ++ RuntimeScope scope, + const char *root_dir, + char **name); + int unit_file_add_dependency( +- LookupScope scope, ++ RuntimeScope scope, + UnitFileFlags flags, + const char *root_dir, + char **names, +@@ -186,15 +186,15 @@ int unit_file_add_dependency( + size_t *n_changes); + + int unit_file_lookup_state( +- LookupScope scope, ++ RuntimeScope scope, + const LookupPaths *paths, + const char *name, + UnitFileState *ret); + +-int unit_file_get_state(LookupScope scope, const char *root_dir, const char *filename, UnitFileState *ret); +-int unit_file_exists(LookupScope scope, const LookupPaths *paths, const char *name); ++int unit_file_get_state(RuntimeScope scope, const char *root_dir, const char *filename, UnitFileState *ret); ++int unit_file_exists(RuntimeScope scope, const LookupPaths *paths, const char *name); + +-int unit_file_get_list(LookupScope scope, const char *root_dir, Hashmap *h, char **states, char **patterns); ++int unit_file_get_list(RuntimeScope scope, const char *root_dir, Hashmap *h, char **states, char **patterns); + Hashmap* unit_file_list_free(Hashmap *h); + + InstallChangeType install_changes_add(InstallChange **changes, size_t *n_changes, InstallChangeType type, const char *path, const char *source); +@@ -217,7 +217,7 @@ typedef struct { + } UnitFilePresets; + + void unit_file_presets_freep(UnitFilePresets *p); +-int unit_file_query_preset(LookupScope scope, const char *root_dir, const char *name, UnitFilePresets *cached); ++int unit_file_query_preset(RuntimeScope scope, const char *root_dir, const char *name, UnitFilePresets *cached); + + const char *unit_file_state_to_string(UnitFileState s) _const_; + UnitFileState unit_file_state_from_string(const char *s) _pure_; +diff --git a/src/shared/specifier.c b/src/shared/specifier.c +index cd651768bd..aba90f44b2 100644 +--- a/src/shared/specifier.c ++++ b/src/shared/specifier.c +@@ -334,15 +334,15 @@ int specifier_os_image_version(char specifier, const void *data, const char *roo + } + + int specifier_group_name(char specifier, const void *data, const char *root, const void *userdata, char **ret) { +- LookupScope scope = PTR_TO_INT(data); ++ RuntimeScope scope = PTR_TO_INT(data); + char *t; + + assert(ret); + +- if (scope == LOOKUP_SCOPE_GLOBAL) ++ if (scope == RUNTIME_SCOPE_GLOBAL) + return -EINVAL; + +- t = gid_to_name(scope == LOOKUP_SCOPE_USER ? getgid() : 0); ++ t = gid_to_name(scope == RUNTIME_SCOPE_USER ? getgid() : 0); + if (!t) + return -ENOMEM; + +@@ -351,15 +351,15 @@ int specifier_group_name(char specifier, const void *data, const char *root, con + } + + int specifier_group_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) { +- LookupScope scope = PTR_TO_INT(data); ++ RuntimeScope scope = PTR_TO_INT(data); + gid_t gid; + + assert(ret); + +- if (scope == LOOKUP_SCOPE_GLOBAL) ++ if (scope == RUNTIME_SCOPE_GLOBAL) + return -EINVAL; + +- gid = scope == LOOKUP_SCOPE_USER ? getgid() : 0; ++ gid = scope == RUNTIME_SCOPE_USER ? getgid() : 0; + + if (asprintf(ret, UID_FMT, gid) < 0) + return -ENOMEM; +@@ -368,16 +368,16 @@ int specifier_group_id(char specifier, const void *data, const char *root, const + } + + int specifier_user_name(char specifier, const void *data, const char *root, const void *userdata, char **ret) { +- LookupScope scope = PTR_TO_INT(data); ++ RuntimeScope scope = PTR_TO_INT(data); + uid_t uid; + char *t; + + assert(ret); + +- if (scope == LOOKUP_SCOPE_GLOBAL) ++ if (scope == RUNTIME_SCOPE_GLOBAL) + return -EINVAL; + +- uid = scope == LOOKUP_SCOPE_USER ? getuid() : 0; ++ uid = scope == RUNTIME_SCOPE_USER ? getuid() : 0; + + /* If we are UID 0 (root), this will not result in NSS, otherwise it might. This is good, as we want + * to be able to run this in PID 1, where our user ID is 0, but where NSS lookups are not allowed. +@@ -395,15 +395,15 @@ int specifier_user_name(char specifier, const void *data, const char *root, cons + } + + int specifier_user_id(char specifier, const void *data, const char *root, const void *userdata, char **ret) { +- LookupScope scope = PTR_TO_INT(data); ++ RuntimeScope scope = PTR_TO_INT(data); + uid_t uid; + + assert(ret); + +- if (scope == LOOKUP_SCOPE_GLOBAL) ++ if (scope == RUNTIME_SCOPE_GLOBAL) + return -EINVAL; + +- uid = scope == LOOKUP_SCOPE_USER ? getuid() : 0; ++ uid = scope == RUNTIME_SCOPE_USER ? getuid() : 0; + + if (asprintf(ret, UID_FMT, uid) < 0) + return -ENOMEM; +diff --git a/src/stdio-bridge/stdio-bridge.c b/src/stdio-bridge/stdio-bridge.c +index 1b94374b4b..159ff17efb 100644 +--- a/src/stdio-bridge/stdio-bridge.c ++++ b/src/stdio-bridge/stdio-bridge.c +@@ -23,7 +23,7 @@ + + static const char *arg_bus_path = DEFAULT_BUS_PATH; + static BusTransport arg_transport = BUS_TRANSPORT_LOCAL; +-static bool arg_user = false; ++static RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + + static int help(void) { + printf("%s [OPTIONS...]\n\n" +@@ -73,11 +73,11 @@ static int parse_argv(int argc, char *argv[]) { + return version(); + + case ARG_USER: +- arg_user = true; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + break; + + case ARG_SYSTEM: +- arg_user = false; ++ arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + break; + + case 'p': +@@ -133,7 +133,7 @@ static int run(int argc, char *argv[]) { + return log_error_errno(r, "Failed to allocate bus: %m"); + + if (arg_transport == BUS_TRANSPORT_MACHINE) +- r = bus_set_address_machine(a, arg_user, arg_bus_path); ++ r = bus_set_address_machine(a, arg_runtime_scope, arg_bus_path); + else + r = sd_bus_set_address(a, arg_bus_path); + if (r < 0) +diff --git a/src/systemctl/systemctl-add-dependency.c b/src/systemctl/systemctl-add-dependency.c +index 68968a783c..4bbcd7a13b 100644 +--- a/src/systemctl/systemctl-add-dependency.c ++++ b/src/systemctl/systemctl-add-dependency.c +@@ -37,7 +37,7 @@ int verb_add_dependency(int argc, char *argv[], void *userdata) { + assert_not_reached(); + + if (install_client_side()) { +- r = unit_file_add_dependency(arg_scope, unit_file_flags_from_args(), arg_root, names, target, dep, &changes, &n_changes); ++ r = unit_file_add_dependency(arg_runtime_scope, unit_file_flags_from_args(), arg_root, names, target, dep, &changes, &n_changes); + install_changes_dump(r, "add dependency on", changes, n_changes, arg_quiet); + + if (r > 0) +diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c +index fe47f73d4a..38a932feea 100644 +--- a/src/systemctl/systemctl-edit.c ++++ b/src/systemctl/systemctl-edit.c +@@ -37,7 +37,7 @@ int verb_cat(int argc, char *argv[], void *userdata) { + if (arg_transport != BUS_TRANSPORT_LOCAL) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Cannot remotely cat units."); + +- r = lookup_paths_init_or_warn(&lp, arg_scope, 0, arg_root); ++ r = lookup_paths_init_or_warn(&lp, arg_runtime_scope, 0, arg_root); + if (r < 0) + return r; + +@@ -99,7 +99,7 @@ int verb_cat(int argc, char *argv[], void *userdata) { + ansi_highlight_red(), + ansi_highlight_red(), + ansi_highlight_red(), +- arg_scope == LOOKUP_SCOPE_SYSTEM ? "" : " --user", ++ arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "" : " --user", + ansi_normal()); + + r = cat_files(fragment_path, dropin_paths, 0); +@@ -382,7 +382,7 @@ static int find_paths_to_edit(sd_bus *bus, char **names, char ***paths) { + assert(names); + assert(paths); + +- r = lookup_paths_init(&lp, arg_scope, 0, arg_root); ++ r = lookup_paths_init(&lp, arg_runtime_scope, 0, arg_root); + if (r < 0) + return r; + +@@ -406,8 +406,8 @@ static int find_paths_to_edit(sd_bus *bus, char **names, char ***paths) { + if (!path) { + if (!arg_force) { + log_info("Run 'systemctl edit%s --force --full %s' to create a new unit.", +- arg_scope == LOOKUP_SCOPE_GLOBAL ? " --global" : +- arg_scope == LOOKUP_SCOPE_USER ? " --user" : "", ++ arg_runtime_scope == RUNTIME_SCOPE_GLOBAL ? " --global" : ++ arg_runtime_scope == RUNTIME_SCOPE_USER ? " --user" : "", + *name); + return -ENOENT; + } +@@ -507,7 +507,7 @@ int verb_edit(int argc, char *argv[], void *userdata) { + if (arg_transport != BUS_TRANSPORT_LOCAL) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Cannot edit units remotely."); + +- r = lookup_paths_init_or_warn(&lp, arg_scope, 0, arg_root); ++ r = lookup_paths_init_or_warn(&lp, arg_runtime_scope, 0, arg_root); + if (r < 0) + return r; + +diff --git a/src/systemctl/systemctl-enable.c b/src/systemctl/systemctl-enable.c +index 86d9f602fa..7429ffc7d3 100644 +--- a/src/systemctl/systemctl-enable.c ++++ b/src/systemctl/systemctl-enable.c +@@ -107,24 +107,24 @@ int verb_enable(int argc, char *argv[], void *userdata) { + + flags = unit_file_flags_from_args(); + if (streq(verb, "enable")) { +- r = unit_file_enable(arg_scope, flags, arg_root, names, &changes, &n_changes); ++ r = unit_file_enable(arg_runtime_scope, flags, arg_root, names, &changes, &n_changes); + carries_install_info = r; + } else if (streq(verb, "disable")) { +- r = unit_file_disable(arg_scope, flags, arg_root, names, &changes, &n_changes); ++ r = unit_file_disable(arg_runtime_scope, flags, arg_root, names, &changes, &n_changes); + carries_install_info = r; + } else if (streq(verb, "reenable")) { +- r = unit_file_reenable(arg_scope, flags, arg_root, names, &changes, &n_changes); ++ r = unit_file_reenable(arg_runtime_scope, flags, arg_root, names, &changes, &n_changes); + carries_install_info = r; + } else if (streq(verb, "link")) +- r = unit_file_link(arg_scope, flags, arg_root, names, &changes, &n_changes); ++ r = unit_file_link(arg_runtime_scope, flags, arg_root, names, &changes, &n_changes); + else if (streq(verb, "preset")) +- r = unit_file_preset(arg_scope, flags, arg_root, names, arg_preset_mode, &changes, &n_changes); ++ r = unit_file_preset(arg_runtime_scope, flags, arg_root, names, arg_preset_mode, &changes, &n_changes); + else if (streq(verb, "mask")) +- r = unit_file_mask(arg_scope, flags, arg_root, names, &changes, &n_changes); ++ r = unit_file_mask(arg_runtime_scope, flags, arg_root, names, &changes, &n_changes); + else if (streq(verb, "unmask")) +- r = unit_file_unmask(arg_scope, flags, arg_root, names, &changes, &n_changes); ++ r = unit_file_unmask(arg_runtime_scope, flags, arg_root, names, &changes, &n_changes); + else if (streq(verb, "revert")) +- r = unit_file_revert(arg_scope, arg_root, names, &changes, &n_changes); ++ r = unit_file_revert(arg_runtime_scope, arg_root, names, &changes, &n_changes); + else + assert_not_reached(); + +@@ -143,7 +143,7 @@ int verb_enable(int argc, char *argv[], void *userdata) { + if (STR_IN_SET(verb, "mask", "unmask")) { + _cleanup_(lookup_paths_free) LookupPaths lp = {}; + +- r = lookup_paths_init_or_warn(&lp, arg_scope, 0, arg_root); ++ r = lookup_paths_init_or_warn(&lp, arg_runtime_scope, 0, arg_root); + if (r < 0) + return r; + +diff --git a/src/systemctl/systemctl-is-enabled.c b/src/systemctl/systemctl-is-enabled.c +index 2d33313eb8..0330ee7ff9 100644 +--- a/src/systemctl/systemctl-is-enabled.c ++++ b/src/systemctl/systemctl-is-enabled.c +@@ -18,7 +18,7 @@ static int show_installation_targets_client_side(const char *name) { + flags = UNIT_FILE_DRY_RUN | + (arg_runtime ? UNIT_FILE_RUNTIME : 0); + +- r = unit_file_disable(LOOKUP_SCOPE_SYSTEM, flags, NULL, p, &changes, &n_changes); ++ r = unit_file_disable(RUNTIME_SCOPE_SYSTEM, flags, NULL, p, &changes, &n_changes); + if (r < 0) + return log_error_errno(r, "Failed to get file links for %s: %m", name); + +@@ -75,7 +75,7 @@ int verb_is_enabled(int argc, char *argv[], void *userdata) { + STRV_FOREACH(name, names) { + UnitFileState state; + +- r = unit_file_get_state(arg_scope, arg_root, *name, &state); ++ r = unit_file_get_state(arg_runtime_scope, arg_root, *name, &state); + if (r < 0) + return log_error_errno(r, "Failed to get unit file state for %s: %m", *name); + +diff --git a/src/systemctl/systemctl-list-unit-files.c b/src/systemctl/systemctl-list-unit-files.c +index 96b22041f4..72b377cde6 100644 +--- a/src/systemctl/systemctl-list-unit-files.c ++++ b/src/systemctl/systemctl-list-unit-files.c +@@ -100,7 +100,7 @@ static int output_unit_file_list(const UnitFileList *units, unsigned c) { + if (show_preset_for_state(u->state)) { + const char *unit_preset_str, *on_preset_color; + +- r = unit_file_query_preset(arg_scope, arg_root, id, &presets); ++ r = unit_file_query_preset(arg_runtime_scope, arg_root, id, &presets); + if (r < 0) { + unit_preset_str = "n/a"; + on_preset_color = underline ? on_underline : ansi_normal(); +@@ -151,7 +151,7 @@ int verb_list_unit_files(int argc, char *argv[], void *userdata) { + if (!h) + return log_oom(); + +- r = unit_file_get_list(arg_scope, arg_root, h, arg_states, strv_skip(argv, 1)); ++ r = unit_file_get_list(arg_runtime_scope, arg_root, h, arg_states, strv_skip(argv, 1)); + if (r < 0) { + unit_file_list_free(h); + return log_error_errno(r, "Failed to get unit file list: %m"); +diff --git a/src/systemctl/systemctl-preset-all.c b/src/systemctl/systemctl-preset-all.c +index 68dbff5048..ed117e077c 100644 +--- a/src/systemctl/systemctl-preset-all.c ++++ b/src/systemctl/systemctl-preset-all.c +@@ -13,7 +13,7 @@ int verb_preset_all(int argc, char *argv[], void *userdata) { + int r; + + if (install_client_side()) { +- r = unit_file_preset_all(arg_scope, unit_file_flags_from_args(), arg_root, arg_preset_mode, &changes, &n_changes); ++ r = unit_file_preset_all(arg_runtime_scope, unit_file_flags_from_args(), arg_root, arg_preset_mode, &changes, &n_changes); + install_changes_dump(r, "preset", changes, n_changes, arg_quiet); + + if (r > 0) +diff --git a/src/systemctl/systemctl-set-default.c b/src/systemctl/systemctl-set-default.c +index c2dbf97649..b23c459b24 100644 +--- a/src/systemctl/systemctl-set-default.c ++++ b/src/systemctl/systemctl-set-default.c +@@ -49,7 +49,7 @@ static int determine_default(char **ret_name) { + int r; + + if (install_client_side()) { +- r = unit_file_get_default(arg_scope, arg_root, ret_name); ++ r = unit_file_get_default(arg_runtime_scope, arg_root, ret_name); + if (r < 0) + return log_error_errno(r, "Failed to get default target: %m"); + return 0; +@@ -107,7 +107,7 @@ int verb_set_default(int argc, char *argv[], void *userdata) { + return log_error_errno(r, "Failed to mangle unit name: %m"); + + if (install_client_side()) { +- r = unit_file_set_default(arg_scope, UNIT_FILE_FORCE, arg_root, unit, &changes, &n_changes); ++ r = unit_file_set_default(arg_runtime_scope, UNIT_FILE_FORCE, arg_root, unit, &changes, &n_changes); + install_changes_dump(r, "set default", changes, n_changes, arg_quiet); + if (r < 0) + goto finish; +diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c +index 03d53bc13c..73afff56ca 100644 +--- a/src/systemctl/systemctl-show.c ++++ b/src/systemctl/systemctl-show.c +@@ -787,7 +787,7 @@ static void print_status_info( + getuid(), + get_output_flags() | OUTPUT_BEGIN_NEWLINE, + SD_JOURNAL_LOCAL_ONLY, +- arg_scope == LOOKUP_SCOPE_SYSTEM, ++ arg_runtime_scope == RUNTIME_SCOPE_SYSTEM, + ellipsized); + + if (i->need_daemon_reload) +diff --git a/src/systemctl/systemctl-start-special.c b/src/systemctl/systemctl-start-special.c +index 4dee3028b0..503d69f2a0 100644 +--- a/src/systemctl/systemctl-start-special.c ++++ b/src/systemctl/systemctl-start-special.c +@@ -257,10 +257,10 @@ int verb_start_special(int argc, char *argv[], void *userdata) { + int verb_start_system_special(int argc, char *argv[], void *userdata) { + /* Like start_special above, but raises an error when running in user mode */ + +- if (arg_scope != LOOKUP_SCOPE_SYSTEM) ++ if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Bad action for %s mode.", +- arg_scope == LOOKUP_SCOPE_GLOBAL ? "--global" : "--user"); ++ arg_runtime_scope == RUNTIME_SCOPE_GLOBAL ? "--global" : "--user"); + + return verb_start_special(argc, argv, userdata); + } +diff --git a/src/systemctl/systemctl-start-unit.c b/src/systemctl/systemctl-start-unit.c +index 42a5b086c3..bb2b0394d0 100644 +--- a/src/systemctl/systemctl-start-unit.c ++++ b/src/systemctl/systemctl-start-unit.c +@@ -168,8 +168,8 @@ fail: + BUS_ERROR_UNIT_MASKED, + BUS_ERROR_JOB_TYPE_NOT_APPLICABLE)) + log_error("See %s logs and 'systemctl%s status%s %s' for details.", +- arg_scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user", +- arg_scope == LOOKUP_SCOPE_SYSTEM ? "" : " --user", ++ runtime_scope_to_string(arg_runtime_scope), ++ arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "" : " --user", + name[0] == '-' ? " --" : "", + name); + +@@ -242,7 +242,7 @@ static const char** make_extra_args(const char *extra_args[static 4]) { + + assert(extra_args); + +- if (arg_scope != LOOKUP_SCOPE_SYSTEM) ++ if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + extra_args[n++] = "--user"; + + if (arg_transport == BUS_TRANSPORT_REMOTE) { +diff --git a/src/systemctl/systemctl-sysv-compat.c b/src/systemctl/systemctl-sysv-compat.c +index f6889993ed..6add331b81 100644 +--- a/src/systemctl/systemctl-sysv-compat.c ++++ b/src/systemctl/systemctl-sysv-compat.c +@@ -116,7 +116,7 @@ int enable_sysv_units(const char *verb, char **args) { + + /* Processes all SysV units, and reshuffles the array so that afterwards only the native units remain */ + +- if (arg_scope != LOOKUP_SCOPE_SYSTEM) ++ if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + return 0; + + if (getenv_bool("SYSTEMCTL_SKIP_SYSV") > 0) +@@ -128,7 +128,7 @@ int enable_sysv_units(const char *verb, char **args) { + "is-enabled")) + return 0; + +- r = lookup_paths_init_or_warn(&paths, arg_scope, LOOKUP_PATHS_EXCLUDE_GENERATED, arg_root); ++ r = lookup_paths_init_or_warn(&paths, arg_runtime_scope, LOOKUP_PATHS_EXCLUDE_GENERATED, arg_root); + if (r < 0) + return r; + +@@ -158,7 +158,7 @@ int enable_sysv_units(const char *verb, char **args) { + if (path_is_absolute(name)) + continue; + +- j = unit_file_exists(arg_scope, &paths, name); ++ j = unit_file_exists(arg_runtime_scope, &paths, name); + if (j < 0 && !IN_SET(j, -ELOOP, -ERFKILL, -EADDRNOTAVAIL)) + return log_error_errno(j, "Failed to look up unit file state: %m"); + found_native = j != 0; +diff --git a/src/systemctl/systemctl-util.c b/src/systemctl/systemctl-util.c +index 1f8fda8ac1..bb38bc0a4a 100644 +--- a/src/systemctl/systemctl-util.c ++++ b/src/systemctl/systemctl-util.c +@@ -44,14 +44,10 @@ int acquire_bus(BusFocus focus, sd_bus **ret) { + focus = BUS_FULL; + + if (!buses[focus]) { +- bool user; +- +- user = arg_scope != LOOKUP_SCOPE_SYSTEM; +- + if (focus == BUS_MANAGER) +- r = bus_connect_transport_systemd(arg_transport, arg_host, user, &buses[focus]); ++ r = bus_connect_transport_systemd(arg_transport, arg_host, arg_runtime_scope, &buses[focus]); + else +- r = bus_connect_transport(arg_transport, arg_host, user, &buses[focus]); ++ r = bus_connect_transport(arg_transport, arg_host, arg_runtime_scope, &buses[focus]); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +@@ -73,7 +69,7 @@ void ask_password_agent_open_maybe(void) { + if (arg_dry_run) + return; + +- if (arg_scope != LOOKUP_SCOPE_SYSTEM) ++ if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + return; + + ask_password_agent_open_if_enabled(arg_transport, arg_ask_password); +@@ -82,7 +78,7 @@ void ask_password_agent_open_maybe(void) { + void polkit_agent_open_maybe(void) { + /* Open the polkit agent as a child process if necessary */ + +- if (arg_scope != LOOKUP_SCOPE_SYSTEM) ++ if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + return; + + polkit_agent_open_if_enabled(arg_transport, arg_ask_password); +@@ -379,7 +375,7 @@ void warn_unit_file_changed(const char *unit) { + + log_warning("Warning: The unit file, source configuration file or drop-ins of %s changed on disk. Run 'systemctl%s daemon-reload' to reload units.", + unit, +- arg_scope == LOOKUP_SCOPE_SYSTEM ? "" : " --user"); ++ arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "" : " --user"); + } + + int unit_file_find_path(LookupPaths *lp, const char *unit_name, char **ret_unit_path) { +@@ -814,7 +810,7 @@ bool install_client_side(void) { + if (!isempty(arg_root)) + return true; + +- if (arg_scope == LOOKUP_SCOPE_GLOBAL) ++ if (arg_runtime_scope == RUNTIME_SCOPE_GLOBAL) + return true; + + /* Unsupported environment variable, mostly for debugging purposes */ +diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c +index 9dfde28426..cfdaa2baa8 100644 +--- a/src/systemctl/systemctl.c ++++ b/src/systemctl/systemctl.c +@@ -69,7 +69,7 @@ char **arg_properties = NULL; + bool arg_all = false; + enum dependency arg_dependency = DEPENDENCY_FORWARD; + const char *_arg_job_mode = NULL; +-LookupScope arg_scope = LOOKUP_SCOPE_SYSTEM; ++RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + bool arg_wait = false; + bool arg_no_block = false; + int arg_legend = -1; /* -1: true, unless --quiet is passed, 1: true */ +@@ -636,15 +636,15 @@ static int systemctl_parse_argv(int argc, char *argv[]) { + break; + + case ARG_USER: +- arg_scope = LOOKUP_SCOPE_USER; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + break; + + case ARG_SYSTEM: +- arg_scope = LOOKUP_SCOPE_SYSTEM; ++ arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + break; + + case ARG_GLOBAL: +- arg_scope = LOOKUP_SCOPE_GLOBAL; ++ arg_runtime_scope = RUNTIME_SCOPE_GLOBAL; + break; + + case ARG_WAIT: +@@ -978,10 +978,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) { + + /* If we are in --user mode, there's no point in talking to PolicyKit or the infra to query system + * passwords */ +- if (arg_scope != LOOKUP_SCOPE_SYSTEM) ++ if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + arg_ask_password = false; + +- if (arg_transport == BUS_TRANSPORT_REMOTE && arg_scope != LOOKUP_SCOPE_SYSTEM) ++ if (arg_transport == BUS_TRANSPORT_REMOTE && arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Cannot access user instance remotely."); + +diff --git a/src/systemctl/systemctl.h b/src/systemctl/systemctl.h +index 1a7a6e28d3..1255ff9985 100644 +--- a/src/systemctl/systemctl.h ++++ b/src/systemctl/systemctl.h +@@ -51,7 +51,7 @@ extern char **arg_properties; + extern bool arg_all; + extern enum dependency arg_dependency; + extern const char *_arg_job_mode; +-extern LookupScope arg_scope; ++extern RuntimeScope arg_runtime_scope; + extern bool arg_wait; + extern bool arg_no_block; + extern int arg_legend; +diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c +index 3c5df6c3ec..fa5a4d2fb5 100644 +--- a/src/sysv-generator/sysv-generator.c ++++ b/src/sysv-generator/sysv-generator.c +@@ -748,7 +748,7 @@ static int enumerate_sysv(const LookupPaths *lp, Hashmap *all_services) { + if (hashmap_contains(all_services, name)) + continue; + +- r = unit_file_exists(LOOKUP_SCOPE_SYSTEM, lp, name); ++ r = unit_file_exists(RUNTIME_SCOPE_SYSTEM, lp, name); + if (r < 0 && !IN_SET(r, -ELOOP, -ERFKILL, -EADDRNOTAVAIL)) { + log_debug_errno(r, "Failed to detect whether %s exists, skipping: %m", name); + continue; +@@ -892,7 +892,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late) + + assert_se(arg_dest = dest_late); + +- r = lookup_paths_init_or_warn(&lp, LOOKUP_SCOPE_SYSTEM, LOOKUP_PATHS_EXCLUDE_GENERATED, NULL); ++ r = lookup_paths_init_or_warn(&lp, RUNTIME_SCOPE_SYSTEM, LOOKUP_PATHS_EXCLUDE_GENERATED, NULL); + if (r < 0) + return r; + +diff --git a/src/test/test-bpf-firewall.c b/src/test/test-bpf-firewall.c +index d655058d3d..c4175bcb0e 100644 +--- a/src/test/test-bpf-firewall.c ++++ b/src/test/test-bpf-firewall.c +@@ -94,7 +94,7 @@ int main(int argc, char *argv[]) { + + /* The simple tests succeeded. Now let's try full unit-based use-case. */ + +- assert_se(manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0); ++ assert_se(manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0); + assert_se(manager_startup(m, NULL, NULL, NULL) >= 0); + + assert_se(u = unit_new(m, sizeof(Service))); +diff --git a/src/test/test-bpf-foreign-programs.c b/src/test/test-bpf-foreign-programs.c +index 0445c39855..35c7e0d692 100644 +--- a/src/test/test-bpf-foreign-programs.c ++++ b/src/test/test-bpf-foreign-programs.c +@@ -301,7 +301,7 @@ int main(int argc, char *argv[]) { + assert_se(set_unit_path(unit_dir) >= 0); + assert_se(runtime_dir = setup_fake_runtime_dir()); + +- assert_se(manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0); ++ assert_se(manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0); + assert_se(manager_startup(m, NULL, NULL, NULL) >= 0); + + assert_se(test_bpf_cgroup_programs(m, +diff --git a/src/test/test-bpf-lsm.c b/src/test/test-bpf-lsm.c +index e1df62f1a6..42ea64cd0a 100644 +--- a/src/test/test-bpf-lsm.c ++++ b/src/test/test-bpf-lsm.c +@@ -86,7 +86,7 @@ int main(int argc, char *argv[]) { + assert_se(set_unit_path(unit_dir) >= 0); + assert_se(runtime_dir = setup_fake_runtime_dir()); + +- assert_se(manager_new(LOOKUP_SCOPE_SYSTEM, MANAGER_TEST_RUN_BASIC, &m) >= 0); ++ assert_se(manager_new(RUNTIME_SCOPE_SYSTEM, MANAGER_TEST_RUN_BASIC, &m) >= 0); + assert_se(manager_startup(m, NULL, NULL, NULL) >= 0); + + /* We need to enable access to the filesystem where the binary is so we +diff --git a/src/test/test-cgroup-mask.c b/src/test/test-cgroup-mask.c +index 57483f72c2..b26a834530 100644 +--- a/src/test/test-cgroup-mask.c ++++ b/src/test/test-cgroup-mask.c +@@ -42,7 +42,7 @@ TEST_RET(cgroup_mask, .sd_booted = true) { + assert_se(get_testdata_dir("units", &unit_dir) >= 0); + assert_se(set_unit_path(unit_dir) >= 0); + assert_se(runtime_dir = setup_fake_runtime_dir()); +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); + if (IN_SET(r, -EPERM, -EACCES)) { + log_error_errno(r, "manager_new: %m"); + return log_tests_skipped("cannot create manager"); +diff --git a/src/test/test-cgroup-unit-default.c b/src/test/test-cgroup-unit-default.c +index 94201a3ccc..62618ce562 100644 +--- a/src/test/test-cgroup-unit-default.c ++++ b/src/test/test-cgroup-unit-default.c +@@ -26,7 +26,7 @@ TEST_RET(default_memory_low, .sd_booted = true) { + assert_se(get_testdata_dir("units", &unit_dir) >= 0); + assert_se(set_unit_path(unit_dir) >= 0); + assert_se(runtime_dir = setup_fake_runtime_dir()); +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); + if (IN_SET(r, -EPERM, -EACCES)) { + log_error_errno(r, "manager_new: %m"); + return log_tests_skipped("cannot create manager"); +diff --git a/src/test/test-emergency-action.c b/src/test/test-emergency-action.c +index 36dd1e42e6..b2e6af8d62 100644 +--- a/src/test/test-emergency-action.c ++++ b/src/test/test-emergency-action.c +@@ -6,37 +6,37 @@ + TEST(parse_emergency_action) { + EmergencyAction x; + +- assert_se(parse_emergency_action("none", false, &x) == 0); ++ assert_se(parse_emergency_action("none", RUNTIME_SCOPE_USER, &x) == 0); + assert_se(x == EMERGENCY_ACTION_NONE); +- assert_se(parse_emergency_action("reboot", false, &x) == -EOPNOTSUPP); +- assert_se(parse_emergency_action("reboot-force", false, &x) == -EOPNOTSUPP); +- assert_se(parse_emergency_action("reboot-immediate", false, &x) == -EOPNOTSUPP); +- assert_se(parse_emergency_action("poweroff", false, &x) == -EOPNOTSUPP); +- assert_se(parse_emergency_action("poweroff-force", false, &x) == -EOPNOTSUPP); +- assert_se(parse_emergency_action("poweroff-immediate", false, &x) == -EOPNOTSUPP); ++ assert_se(parse_emergency_action("reboot", RUNTIME_SCOPE_USER, &x) == -EOPNOTSUPP); ++ assert_se(parse_emergency_action("reboot-force", RUNTIME_SCOPE_USER, &x) == -EOPNOTSUPP); ++ assert_se(parse_emergency_action("reboot-immediate", RUNTIME_SCOPE_USER, &x) == -EOPNOTSUPP); ++ assert_se(parse_emergency_action("poweroff", RUNTIME_SCOPE_USER, &x) == -EOPNOTSUPP); ++ assert_se(parse_emergency_action("poweroff-force", RUNTIME_SCOPE_USER, &x) == -EOPNOTSUPP); ++ assert_se(parse_emergency_action("poweroff-immediate", RUNTIME_SCOPE_USER, &x) == -EOPNOTSUPP); + assert_se(x == EMERGENCY_ACTION_NONE); +- assert_se(parse_emergency_action("exit", false, &x) == 0); ++ assert_se(parse_emergency_action("exit", RUNTIME_SCOPE_USER, &x) == 0); + assert_se(x == EMERGENCY_ACTION_EXIT); +- assert_se(parse_emergency_action("exit-force", false, &x) == 0); ++ assert_se(parse_emergency_action("exit-force", RUNTIME_SCOPE_USER, &x) == 0); + assert_se(x == EMERGENCY_ACTION_EXIT_FORCE); +- assert_se(parse_emergency_action("exit-forcee", false, &x) == -EINVAL); ++ assert_se(parse_emergency_action("exit-forcee", RUNTIME_SCOPE_USER, &x) == -EINVAL); + +- assert_se(parse_emergency_action("none", true, &x) == 0); ++ assert_se(parse_emergency_action("none", RUNTIME_SCOPE_SYSTEM, &x) == 0); + assert_se(x == EMERGENCY_ACTION_NONE); +- assert_se(parse_emergency_action("reboot", true, &x) == 0); ++ assert_se(parse_emergency_action("reboot", RUNTIME_SCOPE_SYSTEM, &x) == 0); + assert_se(x == EMERGENCY_ACTION_REBOOT); +- assert_se(parse_emergency_action("reboot-force", true, &x) == 0); ++ assert_se(parse_emergency_action("reboot-force", RUNTIME_SCOPE_SYSTEM, &x) == 0); + assert_se(x == EMERGENCY_ACTION_REBOOT_FORCE); +- assert_se(parse_emergency_action("reboot-immediate", true, &x) == 0); ++ assert_se(parse_emergency_action("reboot-immediate", RUNTIME_SCOPE_SYSTEM, &x) == 0); + assert_se(x == EMERGENCY_ACTION_REBOOT_IMMEDIATE); +- assert_se(parse_emergency_action("poweroff", true, &x) == 0); ++ assert_se(parse_emergency_action("poweroff", RUNTIME_SCOPE_SYSTEM, &x) == 0); + assert_se(x == EMERGENCY_ACTION_POWEROFF); +- assert_se(parse_emergency_action("poweroff-force", true, &x) == 0); ++ assert_se(parse_emergency_action("poweroff-force", RUNTIME_SCOPE_SYSTEM, &x) == 0); + assert_se(x == EMERGENCY_ACTION_POWEROFF_FORCE); +- assert_se(parse_emergency_action("poweroff-immediate", true, &x) == 0); +- assert_se(parse_emergency_action("exit", true, &x) == 0); +- assert_se(parse_emergency_action("exit-force", true, &x) == 0); +- assert_se(parse_emergency_action("exit-forcee", true, &x) == -EINVAL); ++ assert_se(parse_emergency_action("poweroff-immediate", RUNTIME_SCOPE_SYSTEM, &x) == 0); ++ assert_se(parse_emergency_action("exit", RUNTIME_SCOPE_SYSTEM, &x) == 0); ++ assert_se(parse_emergency_action("exit-force", RUNTIME_SCOPE_SYSTEM, &x) == 0); ++ assert_se(parse_emergency_action("exit-forcee", RUNTIME_SCOPE_SYSTEM, &x) == -EINVAL); + assert_se(x == EMERGENCY_ACTION_EXIT_FORCE); + } + +diff --git a/src/test/test-engine.c b/src/test/test-engine.c +index 600391094c..cf77e7c022 100644 +--- a/src/test/test-engine.c ++++ b/src/test/test-engine.c +@@ -93,7 +93,7 @@ int main(int argc, char *argv[]) { + assert_se(set_unit_path(unit_dir) >= 0); + assert_se(runtime_dir = setup_fake_runtime_dir()); + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); + if (manager_errno_skip_test(r)) + return log_tests_skipped_errno(r, "manager_new"); + assert_se(r >= 0); +diff --git a/src/test/test-execute.c b/src/test/test-execute.c +index 20d6035cee..ff8e24bb68 100644 +--- a/src/test/test-execute.c ++++ b/src/test/test-execute.c +@@ -1150,7 +1150,7 @@ typedef struct test_entry { + + #define entry(x) {x, #x} + +-static void run_tests(LookupScope scope, char **patterns) { ++static void run_tests(RuntimeScope scope, char **patterns) { + _cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL; + _cleanup_free_ char *unit_paths = NULL; + _cleanup_(manager_freep) Manager *m = NULL; +@@ -1304,7 +1304,7 @@ TEST(run_tests_root) { + + if (prepare_ns("(test-execute-root)") == 0) { + can_unshare = true; +- run_tests(LOOKUP_SCOPE_SYSTEM, filters); ++ run_tests(RUNTIME_SCOPE_SYSTEM, filters); + _exit(EXIT_SUCCESS); + } + } +@@ -1313,7 +1313,7 @@ TEST(run_tests_without_unshare) { + if (!have_namespaces()) { + /* unshare() is already filtered. */ + can_unshare = false; +- run_tests(LOOKUP_SCOPE_SYSTEM, strv_skip(saved_argv, 1)); ++ run_tests(RUNTIME_SCOPE_SYSTEM, strv_skip(saved_argv, 1)); + return; + } + +@@ -1341,7 +1341,7 @@ TEST(run_tests_without_unshare) { + assert_se(errno == EOPNOTSUPP); + + can_unshare = false; +- run_tests(LOOKUP_SCOPE_SYSTEM, filters); ++ run_tests(RUNTIME_SCOPE_SYSTEM, filters); + _exit(EXIT_SUCCESS); + } + #else +@@ -1362,7 +1362,7 @@ TEST(run_tests_unprivileged) { + assert_se(capability_bounding_set_drop(0, /* right_now = */ true) >= 0); + + can_unshare = false; +- run_tests(LOOKUP_SCOPE_USER, filters); ++ run_tests(RUNTIME_SCOPE_USER, filters); + _exit(EXIT_SUCCESS); + } + } +diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c +index 1002818227..b6b1abdaee 100644 +--- a/src/test/test-install-root.c ++++ b/src/test/test-install-root.c +@@ -23,41 +23,41 @@ TEST(basic_mask_and_enable) { + InstallChange *changes = NULL; + size_t n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "a.service", NULL) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "b.service", NULL) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "c.service", NULL) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "d.service", NULL) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "e.service", NULL) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "f.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "a.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "b.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "c.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "d.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "e.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "f.service", NULL) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/a.service"); + assert_se(write_string_file(p, + "[Install]\n" + "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "a.service", NULL) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "a.service", NULL) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, "/usr/lib/systemd/system/b.service"); + assert_se(symlink("a.service", p) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "b.service", NULL) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "b.service", NULL) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + + p = strjoina(root, "/usr/lib/systemd/system/c.service"); + assert_se(symlink("/usr/lib/systemd/system/a.service", p) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "c.service", NULL) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "c.service", NULL) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + + p = strjoina(root, "/usr/lib/systemd/system/d.service"); + assert_se(symlink("c.service", p) >= 0); + + /* This one is interesting, as d follows a relative, then an absolute symlink */ +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "d.service", NULL) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "d.service", NULL) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + +- assert_se(unit_file_mask(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_mask(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/dev/null")); +@@ -67,17 +67,17 @@ TEST(basic_mask_and_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_MASKED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_MASKED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_MASKED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_MASKED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_MASKED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_MASKED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_MASKED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_MASKED); + + /* Enabling a masked unit should fail! */ +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == -ERFKILL); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == -ERFKILL); + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_unmask(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_unmask(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service"); +@@ -85,7 +85,7 @@ TEST(basic_mask_and_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == 1); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service")); +@@ -94,18 +94,18 @@ TEST(basic_mask_and_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + + /* Enabling it again should succeed but be a NOP */ +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 0); + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service"); +@@ -113,19 +113,19 @@ TEST(basic_mask_and_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + + /* Disabling a disabled unit must succeed but be a NOP */ +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 0); + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + + /* Let's enable this indirectly via a symlink */ +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("d.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("d.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service")); +@@ -134,14 +134,14 @@ TEST(basic_mask_and_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + + /* Let's try to reenable */ + +- assert_se(unit_file_reenable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("b.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_reenable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("b.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service"); +@@ -152,24 +152,24 @@ TEST(basic_mask_and_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "a.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "b.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "c.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "d.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + + /* Test masking with relative symlinks */ + + p = strjoina(root, "/usr/lib/systemd/system/e.service"); + assert_se(symlink("../../../../../../dev/null", p) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "e.service", NULL) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "e.service", &state) >= 0 && state == UNIT_FILE_MASKED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "e.service", NULL) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "e.service", &state) >= 0 && state == UNIT_FILE_MASKED); + + assert_se(unlink(p) == 0); + assert_se(symlink("/usr/../dev/null", p) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "e.service", NULL) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "e.service", &state) >= 0 && state == UNIT_FILE_MASKED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "e.service", NULL) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "e.service", &state) >= 0 && state == UNIT_FILE_MASKED); + + assert_se(unlink(p) == 0); + +@@ -180,10 +180,10 @@ TEST(basic_mask_and_enable) { + "[Install]\n" + "WantedBy=x.target\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "f.service", NULL) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "f.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "f.service", NULL) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "f.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("f.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("f.service"), &changes, &n_changes) == 1); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/f.service")); +@@ -196,7 +196,7 @@ TEST(basic_mask_and_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "f.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "f.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + } + + TEST(linked_units) { +@@ -236,9 +236,9 @@ TEST(linked_units) { + "[Install]\n" + "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked.service", NULL) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked2.service", NULL) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked3.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked2.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked3.service", NULL) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/linked2.service"); + assert_se(symlink("/opt/linked2.service", p) >= 0); +@@ -246,12 +246,12 @@ TEST(linked_units) { + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked3.service"); + assert_se(symlink("/opt/linked3.service", p) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked3.service", &state) >= 0 && state == UNIT_FILE_LINKED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked3.service", &state) >= 0 && state == UNIT_FILE_LINKED); + + /* First, let's link the unit into the search path */ +- assert_se(unit_file_link(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_link(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/opt/linked.service")); +@@ -260,10 +260,10 @@ TEST(linked_units) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked.service", &state) >= 0 && state == UNIT_FILE_LINKED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked.service", &state) >= 0 && state == UNIT_FILE_LINKED); + + /* Let's unlink it from the search path again */ +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service"); +@@ -271,10 +271,10 @@ TEST(linked_units) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked.service", NULL) == -ENOENT); + + /* Now, let's not just link it, but also enable it */ +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 2); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service"); + q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service"); +@@ -293,10 +293,10 @@ TEST(linked_units) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + + /* And let's unlink it again */ +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 2); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service"); + q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service"); +@@ -314,9 +314,9 @@ TEST(linked_units) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "linked.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "linked.service", NULL) == -ENOENT); + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked2.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked2.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 2); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked2.service"); + q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked2.service"); +@@ -335,7 +335,7 @@ TEST(linked_units) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked3.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked3.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(startswith(changes[0].path, root)); +@@ -357,18 +357,18 @@ TEST(default) { + p = strjoina(root, "/usr/lib/systemd/system/test-default.target"); + assert_se(symlink("test-default-real.target", p) >= 0); + +- assert_se(unit_file_get_default(LOOKUP_SCOPE_SYSTEM, root, &def) == -ENOENT); ++ assert_se(unit_file_get_default(RUNTIME_SCOPE_SYSTEM, root, &def) == -ENOENT); + +- assert_se(unit_file_set_default(LOOKUP_SCOPE_SYSTEM, 0, root, "idontexist.target", &changes, &n_changes) == -ENOENT); ++ assert_se(unit_file_set_default(RUNTIME_SCOPE_SYSTEM, 0, root, "idontexist.target", &changes, &n_changes) == -ENOENT); + assert_se(n_changes == 1); + assert_se(changes[0].type == -ENOENT); + assert_se(streq_ptr(changes[0].path, "idontexist.target")); + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_default(LOOKUP_SCOPE_SYSTEM, root, &def) == -ENOENT); ++ assert_se(unit_file_get_default(RUNTIME_SCOPE_SYSTEM, root, &def) == -ENOENT); + +- assert_se(unit_file_set_default(LOOKUP_SCOPE_SYSTEM, 0, root, "test-default.target", &changes, &n_changes) >= 0); ++ assert_se(unit_file_set_default(RUNTIME_SCOPE_SYSTEM, 0, root, "test-default.target", &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/test-default-real.target")); +@@ -377,7 +377,7 @@ TEST(default) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_default(LOOKUP_SCOPE_SYSTEM, root, &def) >= 0); ++ assert_se(unit_file_get_default(RUNTIME_SCOPE_SYSTEM, root, &def) >= 0); + assert_se(streq_ptr(def, "test-default-real.target")); + } + +@@ -398,7 +398,7 @@ TEST(add_dependency) { + p = strjoina(root, "/usr/lib/systemd/system/add-dependency-test-service.service"); + assert_se(symlink("real-add-dependency-test-service.service", p) >= 0); + +- assert_se(unit_file_add_dependency(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("add-dependency-test-service.service"), "add-dependency-test-target.target", UNIT_WANTS, &changes, &n_changes) >= 0); ++ assert_se(unit_file_add_dependency(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("add-dependency-test-service.service"), "add-dependency-test-target.target", UNIT_WANTS, &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/real-add-dependency-test-service.service")); +@@ -416,10 +416,10 @@ TEST(template_enable) { + + log_info("== %s ==", __func__); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@def.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@foo.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@def.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@foo.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/template@.service"); + assert_se(write_string_file(p, +@@ -430,16 +430,16 @@ TEST(template_enable) { + p = strjoina(root, "/usr/lib/systemd/system/template-symlink@.service"); + assert_se(symlink("template@.service", p) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + log_info("== %s with template@.service enabled ==", __func__); + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service")); +@@ -448,30 +448,30 @@ TEST(template_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + assert_se(streq(changes[0].path, p)); + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + log_info("== %s with template@foo.service enabled ==", __func__); + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service")); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@foo.service"); +@@ -479,32 +479,32 @@ TEST(template_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_INDIRECT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_INDIRECT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + assert_se(streq(changes[0].path, p)); + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@quux.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@quux.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@quux.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@quux.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + log_info("== %s with template-symlink@quux.service enabled ==", __func__); + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template-symlink@quux.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("template-symlink@quux.service"), &changes, &n_changes) >= 0); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service")); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@quux.service"); +@@ -512,14 +512,14 @@ TEST(template_enable) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_INDIRECT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template@quux.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "template-symlink@quux.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@.service", &state) >= 0 && state == UNIT_FILE_INDIRECT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template@quux.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "template-symlink@quux.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + } + + TEST(indirect) { +@@ -528,9 +528,9 @@ TEST(indirect) { + UnitFileState state; + const char *p; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirecta.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirectb.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirectc.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirecta.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirectb.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirectc.service", &state) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/indirecta.service"); + assert_se(write_string_file(p, +@@ -545,11 +545,11 @@ TEST(indirect) { + p = strjoina(root, "/usr/lib/systemd/system/indirectc.service"); + assert_se(symlink("indirecta.service", p) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirecta.service", &state) >= 0 && state == UNIT_FILE_INDIRECT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirectb.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirectc.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirecta.service", &state) >= 0 && state == UNIT_FILE_INDIRECT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirectb.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirectc.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/indirectb.service")); +@@ -558,11 +558,11 @@ TEST(indirect) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirecta.service", &state) >= 0 && state == UNIT_FILE_INDIRECT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirectb.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "indirectc.service", &state) >= 0 && state == UNIT_FILE_ALIAS); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirecta.service", &state) >= 0 && state == UNIT_FILE_INDIRECT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirectb.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "indirectc.service", &state) >= 0 && state == UNIT_FILE_ALIAS); + +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service"); +@@ -580,8 +580,8 @@ TEST(preset_and_list) { + UnitFileList *fl; + Hashmap *h; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-yes.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-no.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-yes.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-no.service", &state) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/preset-yes.service"); + assert_se(write_string_file(p, +@@ -598,10 +598,10 @@ TEST(preset_and_list) { + "enable *-yes.*\n" + "disable *\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); ++ assert_se(unit_file_preset(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/preset-yes.service")); +@@ -610,10 +610,10 @@ TEST(preset_and_list) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service"); +@@ -621,18 +621,18 @@ TEST(preset_and_list) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-no.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); ++ assert_se(unit_file_preset(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-no.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); + assert_se(n_changes == 0); + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_preset_all(LOOKUP_SCOPE_SYSTEM, 0, root, UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); ++ assert_se(unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, 0, root, UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); + + assert_se(n_changes > 0); + +@@ -650,17 +650,17 @@ TEST(preset_and_list) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-yes.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "preset-no.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + assert_se(h = hashmap_new(&string_hash_ops)); +- assert_se(unit_file_get_list(LOOKUP_SCOPE_SYSTEM, root, h, NULL, NULL) >= 0); ++ assert_se(unit_file_get_list(RUNTIME_SCOPE_SYSTEM, root, h, NULL, NULL) >= 0); + + p = strjoina(root, "/usr/lib/systemd/system/preset-yes.service"); + q = strjoina(root, "/usr/lib/systemd/system/preset-no.service"); + + HASHMAP_FOREACH(fl, h) { +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, basename(fl->path), &state) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, basename(fl->path), &state) >= 0); + assert_se(fl->state == state); + + if (streq(fl->path, p)) { +@@ -684,17 +684,17 @@ TEST(revert) { + InstallChange *changes = NULL; + size_t n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "xx.service", NULL) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "yy.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "xx.service", NULL) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "yy.service", NULL) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/xx.service"); + assert_se(write_string_file(p, "# Empty\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "xx.service", NULL) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "xx.service", &state) >= 0 && state == UNIT_FILE_STATIC); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "xx.service", NULL) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "xx.service", &state) >= 0 && state == UNIT_FILE_STATIC); + + /* Initially there's nothing to revert */ +- assert_se(unit_file_revert(LOOKUP_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_revert(RUNTIME_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 0); + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; +@@ -703,7 +703,7 @@ TEST(revert) { + assert_se(write_string_file(p, "# Empty override\n", WRITE_STRING_FILE_CREATE) >= 0); + + /* Revert the override file */ +- assert_se(unit_file_revert(LOOKUP_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_revert(RUNTIME_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + assert_se(streq(changes[0].path, p)); +@@ -714,7 +714,7 @@ TEST(revert) { + assert_se(write_string_file(p, "# Empty dropin\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); + + /* Revert the dropin file */ +- assert_se(unit_file_revert(LOOKUP_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_revert(RUNTIME_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + assert_se(streq(changes[0].path, p)); +@@ -732,8 +732,8 @@ TEST(preset_order) { + const char *p; + UnitFileState state; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "prefix-1.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "prefix-2.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "prefix-1.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "prefix-2.service", &state) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/prefix-1.service"); + assert_se(write_string_file(p, +@@ -751,10 +751,10 @@ TEST(preset_order) { + "disable prefix-*.service\n" + "enable prefix-2.service\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "prefix-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "prefix-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "prefix-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "prefix-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("prefix-1.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); ++ assert_se(unit_file_preset(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("prefix-1.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/prefix-1.service")); +@@ -763,36 +763,36 @@ TEST(preset_order) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "prefix-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "prefix-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "prefix-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "prefix-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("prefix-2.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); ++ assert_se(unit_file_preset(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("prefix-2.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); + assert_se(n_changes == 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "prefix-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "prefix-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "prefix-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "prefix-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + } + + TEST(static_instance) { + UnitFileState state; + const char *p; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "static-instance@.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "static-instance@foo.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "static-instance@.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "static-instance@foo.service", &state) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/static-instance@.service"); + assert_se(write_string_file(p, + "[Install]\n" + "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "static-instance@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "static-instance@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "static-instance@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "static-instance@foo.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, "/usr/lib/systemd/system/static-instance@foo.service"); + assert_se(symlink("static-instance@.service", p) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "static-instance@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "static-instance@foo.service", &state) >= 0 && state == UNIT_FILE_STATIC); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "static-instance@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "static-instance@foo.service", &state) >= 0 && state == UNIT_FILE_STATIC); + } + + TEST(with_dropin) { +@@ -801,11 +801,11 @@ TEST(with_dropin) { + InstallChange *changes = NULL; + size_t n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-1.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-4a.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-4b.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-1.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-4a.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-4b.service", &state) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/with-dropin-1.service"); + assert_se(write_string_file(p, +@@ -817,7 +817,7 @@ TEST(with_dropin) { + "[Install]\n" + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service"); + assert_se(write_string_file(p, +@@ -829,7 +829,7 @@ TEST(with_dropin) { + "[Install]\n" + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, "/usr/lib/systemd/system/with-dropin-3.service"); + assert_se(write_string_file(p, +@@ -841,7 +841,7 @@ TEST(with_dropin) { + "[Install]\n" + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, "/usr/lib/systemd/system/with-dropin-4a.service"); + assert_se(write_string_file(p, +@@ -853,16 +853,16 @@ TEST(with_dropin) { + "[Install]\n" + "Also=with-dropin-4b.service\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-4a.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-4a.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, "/usr/lib/systemd/system/with-dropin-4b.service"); + assert_se(write_string_file(p, + "[Install]\n" + "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-4b.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-4b.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-1.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-1.service"), &changes, &n_changes) == 1); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK); +@@ -875,8 +875,8 @@ TEST(with_dropin) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2.service"), &changes, &n_changes) == 1); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK); +@@ -889,8 +889,8 @@ TEST(with_dropin) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-3.service"), &changes, &n_changes) == 1); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-3.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK); +@@ -903,8 +903,8 @@ TEST(with_dropin) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-4a.service"), &changes, &n_changes) == 2); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-4a.service"), &changes, &n_changes) == 2); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK); +@@ -917,11 +917,11 @@ TEST(with_dropin) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-4a.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-4b.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-4a.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-4b.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + } + + TEST(with_dropin_template) { +@@ -930,9 +930,9 @@ TEST(with_dropin_template) { + InstallChange *changes = NULL; + size_t n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-1@.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2@.service", &state) == -ENOENT); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3@.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-1@.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-2@.service", &state) == -ENOENT); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3@.service", &state) == -ENOENT); + + p = strjoina(root, "/usr/lib/systemd/system/with-dropin-1@.service"); + assert_se(write_string_file(p, +@@ -944,7 +944,7 @@ TEST(with_dropin_template) { + "[Install]\n" + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-1@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-1@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, "/usr/lib/systemd/system/with-dropin-2@.service"); + assert_se(write_string_file(p, +@@ -956,7 +956,7 @@ TEST(with_dropin_template) { + "[Install]\n" + "WantedBy=graphical.target\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-2@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, "/usr/lib/systemd/system/with-dropin-3@.service"); + assert_se(write_string_file(p, +@@ -969,9 +969,9 @@ TEST(with_dropin_template) { + "[Install]\n" + "DefaultInstance=instance-2\n", WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_MKDIR_0755) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-1@instance-1.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-1@instance-1.service"), &changes, &n_changes) == 1); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK); +@@ -984,7 +984,7 @@ TEST(with_dropin_template) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2@instance-1.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2@instance-1.service"), &changes, &n_changes) == 1); + assert_se(n_changes == 2); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].type == INSTALL_CHANGE_SYMLINK); +@@ -997,7 +997,7 @@ TEST(with_dropin_template) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2@instance-2.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2@instance-2.service"), &changes, &n_changes) == 1); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service")); +@@ -1006,7 +1006,7 @@ TEST(with_dropin_template) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-3@.service"), &changes, &n_changes) == 1); ++ assert_se(unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-3@.service"), &changes, &n_changes) == 1); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3@.service")); +@@ -1015,11 +1015,11 @@ TEST(with_dropin_template) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-1@instance-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2@instance-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2@instance-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3@instance-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3@instance-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-1@instance-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-2@instance-1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-2@instance-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3@instance-1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "with-dropin-3@instance-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + } + + TEST(preset_multiple_instances) { +@@ -1035,7 +1035,7 @@ TEST(preset_multiple_instances) { + "DefaultInstance=def\n" + "WantedBy=multi-user.target\n", WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + p = strjoina(root, "/usr/lib/systemd/system-preset/test.preset"); + assert_se(write_string_file(p, +@@ -1043,11 +1043,11 @@ TEST(preset_multiple_instances) { + "enable emptylist@.service\n" /* This line ensures the old functionality for templated unit still works */ + "disable *\n" , WRITE_STRING_FILE_CREATE) >= 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + + /* Preset a single instantiated unit specified in the list */ +- assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("foo@bar0.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_preset(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("foo@bar0.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_SYMLINK); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service"); +@@ -1055,7 +1055,7 @@ TEST(preset_multiple_instances) { + install_changes_free(changes, n_changes); + changes = NULL; n_changes = 0; + +- assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("foo@bar0.service"), &changes, &n_changes) >= 0); ++ assert_se(unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, root, STRV_MAKE("foo@bar0.service"), &changes, &n_changes) >= 0); + assert_se(n_changes == 1); + assert_se(changes[0].type == INSTALL_CHANGE_UNLINK); + p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service"); +@@ -1064,17 +1064,17 @@ TEST(preset_multiple_instances) { + changes = NULL; n_changes = 0; + + /* Check for preset-all case, only instances on the list should be enabled, not including the default instance */ +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@bar1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@bartest.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@bar1.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@bartest.service", &state) >= 0 && state == UNIT_FILE_DISABLED); + +- assert_se(unit_file_preset_all(LOOKUP_SCOPE_SYSTEM, 0, root, UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); ++ assert_se(unit_file_preset_all(RUNTIME_SCOPE_SYSTEM, 0, root, UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); + assert_se(n_changes > 0); + +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@bar1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); +- assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@bartest.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@def.service", &state) >= 0 && state == UNIT_FILE_DISABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@bar1.service", &state) >= 0 && state == UNIT_FILE_ENABLED); ++ assert_se(unit_file_get_state(RUNTIME_SCOPE_SYSTEM, root, "foo@bartest.service", &state) >= 0 && state == UNIT_FILE_ENABLED); + + install_changes_free(changes, n_changes); + } +diff --git a/src/test/test-install.c b/src/test/test-install.c +index c9b08d7b6a..eb02795096 100644 +--- a/src/test/test-install.c ++++ b/src/test/test-install.c +@@ -32,13 +32,13 @@ int main(int argc, char* argv[]) { + test_setup_logging(LOG_DEBUG); + + h = hashmap_new(&string_hash_ops); +- r = unit_file_get_list(LOOKUP_SCOPE_SYSTEM, NULL, h, NULL, NULL); ++ r = unit_file_get_list(RUNTIME_SCOPE_SYSTEM, NULL, h, NULL, NULL); + assert_se(r == 0); + + HASHMAP_FOREACH(p, h) { + UnitFileState s = _UNIT_FILE_STATE_INVALID; + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(p->path), &s); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(p->path), &s); + + assert_se((r < 0 && p->state == UNIT_FILE_BAD) || + (p->state == s)); +@@ -52,18 +52,18 @@ int main(int argc, char* argv[]) { + + log_info("/*** enable **/"); + +- r = unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + + log_info("/*** enable2 **/"); + +- r = unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, files[0], &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, files[0], &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_ENABLED); + +@@ -71,13 +71,13 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, files[0], &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, files[0], &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_DISABLED); + +@@ -85,16 +85,16 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_mask(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_mask(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + log_info("/*** mask2 ***/"); +- r = unit_file_mask(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_mask(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, files[0], &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, files[0], &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_MASKED); + +@@ -102,16 +102,16 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_unmask(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_unmask(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + log_info("/*** unmask2 ***/"); +- r = unit_file_unmask(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_unmask(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, files[0], &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, files[0], &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_DISABLED); + +@@ -119,13 +119,13 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_mask(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_mask(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, files[0], &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, files[0], &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_MASKED); + +@@ -133,16 +133,16 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + log_info("/*** disable2 ***/"); +- r = unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, files[0], &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, files[0], &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_MASKED); + +@@ -150,13 +150,13 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_unmask(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); ++ r = unit_file_unmask(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, files[0], &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, files[0], &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_DISABLED); + +@@ -164,13 +164,13 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes); ++ r = unit_file_enable(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_ENABLED); + +@@ -178,26 +178,26 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes); ++ r = unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); + assert_se(r < 0); + + log_info("/*** link files2 ***/"); + changes = NULL; + n_changes = 0; + +- r = unit_file_link(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes); ++ r = unit_file_link(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_LINKED); + +@@ -205,26 +205,26 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes); ++ r = unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); + assert_se(r < 0); + + log_info("/*** link files2 ***/"); + changes = NULL; + n_changes = 0; + +- r = unit_file_link(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes); ++ r = unit_file_link(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_LINKED); + +@@ -232,13 +232,13 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_reenable(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes); ++ r = unit_file_reenable(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files2, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_ENABLED); + +@@ -246,25 +246,25 @@ int main(int argc, char* argv[]) { + changes = NULL; + n_changes = 0; + +- r = unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes); ++ r = unit_file_disable(RUNTIME_SCOPE_SYSTEM, 0, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(files2[0]), &state); + assert_se(r < 0); + log_info("/*** preset files ***/"); + changes = NULL; + n_changes = 0; + +- r = unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, NULL, (char**) files, UNIT_FILE_PRESET_FULL, &changes, &n_changes); ++ r = unit_file_preset(RUNTIME_SCOPE_SYSTEM, 0, NULL, (char**) files, UNIT_FILE_PRESET_FULL, &changes, &n_changes); + assert_se(r >= 0); + + dump_changes(changes, n_changes); + install_changes_free(changes, n_changes); + +- r = unit_file_get_state(LOOKUP_SCOPE_SYSTEM, NULL, basename(files[0]), &state); ++ r = unit_file_get_state(RUNTIME_SCOPE_SYSTEM, NULL, basename(files[0]), &state); + assert_se(r >= 0); + assert_se(state == UNIT_FILE_ENABLED); + +diff --git a/src/test/test-load-fragment.c b/src/test/test-load-fragment.c +index 997c2b2524..2a27500845 100644 +--- a/src/test/test-load-fragment.c ++++ b/src/test/test-load-fragment.c +@@ -45,7 +45,7 @@ TEST_RET(unit_file_get_set) { + h = hashmap_new(&string_hash_ops); + assert_se(h); + +- r = unit_file_get_list(LOOKUP_SCOPE_SYSTEM, NULL, h, NULL, NULL); ++ r = unit_file_get_list(RUNTIME_SCOPE_SYSTEM, NULL, h, NULL, NULL); + if (IN_SET(r, -EPERM, -EACCES)) + return log_tests_skipped_errno(r, "unit_file_get_list"); + +@@ -104,7 +104,7 @@ TEST(config_parse_exec) { + _cleanup_(manager_freep) Manager *m = NULL; + _cleanup_(unit_freep) Unit *u = NULL; + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); + if (manager_errno_skip_test(r)) { + log_notice_errno(r, "Skipping test: manager_new: %m"); + return; +@@ -463,7 +463,7 @@ TEST(config_parse_log_extra_fields) { + _cleanup_(unit_freep) Unit *u = NULL; + ExecContext c = {}; + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); + if (manager_errno_skip_test(r)) { + log_notice_errno(r, "Skipping test: manager_new: %m"); + return; +@@ -548,56 +548,56 @@ TEST(install_printf, .sd_booted = true) { + strcpy(i.path, d2); \ + } while (false) + +- expect(LOOKUP_SCOPE_SYSTEM, i, "%n", "name.service"); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%N", "name"); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%p", "name"); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%i", ""); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%j", "name"); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%g", "root"); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%G", "0"); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%u", "root"); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%U", "0"); +- +- expect(LOOKUP_SCOPE_SYSTEM, i, "%m", mid); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%b", bid); +- expect(LOOKUP_SCOPE_SYSTEM, i, "%H", host); +- +- expect(LOOKUP_SCOPE_SYSTEM, i2, "%g", "root"); +- expect(LOOKUP_SCOPE_SYSTEM, i2, "%G", "0"); +- expect(LOOKUP_SCOPE_SYSTEM, i2, "%u", "root"); +- expect(LOOKUP_SCOPE_SYSTEM, i2, "%U", "0"); +- +- expect(LOOKUP_SCOPE_USER, i2, "%g", group); +- expect(LOOKUP_SCOPE_USER, i2, "%G", gid); +- expect(LOOKUP_SCOPE_USER, i2, "%u", user); +- expect(LOOKUP_SCOPE_USER, i2, "%U", uid); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%n", "name.service"); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%N", "name"); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%p", "name"); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%i", ""); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%j", "name"); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%g", "root"); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%G", "0"); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%u", "root"); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%U", "0"); ++ ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%m", mid); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%b", bid); ++ expect(RUNTIME_SCOPE_SYSTEM, i, "%H", host); ++ ++ expect(RUNTIME_SCOPE_SYSTEM, i2, "%g", "root"); ++ expect(RUNTIME_SCOPE_SYSTEM, i2, "%G", "0"); ++ expect(RUNTIME_SCOPE_SYSTEM, i2, "%u", "root"); ++ expect(RUNTIME_SCOPE_SYSTEM, i2, "%U", "0"); ++ ++ expect(RUNTIME_SCOPE_USER, i2, "%g", group); ++ expect(RUNTIME_SCOPE_USER, i2, "%G", gid); ++ expect(RUNTIME_SCOPE_USER, i2, "%u", user); ++ expect(RUNTIME_SCOPE_USER, i2, "%U", uid); + + /* gcc-12.0.1-0.9.fc36.x86_64 insist that streq(…, NULL) is called, + * even though the call is inside of a conditional where the pointer is checked. :( */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wnonnull" +- expect(LOOKUP_SCOPE_GLOBAL, i2, "%g", NULL); +- expect(LOOKUP_SCOPE_GLOBAL, i2, "%G", NULL); +- expect(LOOKUP_SCOPE_GLOBAL, i2, "%u", NULL); +- expect(LOOKUP_SCOPE_GLOBAL, i2, "%U", NULL); ++ expect(RUNTIME_SCOPE_GLOBAL, i2, "%g", NULL); ++ expect(RUNTIME_SCOPE_GLOBAL, i2, "%G", NULL); ++ expect(RUNTIME_SCOPE_GLOBAL, i2, "%u", NULL); ++ expect(RUNTIME_SCOPE_GLOBAL, i2, "%U", NULL); + #pragma GCC diagnostic pop + +- expect(LOOKUP_SCOPE_SYSTEM, i3, "%n", "name@inst.service"); +- expect(LOOKUP_SCOPE_SYSTEM, i3, "%N", "name@inst"); +- expect(LOOKUP_SCOPE_SYSTEM, i3, "%p", "name"); +- expect(LOOKUP_SCOPE_USER, i3, "%g", group); +- expect(LOOKUP_SCOPE_USER, i3, "%G", gid); +- expect(LOOKUP_SCOPE_USER, i3, "%u", user); +- expect(LOOKUP_SCOPE_USER, i3, "%U", uid); +- +- expect(LOOKUP_SCOPE_SYSTEM, i3, "%m", mid); +- expect(LOOKUP_SCOPE_SYSTEM, i3, "%b", bid); +- expect(LOOKUP_SCOPE_SYSTEM, i3, "%H", host); +- +- expect(LOOKUP_SCOPE_USER, i4, "%g", group); +- expect(LOOKUP_SCOPE_USER, i4, "%G", gid); +- expect(LOOKUP_SCOPE_USER, i4, "%u", user); +- expect(LOOKUP_SCOPE_USER, i4, "%U", uid); ++ expect(RUNTIME_SCOPE_SYSTEM, i3, "%n", "name@inst.service"); ++ expect(RUNTIME_SCOPE_SYSTEM, i3, "%N", "name@inst"); ++ expect(RUNTIME_SCOPE_SYSTEM, i3, "%p", "name"); ++ expect(RUNTIME_SCOPE_USER, i3, "%g", group); ++ expect(RUNTIME_SCOPE_USER, i3, "%G", gid); ++ expect(RUNTIME_SCOPE_USER, i3, "%u", user); ++ expect(RUNTIME_SCOPE_USER, i3, "%U", uid); ++ ++ expect(RUNTIME_SCOPE_SYSTEM, i3, "%m", mid); ++ expect(RUNTIME_SCOPE_SYSTEM, i3, "%b", bid); ++ expect(RUNTIME_SCOPE_SYSTEM, i3, "%H", host); ++ ++ expect(RUNTIME_SCOPE_USER, i4, "%g", group); ++ expect(RUNTIME_SCOPE_USER, i4, "%G", gid); ++ expect(RUNTIME_SCOPE_USER, i4, "%u", user); ++ expect(RUNTIME_SCOPE_USER, i4, "%U", uid); + } + + static uint64_t make_cap(int cap) { +@@ -826,7 +826,7 @@ TEST(config_parse_unit_env_file) { + _cleanup_strv_free_ char **files = NULL; + int r; + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); + if (manager_errno_skip_test(r)) { + log_notice_errno(r, "Skipping test: manager_new: %m"); + return; +@@ -959,7 +959,7 @@ TEST(unit_is_recursive_template_dependency) { + Unit *u; + int r; + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); + if (manager_errno_skip_test(r)) { + log_notice_errno(r, "Skipping test: manager_new: %m"); + return; +diff --git a/src/test/test-path-lookup.c b/src/test/test-path-lookup.c +index c98a1f4b73..431a85965d 100644 +--- a/src/test/test-path-lookup.c ++++ b/src/test/test-path-lookup.c +@@ -11,7 +11,7 @@ + #include "tests.h" + #include "tmpfile-util.h" + +-static void test_paths_one(LookupScope scope) { ++static void test_paths_one(RuntimeScope scope) { + _cleanup_(rm_rf_physical_and_freep) char *tmp = NULL; + _cleanup_(lookup_paths_free) LookupPaths lp_without_env = {}; + _cleanup_(lookup_paths_free) LookupPaths lp_with_env = {}; +@@ -34,9 +34,9 @@ static void test_paths_one(LookupScope scope) { + } + + TEST(paths) { +- test_paths_one(LOOKUP_SCOPE_SYSTEM); +- test_paths_one(LOOKUP_SCOPE_USER); +- test_paths_one(LOOKUP_SCOPE_GLOBAL); ++ test_paths_one(RUNTIME_SCOPE_SYSTEM); ++ test_paths_one(RUNTIME_SCOPE_USER); ++ test_paths_one(RUNTIME_SCOPE_GLOBAL); + } + + TEST(user_and_global_paths) { +@@ -48,8 +48,8 @@ TEST(user_and_global_paths) { + assert_se(unsetenv("XDG_DATA_DIRS") == 0); + assert_se(unsetenv("XDG_CONFIG_DIRS") == 0); + +- assert_se(lookup_paths_init(&lp_global, LOOKUP_SCOPE_GLOBAL, 0, NULL) == 0); +- assert_se(lookup_paths_init(&lp_user, LOOKUP_SCOPE_USER, 0, NULL) == 0); ++ assert_se(lookup_paths_init(&lp_global, RUNTIME_SCOPE_GLOBAL, 0, NULL) == 0); ++ assert_se(lookup_paths_init(&lp_user, RUNTIME_SCOPE_USER, 0, NULL) == 0); + g = lp_global.search_path; + u = lp_user.search_path; + +@@ -70,7 +70,7 @@ TEST(user_and_global_paths) { + log_info("+ %s", *p); + } + +-static void test_generator_binary_paths_one(LookupScope scope) { ++static void test_generator_binary_paths_one(RuntimeScope scope) { + _cleanup_(rm_rf_physical_and_freep) char *tmp = NULL; + _cleanup_strv_free_ char **gp_without_env = NULL; + _cleanup_strv_free_ char **env_gp_without_env = NULL; +@@ -85,13 +85,13 @@ static void test_generator_binary_paths_one(LookupScope scope) { + assert_se(unsetenv("SYSTEMD_ENVIRONMENT_GENERATOR_PATH") == 0); + + gp_without_env = generator_binary_paths(scope); +- env_gp_without_env = env_generator_binary_paths(scope == LOOKUP_SCOPE_SYSTEM ? true : false); ++ env_gp_without_env = env_generator_binary_paths(scope); + +- log_info("Generators dirs (%s):", scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user"); ++ log_info("Generators dirs (%s):", runtime_scope_to_string(scope)); + STRV_FOREACH(dir, gp_without_env) + log_info(" %s", *dir); + +- log_info("Environment generators dirs (%s):", scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user"); ++ log_info("Environment generators dirs (%s):", runtime_scope_to_string(scope)); + STRV_FOREACH(dir, env_gp_without_env) + log_info(" %s", *dir); + +@@ -104,13 +104,13 @@ static void test_generator_binary_paths_one(LookupScope scope) { + assert_se(setenv("SYSTEMD_ENVIRONMENT_GENERATOR_PATH", systemd_env_generator_path, 1) == 0); + + gp_with_env = generator_binary_paths(scope); +- env_gp_with_env = env_generator_binary_paths(scope == LOOKUP_SCOPE_SYSTEM ? true : false); ++ env_gp_with_env = env_generator_binary_paths(scope); + +- log_info("Generators dirs (%s):", scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user"); ++ log_info("Generators dirs (%s):", runtime_scope_to_string(scope)); + STRV_FOREACH(dir, gp_with_env) + log_info(" %s", *dir); + +- log_info("Environment generators dirs (%s):", scope == LOOKUP_SCOPE_SYSTEM ? "system" : "user"); ++ log_info("Environment generators dirs (%s):", runtime_scope_to_string(scope)); + STRV_FOREACH(dir, env_gp_with_env) + log_info(" %s", *dir); + +@@ -119,8 +119,8 @@ static void test_generator_binary_paths_one(LookupScope scope) { + } + + TEST(generator_binary_paths) { +- test_generator_binary_paths_one(LOOKUP_SCOPE_SYSTEM); +- test_generator_binary_paths_one(LOOKUP_SCOPE_USER); ++ test_generator_binary_paths_one(RUNTIME_SCOPE_SYSTEM); ++ test_generator_binary_paths_one(RUNTIME_SCOPE_USER); + } + + DEFINE_TEST_MAIN(LOG_DEBUG); +diff --git a/src/test/test-path.c b/src/test/test-path.c +index 4066f6ad93..14f0e0a4b3 100644 +--- a/src/test/test-path.c ++++ b/src/test/test-path.c +@@ -33,7 +33,7 @@ static int setup_test(Manager **m) { + if (r == -ENOMEDIUM) + return log_tests_skipped("cgroupfs not available"); + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &tmp); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &tmp); + if (manager_errno_skip_test(r)) + return log_tests_skipped_errno(r, "manager_new"); + assert_se(r >= 0); +diff --git a/src/test/test-sched-prio.c b/src/test/test-sched-prio.c +index 721c4b61a1..3c3b8dcf4a 100644 +--- a/src/test/test-sched-prio.c ++++ b/src/test/test-sched-prio.c +@@ -30,7 +30,7 @@ int main(int argc, char *argv[]) { + assert_se(set_unit_path(unit_dir) >= 0); + assert_se(runtime_dir = setup_fake_runtime_dir()); + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m); + if (manager_errno_skip_test(r)) + return log_tests_skipped_errno(r, "manager_new"); + assert_se(r >= 0); +diff --git a/src/test/test-socket-bind.c b/src/test/test-socket-bind.c +index d7d9110343..9372f208ae 100644 +--- a/src/test/test-socket-bind.c ++++ b/src/test/test-socket-bind.c +@@ -132,7 +132,7 @@ int main(int argc, char *argv[]) { + assert_se(set_unit_path(unit_dir) >= 0); + assert_se(runtime_dir = setup_fake_runtime_dir()); + +- assert_se(manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0); ++ assert_se(manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0); + assert_se(manager_startup(m, NULL, NULL, NULL) >= 0); + + assert_se(test_socket_bind(m, "socket_bind_test.service", netcat_path, "2000", STRV_MAKE("2000"), STRV_MAKE("any")) >= 0); +diff --git a/src/test/test-specifier.c b/src/test/test-specifier.c +index d0adc1a87d..b093f83725 100644 +--- a/src/test/test-specifier.c ++++ b/src/test/test-specifier.c +@@ -47,7 +47,7 @@ TEST(specifier_escape_strv) { + static const Specifier specifier_table[] = { + COMMON_SYSTEM_SPECIFIERS, + +- COMMON_CREDS_SPECIFIERS(LOOKUP_SCOPE_USER), ++ COMMON_CREDS_SPECIFIERS(RUNTIME_SCOPE_USER), + { 'h', specifier_user_home, NULL }, + + COMMON_TMP_SPECIFIERS, +diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c +index 389113c336..695941a960 100644 +--- a/src/test/test-unit-file.c ++++ b/src/test/test-unit-file.c +@@ -40,7 +40,7 @@ TEST(unit_file_build_name_map) { + + ids = strv_skip(saved_argv, 1); + +- assert_se(lookup_paths_init(&lp, LOOKUP_SCOPE_SYSTEM, 0, NULL) >= 0); ++ assert_se(lookup_paths_init(&lp, RUNTIME_SCOPE_SYSTEM, 0, NULL) >= 0); + + assert_se(unit_file_build_name_map(&lp, &mtime, &unit_ids, &unit_names, NULL) == 1); + +@@ -156,7 +156,7 @@ TEST(unit_file_remove_from_name_map) { + _cleanup_(rm_rf_physical_and_freep) char *d = NULL; + + _cleanup_(lookup_paths_free) LookupPaths lp = {}; +- ASSERT_OK(lookup_paths_init(&lp, LOOKUP_SCOPE_SYSTEM, LOOKUP_PATHS_TEMPORARY_GENERATED, NULL)); ++ ASSERT_OK(lookup_paths_init(&lp, RUNTIME_SCOPE_SYSTEM, LOOKUP_PATHS_TEMPORARY_GENERATED, NULL)); + ASSERT_NOT_NULL(d = strdup(lp.temporary_dir)); + + for (size_t i = 0; i < 10; i++) +diff --git a/src/test/test-unit-name.c b/src/test/test-unit-name.c +index 1e230ba5f9..e50d2a4dd0 100644 +--- a/src/test/test-unit-name.c ++++ b/src/test/test-unit-name.c +@@ -285,7 +285,7 @@ TEST_RET(unit_printf, .sd_booted = true) { + assert_se(specifier_var_tmp_dir('V', NULL, NULL, NULL, &var_tmp_dir) >= 0); + assert_se(var_tmp_dir); + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); + if (manager_errno_skip_test(r)) + return log_tests_skipped_errno(r, "manager_new"); + assert_se(r == 0); +diff --git a/src/test/test-unit-serialize.c b/src/test/test-unit-serialize.c +index f84435f480..7a1e8a087a 100644 +--- a/src/test/test-unit-serialize.c ++++ b/src/test/test-unit-serialize.c +@@ -31,7 +31,7 @@ TEST(deserialize_exec_command) { + _cleanup_(manager_freep) Manager *m = NULL; + int r; + +- r = manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); ++ r = manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_MINIMAL, &m); + if (manager_errno_skip_test(r)) { + log_notice_errno(r, "Skipping test: manager_new: %m"); + return; +diff --git a/src/test/test-watch-pid.c b/src/test/test-watch-pid.c +index 34291fb539..68b56bdb66 100644 +--- a/src/test/test-watch-pid.c ++++ b/src/test/test-watch-pid.c +@@ -26,7 +26,7 @@ int main(int argc, char *argv[]) { + + assert_se(runtime_dir = setup_fake_runtime_dir()); + +- assert_se(manager_new(LOOKUP_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0); ++ assert_se(manager_new(RUNTIME_SCOPE_USER, MANAGER_TEST_RUN_BASIC, &m) >= 0); + assert_se(manager_startup(m, NULL, NULL, NULL) >= 0); + + assert_se(a = unit_new(m, sizeof(Service))); +diff --git a/src/timedate/timedatectl.c b/src/timedate/timedatectl.c +index 1283f129e1..9c4c5baf78 100644 +--- a/src/timedate/timedatectl.c ++++ b/src/timedate/timedatectl.c +@@ -1030,7 +1030,7 @@ static int run(int argc, char *argv[]) { + if (r <= 0) + return r; + +- r = bus_connect_transport(arg_transport, arg_host, false, &bus); ++ r = bus_connect_transport(arg_transport, arg_host, RUNTIME_SCOPE_SYSTEM, &bus); + if (r < 0) + return bus_log_connect_error(r, arg_transport); + +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index ead5c49874..101e1a41a7 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -194,7 +194,7 @@ typedef enum { + } CreationMode; + + static bool arg_cat_config = false; +-static bool arg_user = false; ++static RuntimeScope arg_runtime_scope = RUNTIME_SCOPE_SYSTEM; + static OperationMask arg_operation = 0; + static bool arg_boot = false; + static PagerFlags arg_pager_flags = 0; +@@ -260,7 +260,7 @@ static int specifier_directory(char specifier, const void *data, const char *roo + int r; + + assert_cc(ELEMENTSOF(paths_system) == ELEMENTSOF(paths_user)); +- paths = arg_user ? paths_user : paths_system; ++ paths = arg_runtime_scope == RUNTIME_SCOPE_USER ? paths_user : paths_system; + + i = PTR_TO_UINT(data); + assert(i < ELEMENTSOF(paths_system)); +@@ -303,7 +303,7 @@ static int log_unresolvable_specifier(const char *filename, unsigned line) { + log_level, + filename, line, 0, + "Failed to resolve specifier: %s, skipping.", +- arg_user ? "Required $XDG_... variable not defined" : "uninitialized /etc/ detected"); ++ arg_runtime_scope == RUNTIME_SCOPE_USER ? "Required $XDG_... variable not defined" : "uninitialized /etc/ detected"); + + if (!notified) + log_full(log_level, +@@ -3185,7 +3185,7 @@ static int parse_line( + { 'S', specifier_directory, UINT_TO_PTR(DIRECTORY_STATE) }, + { 't', specifier_directory, UINT_TO_PTR(DIRECTORY_RUNTIME) }, + +- COMMON_CREDS_SPECIFIERS(arg_user ? LOOKUP_SCOPE_USER : LOOKUP_SCOPE_SYSTEM), ++ COMMON_CREDS_SPECIFIERS(arg_runtime_scope), + COMMON_TMP_SPECIFIERS, + {} + }; +@@ -3741,7 +3741,7 @@ static int parse_argv(int argc, char *argv[]) { + break; + + case ARG_USER: +- arg_user = true; ++ arg_runtime_scope = RUNTIME_SCOPE_USER; + break; + + case ARG_CREATE: +@@ -3827,7 +3827,7 @@ static int parse_argv(int argc, char *argv[]) { + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "When --replace= is given, some configuration items must be specified"); + +- if (arg_root && arg_user) ++ if (arg_root && arg_runtime_scope == RUNTIME_SCOPE_USER) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Combination of --user and --root= is not supported."); + +@@ -4075,14 +4075,22 @@ static int run(int argc, char *argv[]) { + /* Descending down file system trees might take a lot of fds */ + (void) rlimit_nofile_bump(HIGH_RLIMIT_NOFILE); + +- if (arg_user) { ++ switch (arg_runtime_scope) { ++ ++ case RUNTIME_SCOPE_USER: + r = user_config_paths(&config_dirs); + if (r < 0) + return log_error_errno(r, "Failed to initialize configuration directory list: %m"); +- } else { ++ break; ++ ++ case RUNTIME_SCOPE_SYSTEM: + config_dirs = strv_split_nulstr(CONF_PATHS_NULSTR("tmpfiles.d")); + if (!config_dirs) + return log_oom(); ++ break; ++ ++ default: ++ assert_not_reached(); + } + + if (DEBUG_LOGGING) { diff --git a/SOURCES/1306-runtime-scope-add-helper-that-turns-RuntimeScope-enu.patch b/SOURCES/1306-runtime-scope-add-helper-that-turns-RuntimeScope-enu.patch new file mode 100644 index 0000000..7bcd8f1 --- /dev/null +++ b/SOURCES/1306-runtime-scope-add-helper-that-turns-RuntimeScope-enu.patch @@ -0,0 +1,68 @@ +From 2728e6821ab6f5c0c5316a367bb1aa626b036779 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Thu, 9 Mar 2023 17:41:25 +0100 +Subject: [PATCH] runtime-scope: add helper that turns RuntimeScope enum into + --system/--user string + +(cherry picked from commit 40d73340faabb6073602ba3ff41896f3478a2cbf) + +Related: RHEL-137252 +--- + src/basic/runtime-scope.c | 8 ++++++++ + src/basic/runtime-scope.h | 2 ++ + src/core/main.c | 2 +- + src/systemctl/systemctl-start-special.c | 2 +- + 4 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/basic/runtime-scope.c b/src/basic/runtime-scope.c +index 88afb53d0b..3d653d6cef 100644 +--- a/src/basic/runtime-scope.c ++++ b/src/basic/runtime-scope.c +@@ -10,3 +10,11 @@ static const char* const runtime_scope_table[_RUNTIME_SCOPE_MAX] = { + }; + + DEFINE_STRING_TABLE_LOOKUP(runtime_scope, RuntimeScope); ++ ++static const char* const runtime_scope_cmdline_option_table[_RUNTIME_SCOPE_MAX] = { ++ [RUNTIME_SCOPE_SYSTEM] = "--system", ++ [RUNTIME_SCOPE_USER] = "--user", ++ [RUNTIME_SCOPE_GLOBAL] = "--global", ++}; ++ ++DEFINE_STRING_TABLE_LOOKUP_TO_STRING(runtime_scope_cmdline_option, RuntimeScope); +diff --git a/src/basic/runtime-scope.h b/src/basic/runtime-scope.h +index 6a7f9e65d4..6553e4c199 100644 +--- a/src/basic/runtime-scope.h ++++ b/src/basic/runtime-scope.h +@@ -15,3 +15,5 @@ typedef enum RuntimeScope { + + const char *runtime_scope_to_string(RuntimeScope scope) _const_; + RuntimeScope runtime_scope_from_string(const char *s) _const_; ++ ++const char *runtime_scope_cmdline_option_to_string(RuntimeScope scope) _const_; +diff --git a/src/core/main.c b/src/core/main.c +index 3ef613a8b1..18f5781126 100644 +--- a/src/core/main.c ++++ b/src/core/main.c +@@ -1821,7 +1821,7 @@ static int do_reexecute( + * we get weird stuff from the kernel cmdline (like --) */ + if (switch_root_dir) + args[i++] = "--switched-root"; +- args[i++] = arg_runtime_scope == RUNTIME_SCOPE_SYSTEM ? "--system" : "--user"; ++ args[i++] = runtime_scope_cmdline_option_to_string(arg_runtime_scope); + args[i++] = "--deserialize"; + args[i++] = sfd; + +diff --git a/src/systemctl/systemctl-start-special.c b/src/systemctl/systemctl-start-special.c +index 503d69f2a0..8373dabe15 100644 +--- a/src/systemctl/systemctl-start-special.c ++++ b/src/systemctl/systemctl-start-special.c +@@ -260,7 +260,7 @@ int verb_start_system_special(int argc, char *argv[], void *userdata) { + if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM) + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "Bad action for %s mode.", +- arg_runtime_scope == RUNTIME_SCOPE_GLOBAL ? "--global" : "--user"); ++ runtime_scope_cmdline_option_to_string(arg_runtime_scope)); + + return verb_start_special(argc, argv, userdata); + } diff --git a/SOURCES/1307-sd-path-add-support-for-XDG_STATE_HOME.patch b/SOURCES/1307-sd-path-add-support-for-XDG_STATE_HOME.patch new file mode 100644 index 0000000..d1489b6 --- /dev/null +++ b/SOURCES/1307-sd-path-add-support-for-XDG_STATE_HOME.patch @@ -0,0 +1,79 @@ +From 3be3354126953a51625015b43ab5abc11315cd40 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 26 Jun 2023 18:55:14 +0200 +Subject: [PATCH] sd-path: add support for XDG_STATE_HOME + +(cherry picked from commit 9a653235d12a795a8bd6adf6289ea735ccae71af) + +Related: RHEL-137252 +--- + man/sd_path_lookup.xml | 1 + + src/libsystemd/sd-path/sd-path.c | 3 +++ + src/path/path.c | 2 ++ + src/systemd/sd-path.h | 5 ++++- + 4 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/man/sd_path_lookup.xml b/man/sd_path_lookup.xml +index 01fb1ed8f1..c2ea6469a1 100644 +--- a/man/sd_path_lookup.xml ++++ b/man/sd_path_lookup.xml +@@ -55,6 +55,7 @@ + + SD_PATH_USER_CONFIGURATION, + SD_PATH_USER_RUNTIME, ++ SD_PATH_USER_STATE_PRIVATE, + SD_PATH_USER_STATE_CACHE, + + SD_PATH_USER, +diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c +index 2c8181fbfb..73a51aebc2 100644 +--- a/src/libsystemd/sd-path/sd-path.c ++++ b/src/libsystemd/sd-path/sd-path.c +@@ -281,6 +281,9 @@ static int get_path(uint64_t type, char **buffer, const char **ret) { + case SD_PATH_USER_STATE_CACHE: + return from_home_dir("XDG_CACHE_HOME", ".cache", buffer, ret); + ++ case SD_PATH_USER_STATE_PRIVATE: ++ return from_home_dir("XDG_STATE_HOME", ".local/state", buffer, ret); ++ + case SD_PATH_USER: + r = get_home_dir(buffer); + if (r < 0) +diff --git a/src/path/path.c b/src/path/path.c +index 0024a60611..9d9b24d5e2 100644 +--- a/src/path/path.c ++++ b/src/path/path.c +@@ -41,6 +41,8 @@ static const char* const path_table[_SD_PATH_MAX] = { + [SD_PATH_USER_CONFIGURATION] = "user-configuration", + [SD_PATH_USER_RUNTIME] = "user-runtime", + [SD_PATH_USER_STATE_CACHE] = "user-state-cache", ++ [SD_PATH_USER_STATE_PRIVATE] = "user-state-private", ++ + [SD_PATH_USER] = "user", + [SD_PATH_USER_DOCUMENTS] = "user-documents", + [SD_PATH_USER_MUSIC] = "user-music", +diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h +index 161a8e0c8d..0c04e7c22e 100644 +--- a/src/systemd/sd-path.h ++++ b/src/systemd/sd-path.h +@@ -53,9 +53,10 @@ enum { + SD_PATH_USER_SHARED, + + /* User configuration, state, runtime ... */ +- SD_PATH_USER_CONFIGURATION, /* takes both actual configuration (like /etc) and state (like /var/lib) */ ++ SD_PATH_USER_CONFIGURATION, + SD_PATH_USER_RUNTIME, + SD_PATH_USER_STATE_CACHE, ++ /* → SD_PATH_USER_STATE_PRIVATE is added at the bottom */ + + /* User resources */ + SD_PATH_USER, /* $HOME itself */ +@@ -110,6 +111,8 @@ enum { + /* systemd-networkd search paths */ + SD_PATH_SYSTEMD_SEARCH_NETWORK, + ++ SD_PATH_USER_STATE_PRIVATE, ++ + _SD_PATH_MAX + }; + diff --git a/SOURCES/1308-sd-path-bring-spacing-in-sd-path.h-and-systemd-path-.patch b/SOURCES/1308-sd-path-bring-spacing-in-sd-path.h-and-systemd-path-.patch new file mode 100644 index 0000000..e9fc8cc --- /dev/null +++ b/SOURCES/1308-sd-path-bring-spacing-in-sd-path.h-and-systemd-path-.patch @@ -0,0 +1,57 @@ +From c5a486e8816778e6b3c6c9b02e1fb57d24f60252 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 26 Jun 2023 18:55:39 +0200 +Subject: [PATCH] sd-path: bring spacing in sd-path.h and systemd-path tool in + sync + +(cherry picked from commit 4bbfc9eac53a9bd1d239312e2572ad352e418d20) + +Related: RHEL-137252 +--- + src/path/path.c | 12 ++++++++---- + src/systemd/sd-path.h | 1 + + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/path/path.c b/src/path/path.c +index 9d9b24d5e2..6762e2c553 100644 +--- a/src/path/path.c ++++ b/src/path/path.c +@@ -62,18 +62,22 @@ static const char* const path_table[_SD_PATH_MAX] = { + [SD_PATH_SEARCH_CONFIGURATION] = "search-configuration", + + [SD_PATH_SYSTEMD_UTIL] = "systemd-util", ++ + [SD_PATH_SYSTEMD_SYSTEM_UNIT] = "systemd-system-unit", + [SD_PATH_SYSTEMD_SYSTEM_PRESET] = "systemd-system-preset", + [SD_PATH_SYSTEMD_SYSTEM_CONF] = "systemd-system-conf", +- [SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT] = "systemd-search-system-unit", +- [SD_PATH_SYSTEMD_SYSTEM_GENERATOR] = "systemd-system-generator", +- [SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR] = "systemd-search-system-generator", + [SD_PATH_SYSTEMD_USER_UNIT] = "systemd-user-unit", + [SD_PATH_SYSTEMD_USER_PRESET] = "systemd-user-preset", + [SD_PATH_SYSTEMD_USER_CONF] = "systemd-user-conf", ++ ++ [SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT] = "systemd-search-system-unit", + [SD_PATH_SYSTEMD_SEARCH_USER_UNIT] = "systemd-search-user-unit", +- [SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR] = "systemd-search-user-generator", ++ ++ [SD_PATH_SYSTEMD_SYSTEM_GENERATOR] = "systemd-system-generator", + [SD_PATH_SYSTEMD_USER_GENERATOR] = "systemd-user-generator", ++ [SD_PATH_SYSTEMD_SEARCH_SYSTEM_GENERATOR] = "systemd-search-system-generator", ++ [SD_PATH_SYSTEMD_SEARCH_USER_GENERATOR] = "systemd-search-user-generator", ++ + [SD_PATH_SYSTEMD_SLEEP] = "systemd-sleep", + [SD_PATH_SYSTEMD_SHUTDOWN] = "systemd-shutdown", + +diff --git a/src/systemd/sd-path.h b/src/systemd/sd-path.h +index 0c04e7c22e..a187cd6aee 100644 +--- a/src/systemd/sd-path.h ++++ b/src/systemd/sd-path.h +@@ -83,6 +83,7 @@ enum { + * replaces "path" by "search"), since this API is about dirs/paths anyway, and contains "path" + * already in the prefix */ + SD_PATH_SYSTEMD_UTIL, ++ + SD_PATH_SYSTEMD_SYSTEM_UNIT, + SD_PATH_SYSTEMD_SYSTEM_PRESET, + SD_PATH_SYSTEMD_SYSTEM_CONF, diff --git a/SOURCES/1309-path-tool-add-some-basic-ansi-highlighing.patch b/SOURCES/1309-path-tool-add-some-basic-ansi-highlighing.patch new file mode 100644 index 0000000..1689ff4 --- /dev/null +++ b/SOURCES/1309-path-tool-add-some-basic-ansi-highlighing.patch @@ -0,0 +1,25 @@ +From 60180ce9e6f78cfaf20bb3b3f08c3395f11908a3 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 26 Jun 2023 18:55:52 +0200 +Subject: [PATCH] path tool: add some basic ansi highlighing + +(cherry picked from commit 17f06e97e4d07448b579086b2e0217f84236d634) + +Related: RHEL-137252 +--- + src/path/path.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/path/path.c b/src/path/path.c +index 6762e2c553..77361b43af 100644 +--- a/src/path/path.c ++++ b/src/path/path.c +@@ -108,7 +108,7 @@ static int list_homes(void) { + continue; + } + +- printf("%s: %s\n", path_table[i], p); ++ printf("%s%s:%s %s\n", ansi_highlight(), path_table[i], ansi_normal(), p); + } + + return r; diff --git a/SOURCES/1310-execude-include-RuntimeScope-field-in-ExecParameters.patch b/SOURCES/1310-execude-include-RuntimeScope-field-in-ExecParameters.patch new file mode 100644 index 0000000..0045196 --- /dev/null +++ b/SOURCES/1310-execude-include-RuntimeScope-field-in-ExecParameters.patch @@ -0,0 +1,91 @@ +From 186ec2bf76640d5250809827625cb6f2a1f8f09f Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 26 Jun 2023 22:34:25 +0200 +Subject: [PATCH] execude: include RuntimeScope field in ExecParameters + +Let's decouple execute.c a bit from the Manager object, let's pass the +runtime scope (i.e. the enum that discern invocation for user or system +context) as part of ExecParameters. This makes the scope available in +various functions without having to pass the Manager object in. + +(cherry picked from commit 170d978b2f85aa0ea5c994d7821dfbf6870cffb9) + +Related: RHEL-137252 +--- + src/core/execute.c | 9 ++++++--- + src/core/execute.h | 3 +++ + src/core/unit.c | 2 ++ + 3 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/core/execute.c b/src/core/execute.c +index 35f8ccf770..404ca9fe94 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -3621,7 +3621,7 @@ static int apply_mount_namespace( + } + } + +- if (MANAGER_IS_SYSTEM(u->manager)) { ++ if (params->runtime_scope == RUNTIME_SCOPE_SYSTEM) { + propagate_dir = path_join("/run/systemd/propagate/", u->id); + if (!propagate_dir) { + r = -ENOMEM; +@@ -3639,11 +3639,14 @@ static int apply_mount_namespace( + r = -ENOMEM; + goto finalize; + } +- } else ++ } else { ++ assert(params->runtime_scope == RUNTIME_SCOPE_USER); ++ + if (asprintf(&extension_dir, "/run/user/" UID_FMT "/systemd/unit-extensions", geteuid()) < 0) { + r = -ENOMEM; + goto finalize; + } ++ } + + r = setup_namespace(root_dir, root_image, context->root_image_options, + &ns_info, context->read_write_paths, +@@ -4261,7 +4264,7 @@ static int exec_child( + * invocations themselves. Also note that while we'll only invoke NSS modules involved in user management they + * might internally call into other NSS modules that are involved in hostname resolution, we never know. */ + if (setenv("SYSTEMD_ACTIVATION_UNIT", unit->id, true) != 0 || +- setenv("SYSTEMD_ACTIVATION_SCOPE", runtime_scope_to_string(unit->manager->runtime_scope), true) != 0) { ++ setenv("SYSTEMD_ACTIVATION_SCOPE", runtime_scope_to_string(params->runtime_scope), true) != 0) { + *exit_status = EXIT_MEMORY; + return log_unit_error_errno(unit, errno, "Failed to update environment: %m"); + } +diff --git a/src/core/execute.h b/src/core/execute.h +index 4c54422073..fc0e138029 100644 +--- a/src/core/execute.h ++++ b/src/core/execute.h +@@ -24,6 +24,7 @@ typedef struct Manager Manager; + #include "nsflags.h" + #include "numa-util.h" + #include "path-util.h" ++#include "runtime-scope.h" + #include "time-util.h" + + #define EXEC_STDIN_DATA_MAX (64U*1024U*1024U) +@@ -393,6 +394,8 @@ typedef enum ExecFlags { + /* Parameters for a specific invocation of a command. This structure is put together right before a command is + * executed. */ + struct ExecParameters { ++ RuntimeScope runtime_scope; ++ + char **environment; + + int *fds; +diff --git a/src/core/unit.c b/src/core/unit.c +index e90b51d8c4..7f321c911d 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -5203,6 +5203,8 @@ int unit_set_exec_params(Unit *u, ExecParameters *p) { + if (r < 0) + return r; + ++ p->runtime_scope = u->manager->runtime_scope; ++ + p->confirm_spawn = manager_get_confirm_spawn(u->manager); + p->cgroup_supported = u->manager->cgroup_supported; + p->prefix = u->manager->prefix; diff --git a/SOURCES/1311-execute-remove-redundant-assignment.patch b/SOURCES/1311-execute-remove-redundant-assignment.patch new file mode 100644 index 0000000..54ec998 --- /dev/null +++ b/SOURCES/1311-execute-remove-redundant-assignment.patch @@ -0,0 +1,25 @@ +From c59f57077d76e7d21abfaa28fdeefb4bcfffba5d Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 26 Jun 2023 22:36:31 +0200 +Subject: [PATCH] execute: remove redundant assignment + +(cherry picked from commit d9e5137185e53ad7b8ec2ebbf23f0f990e23b4cb) + +Related: RHEL-137252 +--- + src/core/execute.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/execute.h b/src/core/execute.h +index fc0e138029..97666b0832 100644 +--- a/src/core/execute.h ++++ b/src/core/execute.h +@@ -124,7 +124,7 @@ struct ExecRuntime { + }; + + typedef enum ExecDirectoryType { +- EXEC_DIRECTORY_RUNTIME = 0, ++ EXEC_DIRECTORY_RUNTIME, + EXEC_DIRECTORY_STATE, + EXEC_DIRECTORY_CACHE, + EXEC_DIRECTORY_LOGS, diff --git a/SOURCES/1312-execute-when-recursively-chowning-StateDirectory-whe.patch b/SOURCES/1312-execute-when-recursively-chowning-StateDirectory-whe.patch new file mode 100644 index 0000000..568588f --- /dev/null +++ b/SOURCES/1312-execute-when-recursively-chowning-StateDirectory-whe.patch @@ -0,0 +1,79 @@ +From cf623677c7a565d1dc9ae1790a0bbfa63407e790 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 27 Jun 2023 11:09:03 +0200 +Subject: [PATCH] execute: when recursively chowning StateDirectory= when + spawning services, follow initial symlink + +It should be OK to allow one level of symlink for the various types of +directories like StateDirectory=, LogsDirectory= and such. + +(cherry picked from commit d5602c16324ec545c82bb59a3d60a349da7c370c) + +Related: RHEL-137252 +--- + src/core/execute.c | 2 +- + src/shared/chown-recursive.c | 7 +++++-- + src/shared/chown-recursive.h | 2 +- + src/test/test-chown-rec.c | 2 +- + 4 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/src/core/execute.c b/src/core/execute.c +index 404ca9fe94..913802dfc0 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -2521,7 +2521,7 @@ static int setup_exec_directory( + /* Then, change the ownership of the whole tree, if necessary. When dynamic users are used we + * drop the suid/sgid bits, since we really don't want SUID/SGID files for dynamic UID/GID + * assignments to exist. */ +- r = path_chown_recursive(pp ?: p, uid, gid, context->dynamic_user ? 01777 : 07777); ++ r = path_chown_recursive(pp ?: p, uid, gid, context->dynamic_user ? 01777 : 07777, AT_SYMLINK_FOLLOW); + if (r < 0) + goto fail; + } +diff --git a/src/shared/chown-recursive.c b/src/shared/chown-recursive.c +index bbc270d34b..eda0ebf554 100644 +--- a/src/shared/chown-recursive.c ++++ b/src/shared/chown-recursive.c +@@ -111,12 +111,15 @@ int path_chown_recursive( + const char *path, + uid_t uid, + gid_t gid, +- mode_t mask) { ++ mode_t mask, ++ int flags) { + + _cleanup_close_ int fd = -1; + struct stat st; + +- fd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOFOLLOW|O_NOATIME); ++ assert((flags & ~AT_SYMLINK_FOLLOW) == 0); ++ ++ fd = open(path, O_RDONLY|O_DIRECTORY|O_CLOEXEC|O_NOATIME|(FLAGS_SET(flags, AT_SYMLINK_FOLLOW) ? 0 : O_NOFOLLOW)); + if (fd < 0) + return -errno; + +diff --git a/src/shared/chown-recursive.h b/src/shared/chown-recursive.h +index 00038c3b32..2aab8e7414 100644 +--- a/src/shared/chown-recursive.h ++++ b/src/shared/chown-recursive.h +@@ -3,6 +3,6 @@ + + #include + +-int path_chown_recursive(const char *path, uid_t uid, gid_t gid, mode_t mask); ++int path_chown_recursive(const char *path, uid_t uid, gid_t gid, mode_t mask, int flags); + + int fd_chown_recursive(int fd, uid_t uid, gid_t gid, mode_t mask); +diff --git a/src/test/test-chown-rec.c b/src/test/test-chown-rec.c +index 801b49f7b7..dcff17efec 100644 +--- a/src/test/test-chown-rec.c ++++ b/src/test/test-chown-rec.c +@@ -104,7 +104,7 @@ TEST(chown_recursive) { + assert_se(st.st_gid == gid); + assert_se(has_xattr(p)); + +- assert_se(path_chown_recursive(t, 1, 2, 07777) >= 0); ++ assert_se(path_chown_recursive(t, 1, 2, 07777, 0) >= 0); + + p = strjoina(t, "/dir"); + assert_se(lstat(p, &st) >= 0); diff --git a/SOURCES/1313-execute-add-support-for-XDG_STATE_HOME-for-placing-s.patch b/SOURCES/1313-execute-add-support-for-XDG_STATE_HOME-for-placing-s.patch new file mode 100644 index 0000000..d7d0915 --- /dev/null +++ b/SOURCES/1313-execute-add-support-for-XDG_STATE_HOME-for-placing-s.patch @@ -0,0 +1,195 @@ +From 27653e83d21754c2147f0d1e1e62c0fb21d0c1f2 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 26 Jun 2023 22:42:33 +0200 +Subject: [PATCH] execute: add support for XDG_STATE_HOME for placing service + state data in --user mode + +This adds support for the new XDG_STATE_HOME env var that was added to +the xdg basedir spec. Previously, because the basedir spec didn't know +the concept we'd alias the backing dir for StateDirectory= to the one +for ConfigurationDirectory= when runnin in --user mode. With this change +we'll make separate. This brings us various benefits, such as proper +"systemctl clean" support, where we can clear service state separately +from service configuration, now in user mode too. + +This does not come without complications: retaining compatibility with +older setups is difficult, because we cannot possibly identitfy which +files in existing populated config dirs are actually "state" and which +one are true" configuration. + +Hence let's deal with this pragmatically: if we detect that a service +that has both dirs configured only has the configuration dir existing, +then symlink the state dir to the configuration dir to retain +compatibility. + +This is not great, but it's the only somewhat reasonable way out I can +see. + +Fixes: #25739 +(cherry picked from commit f9c91932b4d83faf0f95624dc82db353d0726425) + +Related: RHEL-137252 +--- + man/systemd.exec.xml | 4 +- + man/systemd.unit.xml | 4 +- + src/core/execute.c | 55 +++++++++++++++++++ + src/core/manager.c | 4 +- + src/core/unit-printf.c | 4 +- + test/test-execute/exec-specifier-user.service | 4 +- + 6 files changed, 65 insertions(+), 10 deletions(-) + +diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml +index 4927764b9b..cce0426ed4 100644 +--- a/man/systemd.exec.xml ++++ b/man/systemd.exec.xml +@@ -1324,7 +1324,7 @@ CapabilityBoundingSet=~CAP_B CAP_C + + StateDirectory= + /var/lib/ +- $XDG_CONFIG_HOME ++ $XDG_STATE_HOME + $STATE_DIRECTORY + + +@@ -1336,7 +1336,7 @@ CapabilityBoundingSet=~CAP_B CAP_C + + LogsDirectory= + /var/log/ +- $XDG_CONFIG_HOME/log/ ++ $XDG_STATE_HOME/log/ + $LOGS_DIRECTORY + + +diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml +index afa4aea5c9..a70237f06b 100644 +--- a/man/systemd.unit.xml ++++ b/man/systemd.unit.xml +@@ -2105,7 +2105,7 @@ Note that this setting is not influenced by the Us + + %L + Log directory root +- This is either /var/log (for the system manager) or the path $XDG_CONFIG_HOME resolves to with /log appended (for user managers). ++ This is either /var/log (for the system manager) or the path $XDG_STATE_HOME resolves to with /log appended (for user managers). + + + +@@ -2145,7 +2145,7 @@ Note that this setting is not influenced by the Us + + %S + State directory root +- This is either /var/lib (for the system manager) or the path $XDG_CONFIG_HOME resolves to (for user managers). ++ This is either /var/lib (for the system manager) or the path $XDG_STATE_HOME resolves to (for user managers). + + + %t +diff --git a/src/core/execute.c b/src/core/execute.c +index 913802dfc0..2adb4392f9 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -2343,6 +2343,61 @@ static int setup_exec_directory( + if (r < 0) + goto fail; + ++ if (IN_SET(type, EXEC_DIRECTORY_STATE, EXEC_DIRECTORY_LOGS) && params->runtime_scope == RUNTIME_SCOPE_USER) { ++ ++ /* If we are in user mode, and a configuration directory exists but a state directory ++ * doesn't exist, then we likely are upgrading from an older systemd version that ++ * didn't know the more recent addition to the xdg-basedir spec: the $XDG_STATE_HOME ++ * directory. In older systemd versions EXEC_DIRECTORY_STATE was aliased to ++ * EXEC_DIRECTORY_CONFIGURATION, with the advent of $XDG_STATE_HOME is is now ++ * seperated. If a service has both dirs configured but only the configuration dir ++ * exists and the state dir does not, we assume we are looking at an update ++ * situation. Hence, create a compatibility symlink, so that all expectations are ++ * met. ++ * ++ * (We also do something similar with the log directory, which still doesn't exist in ++ * the xdg basedir spec. We'll make it a subdir of the state dir.) */ ++ ++ /* this assumes the state dir is always created before the configuration dir */ ++ assert_cc(EXEC_DIRECTORY_STATE < EXEC_DIRECTORY_LOGS); ++ assert_cc(EXEC_DIRECTORY_LOGS < EXEC_DIRECTORY_CONFIGURATION); ++ ++ r = laccess(p, F_OK); ++ if (r == -ENOENT) { ++ _cleanup_free_ char *q = NULL; ++ ++ /* OK, we know that the state dir does not exist. Let's see if the dir exists ++ * under the configuration hierarchy. */ ++ ++ if (type == EXEC_DIRECTORY_STATE) ++ q = path_join(params->prefix[EXEC_DIRECTORY_CONFIGURATION], context->directories[type].items[i].path); ++ else if (type == EXEC_DIRECTORY_LOGS) ++ q = path_join(params->prefix[EXEC_DIRECTORY_CONFIGURATION], "log", context->directories[type].items[i].path); ++ else ++ assert_not_reached(); ++ if (!q) { ++ r = -ENOMEM; ++ goto fail; ++ } ++ ++ r = laccess(q, F_OK); ++ if (r >= 0) { ++ /* It does exist! This hence looks like an update. Symlink the ++ * configuration directory into the state directory. */ ++ ++ r = symlink_idempotent(q, p, /* make_relative= */ true); ++ if (r < 0) ++ goto fail; ++ ++ log_notice("Unit state directory %s missing but matching configuration directory %s exists, assuming update from systemd 253 or older, creating compatibility symlink.", p, q); ++ continue; ++ } else if (r != -ENOENT) ++ log_warning_errno(r, "Unable to detect whether unit configuration directory '%s' exists, assuming not: %m", q); ++ ++ } else if (r < 0) ++ log_warning_errno(r, "Unable to detect whether unit state directory '%s' is missing, assuming it is: %m", p); ++ } ++ + if (exec_directory_is_private(context, type)) { + /* So, here's one extra complication when dealing with DynamicUser=1 units. In that + * case we want to avoid leaving a directory around fully accessible that is owned by +diff --git a/src/core/manager.c b/src/core/manager.c +index a5337594f7..9070dc0b1f 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -703,9 +703,9 @@ static int manager_setup_prefix(Manager *m) { + + static const struct table_entry paths_user[_EXEC_DIRECTORY_TYPE_MAX] = { + [EXEC_DIRECTORY_RUNTIME] = { SD_PATH_USER_RUNTIME, NULL }, +- [EXEC_DIRECTORY_STATE] = { SD_PATH_USER_CONFIGURATION, NULL }, ++ [EXEC_DIRECTORY_STATE] = { SD_PATH_USER_STATE_PRIVATE, NULL }, + [EXEC_DIRECTORY_CACHE] = { SD_PATH_USER_STATE_CACHE, NULL }, +- [EXEC_DIRECTORY_LOGS] = { SD_PATH_USER_CONFIGURATION, "log" }, ++ [EXEC_DIRECTORY_LOGS] = { SD_PATH_USER_STATE_PRIVATE, "log" }, + [EXEC_DIRECTORY_CONFIGURATION] = { SD_PATH_USER_CONFIGURATION, NULL }, + }; + +diff --git a/src/core/unit-printf.c b/src/core/unit-printf.c +index 1b267d4fdd..2e54f3b462 100644 +--- a/src/core/unit-printf.c ++++ b/src/core/unit-printf.c +@@ -207,8 +207,8 @@ int unit_full_printf_full(const Unit *u, const char *format, size_t max_length, + * %C: the cache directory root (e.g. /var/cache or $XDG_CACHE_HOME) + * %d: the credentials directory ($CREDENTIALS_DIRECTORY) + * %E: the configuration directory root (e.g. /etc or $XDG_CONFIG_HOME) +- * %L: the log directory root (e.g. /var/log or $XDG_CONFIG_HOME/log) +- * %S: the state directory root (e.g. /var/lib or $XDG_CONFIG_HOME) ++ * %L: the log directory root (e.g. /var/log or $XDG_STATE_HOME/log) ++ * %S: the state directory root (e.g. /var/lib or $XDG_STATE_HOME) + * %t: the runtime directory root (e.g. /run or $XDG_RUNTIME_DIR) + * + * %h: the homedir of the running user +diff --git a/test/test-execute/exec-specifier-user.service b/test/test-execute/exec-specifier-user.service +index ee0301a426..ab565fb4fb 100644 +--- a/test/test-execute/exec-specifier-user.service ++++ b/test/test-execute/exec-specifier-user.service +@@ -5,7 +5,7 @@ Description=Test for specifiers + [Service] + Type=oneshot + ExecStart=sh -c 'test %t = $$XDG_RUNTIME_DIR' +-ExecStart=sh -c 'test %S = %h/.config' ++ExecStart=sh -c 'test %S = %h/.local/state' + ExecStart=sh -c 'test %C = %h/.cache' +-ExecStart=sh -c 'test %L = %h/.config/log' ++ExecStart=sh -c 'test %L = %h/.local/state/log' + ExecStart=sh -c 'test %E = %h/.config' diff --git a/SOURCES/1314-execute-associate-logs-from-setup_exec_directory-wit.patch b/SOURCES/1314-execute-associate-logs-from-setup_exec_directory-wit.patch new file mode 100644 index 0000000..317f8fa --- /dev/null +++ b/SOURCES/1314-execute-associate-logs-from-setup_exec_directory-wit.patch @@ -0,0 +1,92 @@ +From 381294403c49f78d10e48ed49f84256df36598c9 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 27 Jun 2023 11:16:01 +0200 +Subject: [PATCH] execute: associate logs from setup_exec_directory() with the + unit name + +(cherry picked from commit 59dd2bbbb6fa4e5497b1cae17b76ee132f3107c1) + +Related: RHEL-137252 +--- + src/core/execute.c | 29 +++++++++++++++-------------- + 1 file changed, 15 insertions(+), 14 deletions(-) + +diff --git a/src/core/execute.c b/src/core/execute.c +index 2adb4392f9..1e1247e702 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -2298,6 +2298,7 @@ static int create_many_symlinks(const char *root, const char *source, char **sym + } + + static int setup_exec_directory( ++ Unit *u, + const ExecContext *context, + const ExecParameters *params, + uid_t uid, +@@ -2389,13 +2390,13 @@ static int setup_exec_directory( + if (r < 0) + goto fail; + +- log_notice("Unit state directory %s missing but matching configuration directory %s exists, assuming update from systemd 253 or older, creating compatibility symlink.", p, q); ++ log_unit_notice(u, "Unit state directory %s missing but matching configuration directory %s exists, assuming update from systemd 253 or older, creating compatibility symlink.", p, q); + continue; + } else if (r != -ENOENT) +- log_warning_errno(r, "Unable to detect whether unit configuration directory '%s' exists, assuming not: %m", q); ++ log_unit_warning_errno(u, r, "Unable to detect whether unit configuration directory '%s' exists, assuming not: %m", q); + + } else if (r < 0) +- log_warning_errno(r, "Unable to detect whether unit state directory '%s' is missing, assuming it is: %m", p); ++ log_unit_warning_errno(u, r, "Unable to detect whether unit state directory '%s' is missing, assuming it is: %m", p); + } + + if (exec_directory_is_private(context, type)) { +@@ -2452,9 +2453,9 @@ static int setup_exec_directory( + * it over. Most likely the service has been upgraded from one that didn't use + * DynamicUser=1, to one that does. */ + +- log_info("Found pre-existing public %s= directory %s, migrating to %s.\n" +- "Apparently, service previously had DynamicUser= turned off, and has now turned it on.", +- exec_directory_type_to_string(type), p, pp); ++ log_unit_info(u, "Found pre-existing public %s= directory %s, migrating to %s.\n" ++ "Apparently, service previously had DynamicUser= turned off, and has now turned it on.", ++ exec_directory_type_to_string(type), p, pp); + + if (rename(p, pp) < 0) { + r = -errno; +@@ -2521,9 +2522,9 @@ static int setup_exec_directory( + /* Hmm, apparently DynamicUser= was once turned on for this service, + * but is no longer. Let's move the directory back up. */ + +- log_info("Found pre-existing private %s= directory %s, migrating to %s.\n" +- "Apparently, service previously had DynamicUser= turned on, and has now turned it off.", +- exec_directory_type_to_string(type), q, p); ++ log_unit_info(u, "Found pre-existing private %s= directory %s, migrating to %s.\n" ++ "Apparently, service previously had DynamicUser= turned on, and has now turned it off.", ++ exec_directory_type_to_string(type), q, p); + + if (unlink(p) < 0) { + r = -errno; +@@ -2556,10 +2557,10 @@ static int setup_exec_directory( + + /* Still complain if the access mode doesn't match */ + if (((st.st_mode ^ context->directories[type].mode) & 07777) != 0) +- log_warning("%s \'%s\' already exists but the mode is different. " +- "(File system: %o %sMode: %o)", +- exec_directory_type_to_string(type), context->directories[type].items[i].path, +- st.st_mode & 07777, exec_directory_type_to_string(type), context->directories[type].mode & 07777); ++ log_unit_warning(u, "%s \'%s\' already exists but the mode is different. " ++ "(File system: %o %sMode: %o)", ++ exec_directory_type_to_string(type), context->directories[type].items[i].path, ++ st.st_mode & 07777, exec_directory_type_to_string(type), context->directories[type].mode & 07777); + + continue; + } +@@ -4589,7 +4590,7 @@ static int exec_child( + needs_mount_namespace = exec_needs_mount_namespace(context, params, runtime); + + for (ExecDirectoryType dt = 0; dt < _EXEC_DIRECTORY_TYPE_MAX; dt++) { +- r = setup_exec_directory(context, params, uid, gid, dt, needs_mount_namespace, exit_status); ++ r = setup_exec_directory(unit, context, params, uid, gid, dt, needs_mount_namespace, exit_status); + if (r < 0) + return log_unit_error_errno(unit, r, "Failed to set up special execution directory in %s: %m", params->prefix[dt]); + } diff --git a/SOURCES/1315-execute-shorten-some-code-by-using-RET_NERRNO.patch b/SOURCES/1315-execute-shorten-some-code-by-using-RET_NERRNO.patch new file mode 100644 index 0000000..7220c86 --- /dev/null +++ b/SOURCES/1315-execute-shorten-some-code-by-using-RET_NERRNO.patch @@ -0,0 +1,62 @@ +From 17119db763328e6b329cbd580f79472e26104040 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 27 Jun 2023 11:19:12 +0200 +Subject: [PATCH] execute: shorten some code by using RET_NERRNO() + +(cherry picked from commit db58f5de3d9f0eb4897c2781fc226307b7ac0a5e) + +Related: RHEL-137252 +--- + src/core/execute.c | 20 ++++++++------------ + 1 file changed, 8 insertions(+), 12 deletions(-) + +diff --git a/src/core/execute.c b/src/core/execute.c +index 1e1247e702..b1f7eeca8a 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -2457,10 +2457,9 @@ static int setup_exec_directory( + "Apparently, service previously had DynamicUser= turned off, and has now turned it on.", + exec_directory_type_to_string(type), p, pp); + +- if (rename(p, pp) < 0) { +- r = -errno; ++ r = RET_NERRNO(rename(p, pp)); ++ if (r < 0) + goto fail; +- } + } else { + /* Otherwise, create the actual directory for the service */ + +@@ -2526,15 +2525,13 @@ static int setup_exec_directory( + "Apparently, service previously had DynamicUser= turned on, and has now turned it off.", + exec_directory_type_to_string(type), q, p); + +- if (unlink(p) < 0) { +- r = -errno; ++ r = RET_NERRNO(unlink(p)); ++ if (r < 0) + goto fail; +- } + +- if (rename(q, p) < 0) { +- r = -errno; ++ r = RET_NERRNO(rename(q, p)); ++ if (r < 0) + goto fail; +- } + } + } + +@@ -2550,10 +2547,9 @@ static int setup_exec_directory( + * as in the common case it is not written to by a service, and shall + * not be writable. */ + +- if (stat(p, &st) < 0) { +- r = -errno; ++ r = RET_NERRNO(stat(p, &st)); ++ if (r < 0) + goto fail; +- } + + /* Still complain if the access mode doesn't match */ + if (((st.st_mode ^ context->directories[type].mode) & 07777) != 0) diff --git a/SOURCES/1316-execute-shorten-code-by-making-use-of-laccess-return.patch b/SOURCES/1316-execute-shorten-code-by-making-use-of-laccess-return.patch new file mode 100644 index 0000000..f2722ec --- /dev/null +++ b/SOURCES/1316-execute-shorten-code-by-making-use-of-laccess-return.patch @@ -0,0 +1,26 @@ +From f252ea93dbc029704c7c8fe408a60ee7effdc242 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 27 Jun 2023 11:19:31 +0200 +Subject: [PATCH] execute: shorten code by making use of laccess() return code + properly + +(cherry picked from commit b93d24e07d903d5860f20ec97849760091348d98) + +Related: RHEL-137252 +--- + src/core/execute.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/execute.c b/src/core/execute.c +index b1f7eeca8a..0ae4640382 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -2447,7 +2447,7 @@ static int setup_exec_directory( + goto fail; + + if (is_dir(p, false) > 0 && +- (laccess(pp, F_OK) < 0 && errno == ENOENT)) { ++ (laccess(pp, F_OK) == -ENOENT)) { + + /* Hmm, the private directory doesn't exist yet, but the normal one exists? If so, move + * it over. Most likely the service has been upgraded from one that didn't use diff --git a/SOURCES/1317-execute-don-t-bother-with-chowning-StateDirectory-an.patch b/SOURCES/1317-execute-don-t-bother-with-chowning-StateDirectory-an.patch new file mode 100644 index 0000000..a931f10 --- /dev/null +++ b/SOURCES/1317-execute-don-t-bother-with-chowning-StateDirectory-an.patch @@ -0,0 +1,29 @@ +From 03efe234974d2511b04dc3733b21261a50fa6941 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 27 Jun 2023 11:19:47 +0200 +Subject: [PATCH] execute: don't bother with chowning StateDirectory= and + friends in user mode + +(cherry picked from commit f5bb36dcfe71dab3f79e8e6133a2f4260d91f213) + +Related: RHEL-137252 +--- + src/core/execute.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/core/execute.c b/src/core/execute.c +index 0ae4640382..9e3da5315f 100644 +--- a/src/core/execute.c ++++ b/src/core/execute.c +@@ -2570,6 +2570,11 @@ static int setup_exec_directory( + if (r < 0) + goto fail; + ++ /* Skip the rest (which deals with ownership) in user mode, since ownership changes are not ++ * available to user code anyway */ ++ if (params->runtime_scope != RUNTIME_SCOPE_SYSTEM) ++ continue; ++ + /* Then, change the ownership of the whole tree, if necessary. When dynamic users are used we + * drop the suid/sgid bits, since we really don't want SUID/SGID files for dynamic UID/GID + * assignments to exist. */ diff --git a/SOURCES/1318-test-add-test-for-new-XDG_STATE_HOME-handling.patch b/SOURCES/1318-test-add-test-for-new-XDG_STATE_HOME-handling.patch new file mode 100644 index 0000000..c2d8ead --- /dev/null +++ b/SOURCES/1318-test-add-test-for-new-XDG_STATE_HOME-handling.patch @@ -0,0 +1,79 @@ +From 9eefbd2ec116cad4dbf0df51acc095e44583e110 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Mon, 26 Jun 2023 23:23:21 +0200 +Subject: [PATCH] test: add test for new XDG_STATE_HOME handling + +(cherry picked from commit 580a007bb6a192b5f821ace04f13694278b6618c) + +Related: RHEL-137252 +--- + test/units/testsuite-23.statedir.sh | 60 +++++++++++++++++++++++++++++ + 1 file changed, 60 insertions(+) + create mode 100755 test/units/testsuite-23.statedir.sh + +diff --git a/test/units/testsuite-23.statedir.sh b/test/units/testsuite-23.statedir.sh +new file mode 100755 +index 0000000000..b592314a09 +--- /dev/null ++++ b/test/units/testsuite-23.statedir.sh +@@ -0,0 +1,60 @@ ++#!/usr/bin/env bash ++# SPDX-License-Identifier: LGPL-2.1-or-later ++# shellcheck disable=SC2235 ++# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- ++# ex: ts=8 sw=4 sts=4 et filetype=sh ++set -eux ++set -o pipefail ++ ++# Test unit configuration/state/cache/log/runtime data cleanup ++ ++export HOME=/root ++export XDG_RUNTIME_DIR=/run/user/0 ++ ++systemctl start user@0.service ++ ++( ! test -d "$HOME"/.local/state/foo) ++( ! test -d "$HOME"/.config/foo) ++ ++systemd-run --user -p StateDirectory=foo --wait /bin/true ++ ++test -d "$HOME"/.local/state/foo ++( ! test -L "$HOME"/.local/state/foo) ++( ! test -d "$HOME"/.config/foo) ++ ++systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true ++ ++test -d "$HOME"/.local/state/foo ++( ! test -L "$HOME"/.local/state/foo) ++test -d "$HOME"/.config/foo ++ ++rmdir "$HOME"/.local/state/foo "$HOME"/.config/foo ++ ++systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true ++ ++test -d "$HOME"/.local/state/foo ++( ! test -L "$HOME"/.local/state/foo) ++test -d "$HOME"/.config/foo ++ ++rmdir "$HOME"/.local/state/foo "$HOME"/.config/foo ++ ++# Now trigger an update scenario by creating a config dir first ++systemd-run --user -p ConfigurationDirectory=foo --wait /bin/true ++ ++( ! test -d "$HOME"/.local/state/foo) ++test -d "$HOME"/.config/foo ++ ++# This will look like an update and result in a symlink ++systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true ++ ++test -d "$HOME"/.local/state/foo ++test -L "$HOME"/.local/state/foo ++test -d "$HOME"/.config/foo ++ ++test "$(readlink "$HOME"/.local/state/foo)" = ../../.config/foo ++ ++# Check that this will work safely a second time ++systemd-run --user -p StateDirectory=foo -p ConfigurationDirectory=foo --wait /bin/true ++ ++rm "$HOME"/.local/state/foo ++rmdir "$HOME"/.config/foo diff --git a/SOURCES/1319-man-mention-the-newly-added-XDG_STATE_HOME.patch b/SOURCES/1319-man-mention-the-newly-added-XDG_STATE_HOME.patch new file mode 100644 index 0000000..0fb3127 --- /dev/null +++ b/SOURCES/1319-man-mention-the-newly-added-XDG_STATE_HOME.patch @@ -0,0 +1,54 @@ +From 8ff3fbaf94ef1d179171d528a2d595ba9a2015e4 Mon Sep 17 00:00:00 2001 +From: Franklin Yu +Date: Thu, 25 May 2023 22:06:54 -0700 +Subject: [PATCH] man: mention the newly-added XDG_STATE_HOME + +The description is copied from config-home. + +Taken from: #27795 + +(cherry picked from commit b4d6bc63e602048188896110a585aa7de1c70c9b) + +Related: RHEL-137252 +--- + man/file-hierarchy.xml | 20 +++++++++++++------- + 1 file changed, 13 insertions(+), 7 deletions(-) + +diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml +index 4961f019f0..6943f386bc 100644 +--- a/man/file-hierarchy.xml ++++ b/man/file-hierarchy.xml +@@ -518,13 +518,10 @@ + + ~/.config/ + +- Application configuration and state. When a +- new user is created, this directory will be empty or not exist +- at all. Applications should fall back to defaults should their +- configuration or state in this directory be missing. If an +- application finds $XDG_CONFIG_HOME set, it +- should use the directory specified in it instead of this +- directory. ++ Application configuration. When a new user is created, this directory will be empty ++ or not exist at all. Applications should fall back to defaults should their configuration in this ++ directory be missing. If an application finds $XDG_CONFIG_HOME set, it should use ++ the directory specified in it instead of this directory. + + + +@@ -570,6 +567,15 @@ + directory. + + ++ ++ ~/.local/state/ ++ ++ Application state. When a new user is created, this directory will be empty or not ++ exist at all. Applications should fall back to defaults should their state in this directory be ++ missing. If an application finds $XDG_STATE_HOME set, it should use the directory ++ specified in it instead of this directory. ++ ++ + + + diff --git a/SOURCES/1320-man-rebreak-lines-in-file-hierarchy-7-a-bit.patch b/SOURCES/1320-man-rebreak-lines-in-file-hierarchy-7-a-bit.patch new file mode 100644 index 0000000..41452e3 --- /dev/null +++ b/SOURCES/1320-man-rebreak-lines-in-file-hierarchy-7-a-bit.patch @@ -0,0 +1,96 @@ +From 33f04ca8a23c0fcc2d4260958c3185f4fc3d3d66 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 27 Jun 2023 10:28:44 +0200 +Subject: [PATCH] man: rebreak lines in file-hierarchy(7) a bit + +(Does not change a single word, just rebreaks a bunch of paragraphs +matching our current line breaking rules) + +(cherry picked from commit fa1d34825a9b410275e716b9b70f4fca02c71ba9) + +Related: RHEL-137252 +--- + man/file-hierarchy.xml | 47 ++++++++++++++++-------------------------- + 1 file changed, 18 insertions(+), 29 deletions(-) + +diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml +index 6943f386bc..6104324519 100644 +--- a/man/file-hierarchy.xml ++++ b/man/file-hierarchy.xml +@@ -505,13 +505,10 @@ + + ~/.cache/ + +- Persistent user cache data. User programs may +- place non-essential data in this directory. Flushing this +- directory should have no effect on operation of programs, +- except for increased runtimes necessary to rebuild these +- caches. If an application finds +- $XDG_CACHE_HOME set, it should use the +- directory specified in it instead of this ++ Persistent user cache data. User programs may place non-essential data in this ++ directory. Flushing this directory should have no effect on operation of programs, except for ++ increased runtimes necessary to rebuild these caches. If an application finds ++ $XDG_CACHE_HOME set, it should use the directory specified in it instead of this + directory. + + +@@ -527,44 +524,36 @@ + + ~/.local/bin/ + +- Executables that shall appear in the user's +- $PATH search path. It is recommended not to +- place executables in this directory that are not useful for +- invocation from a shell; these should be placed in a +- subdirectory of ~/.local/lib/ instead. +- Care should be taken when placing architecture-dependent +- binaries in this place, which might be problematic if the home +- directory is shared between multiple hosts with different ++ Executables that shall appear in the user's $PATH search path. It ++ is recommended not to place executables in this directory that are not useful for invocation from a ++ shell; these should be placed in a subdirectory of ~/.local/lib/ instead. Care ++ should be taken when placing architecture-dependent binaries in this place, which might be ++ problematic if the home directory is shared between multiple hosts with different + architectures. + + + + ~/.local/lib/ + +- Static, private vendor data that is compatible +- with all architectures. ++ Static, private vendor data that is compatible with all ++ architectures. + + + + ~/.local/lib/arch-id/ + +- Location for placing public dynamic libraries. +- The architecture identifier to use is defined on Multiarch +- Architecture Specifiers (Tuples) +- list. ++ Location for placing public dynamic libraries. The architecture identifier to use is ++ defined on Multiarch Architecture Specifiers ++ (Tuples) list. + + + + ~/.local/share/ + +- Resources shared between multiple packages, +- such as fonts or artwork. Usually, the precise location and +- format of files stored below this directory is subject to +- specifications that ensure interoperability. If an application +- finds $XDG_DATA_HOME set, it should use the +- directory specified in it instead of this +- directory. ++ Resources shared between multiple packages, such as fonts or artwork. Usually, the ++ precise location and format of files stored below this directory is subject to specifications that ++ ensure interoperability. If an application finds $XDG_DATA_HOME set, it should use ++ the directory specified in it instead of this directory. + + + diff --git a/SOURCES/1321-man-properly-close-XML-tags.patch b/SOURCES/1321-man-properly-close-XML-tags.patch new file mode 100644 index 0000000..b709951 --- /dev/null +++ b/SOURCES/1321-man-properly-close-XML-tags.patch @@ -0,0 +1,34 @@ +From 7fddcfa3d2c7b4c77c6b325a3a6779dea7afa2ba Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 27 Jun 2023 10:32:11 +0200 +Subject: [PATCH] man: properly close XML tags + +(cherry picked from commit cc8fdd5d307a620700d4729d74143ca434f0707c) + +Related: RHEL-137252 +--- + man/systemd.exec.xml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/man/systemd.exec.xml b/man/systemd.exec.xml +index cce0426ed4..6f172994f7 100644 +--- a/man/systemd.exec.xml ++++ b/man/systemd.exec.xml +@@ -1393,7 +1393,7 @@ CapabilityBoundingSet=~CAP_B CAP_C + The second parameter will be interpreted as a destination path that will be created as a symlink to the directory. + The symlinks will be created after any BindPaths= or TemporaryFileSystem= + options have been set up, to make ephemeral symlinking possible. The same source can have multiple symlinks, by +- using the same first parameter, but a different second parameter. ++ using the same first parameter, but a different second parameter. + + The directories defined by these options are always created under the standard paths used by systemd + (/var/, /run/, /etc/, …). If the service needs +@@ -1429,7 +1429,7 @@ StateDirectory=aaa/bbb ccc + RuntimeDirectory=foo:bar foo:baz + the service manager creates /run/foo (if it does not exist), and + /run/bar plus /run/baz as symlinks to +- /run/foo. ++ /run/foo. + + + diff --git a/SOURCES/1322-tmpfiles-teach-tmpfiles-the-new-XDG_STATE_HOME-varia.patch b/SOURCES/1322-tmpfiles-teach-tmpfiles-the-new-XDG_STATE_HOME-varia.patch new file mode 100644 index 0000000..17cdc85 --- /dev/null +++ b/SOURCES/1322-tmpfiles-teach-tmpfiles-the-new-XDG_STATE_HOME-varia.patch @@ -0,0 +1,51 @@ +From cf207cd9f09bbab5482c88d6032119ac7ca19b10 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Tue, 27 Jun 2023 13:14:17 +0200 +Subject: [PATCH] tmpfiles: teach tmpfiles the new XDG_STATE_HOME variable too + +(cherry picked from commit b50aadaff22f9b3ad3bbcbfd2edd661456a5b4bf) + +Resolves: RHEL-137252 +--- + man/tmpfiles.d.xml | 4 ++-- + src/tmpfiles/tmpfiles.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/man/tmpfiles.d.xml b/man/tmpfiles.d.xml +index 595b9f6934..d3aa4c4d86 100644 +--- a/man/tmpfiles.d.xml ++++ b/man/tmpfiles.d.xml +@@ -722,7 +722,7 @@ d /tmp/foo/bar - - - bmA:1h - + + %L + System or user log directory +- In mode, this is the same as $XDG_CONFIG_HOME with /log appended, and /var/log otherwise. ++ In mode, this is the same as $XDG_STATE_HOME with /log appended, and /var/log otherwise. + + + +@@ -730,7 +730,7 @@ d /tmp/foo/bar - - - bmA:1h - + + %S + System or user state directory +- In mode, this is the same as $XDG_CONFIG_HOME, and /var/lib otherwise. ++ In mode, this is the same as $XDG_STATE_HOME, and /var/lib otherwise. + + + %t +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 101e1a41a7..510440efb6 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -249,9 +249,9 @@ static int specifier_directory(char specifier, const void *data, const char *roo + + static const struct table_entry paths_user[] = { + [DIRECTORY_RUNTIME] = { SD_PATH_USER_RUNTIME }, +- [DIRECTORY_STATE] = { SD_PATH_USER_CONFIGURATION }, ++ [DIRECTORY_STATE] = { SD_PATH_USER_STATE_PRIVATE }, + [DIRECTORY_CACHE] = { SD_PATH_USER_STATE_CACHE }, +- [DIRECTORY_LOGS] = { SD_PATH_USER_CONFIGURATION, "log" }, ++ [DIRECTORY_LOGS] = { SD_PATH_USER_STATE_PRIVATE, "log" }, + }; + + const struct table_entry *paths; diff --git a/SOURCES/1323-test-use-XDG_STATE_HOME-for-S-and-L.patch b/SOURCES/1323-test-use-XDG_STATE_HOME-for-S-and-L.patch new file mode 100644 index 0000000..5f70d4a --- /dev/null +++ b/SOURCES/1323-test-use-XDG_STATE_HOME-for-S-and-L.patch @@ -0,0 +1,74 @@ +From 2ad5e04b95c6e6948669cc45854f27a5f7ff6afb Mon Sep 17 00:00:00 2001 +From: Yu Watanabe +Date: Thu, 20 Jul 2023 16:07:58 +0900 +Subject: [PATCH] test: use XDG_STATE_HOME for %S and %L + +This fixes the test failure when invoked by a user. +=== +Running ./systemd-tmpfiles --user on 'f /tmp/test-systemd-tmpfiles.1foag_ur/test-content.n_9r_xhm/arg - - - - %S' +expect: '/home/watanabe/.config' +actual: '/home/watanabe/.local/state' +Traceback (most recent call last): + File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 233, in + test_valid_specifiers(user=True) + File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 135, in test_valid_specifiers + test_content('f {} - - - - %S', + File "/home/watanabe/git/systemd/test/test-systemd-tmpfiles.py", line 88, in test_content + assert content == expected + ^^^^^^^^^^^^^^^^^^^ +AssertionError +=== + +This also makes the test uses fallback paths. + +Follow-up for b50aadaff22f9b3ad3bbcbfd2edd661456a5b4bf. + +(cherry picked from commit b0efbe9b81cdae8544fbc58422f81513adc68d9a) + +Related: RHEL-137252 +--- + test/test-systemd-tmpfiles.py | 29 +++++++++++++++-------------- + 1 file changed, 15 insertions(+), 14 deletions(-) + +diff --git a/test/test-systemd-tmpfiles.py b/test/test-systemd-tmpfiles.py +index af9ff9bf93..0d7e288681 100755 +--- a/test/test-systemd-tmpfiles.py ++++ b/test/test-systemd-tmpfiles.py +@@ -118,22 +118,23 @@ def test_valid_specifiers(*, user): + xdg_runtime_dir if user else '/run', + user=user) + +- xdg_config_home = os.getenv('XDG_CONFIG_HOME') +- if xdg_config_home is not None or not user: +- test_content('f {} - - - - %S', +- xdg_config_home if user else '/var/lib', +- user=user) ++ xdg_state_home = os.getenv('XDG_STATE_HOME') ++ if xdg_state_home is None and user: ++ xdg_state_home = os.path.join(home, ".local/state") ++ test_content('f {} - - - - %S', ++ xdg_state_home if user else '/var/lib', ++ user=user) + + xdg_cache_home = os.getenv('XDG_CACHE_HOME') +- if xdg_cache_home is not None or not user: +- test_content('f {} - - - - %C', +- xdg_cache_home if user else '/var/cache', +- user=user) +- +- if xdg_config_home is not None or not user: +- test_content('f {} - - - - %L', +- xdg_config_home + '/log' if user else '/var/log', +- user=user) ++ if xdg_cache_home is None and user: ++ xdg_cache_home = os.path.join(home, ".cache") ++ test_content('f {} - - - - %C', ++ xdg_cache_home if user else '/var/cache', ++ user=user) ++ ++ test_content('f {} - - - - %L', ++ os.path.join(xdg_state_home, 'log') if user else '/var/log', ++ user=user) + + test_content('f {} - - - - %%', '%', user=user) + diff --git a/SOURCES/1324-man-fully-adopt-.local-state.patch b/SOURCES/1324-man-fully-adopt-.local-state.patch new file mode 100644 index 0000000..f7e9738 --- /dev/null +++ b/SOURCES/1324-man-fully-adopt-.local-state.patch @@ -0,0 +1,41 @@ +From 7923e6b42174e74f01e6a41734783cf4fb4e85d2 Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 3 Jul 2024 10:18:37 +0200 +Subject: [PATCH] man: fully adopt ~/.local/state/ + +The XDG base dir spec adopted ~/.local/state/ as a thing a while back, +and we updated our docs in b4d6bc63e602048188896110a585aa7de1c70c9b, but +forgot to to update the table at the bottom to fully reflect the update. +Fix that. + +(cherry picked from commit 72a6296b16a75d4e26eec972f2999e69c9967b9d) + +Related: RHEL-137252 +--- + man/file-hierarchy.xml | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/man/file-hierarchy.xml b/man/file-hierarchy.xml +index 6104324519..7e059f1273 100644 +--- a/man/file-hierarchy.xml ++++ b/man/file-hierarchy.xml +@@ -804,7 +804,7 @@ + + + ~/.config/package/ +- User-specific configuration and state for the package. It is required to default to safe fallbacks if this configuration is missing. ++ User-specific configuration for the package. It is required to default to safe fallbacks if this configuration is missing. + + + $XDG_RUNTIME_DIR/package/ +@@ -814,6 +814,10 @@ + ~/.cache/package/ + Persistent cache data of the package. If this directory is flushed, the application should work correctly on next invocation, though possibly slowed down due to the need to rebuild any local cache files. The application must be capable of recreating this directory should it be missing and necessary. + ++ ++ ~/.local/state/package/ ++ Persistent state data of the package. ++ + + + diff --git a/SOURCES/1325-core-only-activate-transaction-that-contain-useful-j.patch b/SOURCES/1325-core-only-activate-transaction-that-contain-useful-j.patch new file mode 100644 index 0000000..e1ecff1 --- /dev/null +++ b/SOURCES/1325-core-only-activate-transaction-that-contain-useful-j.patch @@ -0,0 +1,36 @@ +From 9d7bd63efe0596fa1b4cd0cc6672b092aafb2ec7 Mon Sep 17 00:00:00 2001 +From: Michal Sekletar +Date: Fri, 9 Jan 2026 17:18:41 +0100 +Subject: [PATCH] core: only activate transaction that contain useful jobs + +If no real jobs were added to the transaction, do not activate it. +The JOB_NOP anchor does not perform any useful work and activating +such transaction only wastes resources. + +Fixes #9751 + +(cherry picked from commit bcbf80c43d107ad233edc990a60bdc40f517085a) + +Resolves: RHEL-143727 +--- + src/core/manager.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/core/manager.c b/src/core/manager.c +index 9070dc0b1f..ec5e374f24 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -2013,6 +2013,13 @@ int manager_propagate_reload(Manager *m, Unit *unit, JobMode mode, sd_bus_error + /* Failure in adding individual dependencies is ignored, so this always succeeds. */ + transaction_add_propagate_reload_jobs(tr, unit, tr->anchor_job, mode == JOB_IGNORE_DEPENDENCIES, e); + ++ /* Only activate the transaction if it contains jobs other than NOP anchor. ++ * Short-circuiting here avoids unnecessary processing, such as emitting D-Bus signals. */ ++ if (hashmap_size(tr->jobs) <= 1) { ++ r = 0; ++ goto tr_abort; ++ } ++ + r = transaction_activate(tr, m, mode, NULL, e); + if (r < 0) + goto tr_abort; diff --git a/SOURCES/1326-manager-fix-scope-for-environment-generators.patch b/SOURCES/1326-manager-fix-scope-for-environment-generators.patch new file mode 100644 index 0000000..036c30d --- /dev/null +++ b/SOURCES/1326-manager-fix-scope-for-environment-generators.patch @@ -0,0 +1,27 @@ +From 0cab1e6254b62e39459e33ad814a6143730d3a85 Mon Sep 17 00:00:00 2001 +From: Ludwig Nussel +Date: Wed, 15 Mar 2023 10:20:59 +0100 +Subject: [PATCH] manager: fix scope for environment generators + +fixes regression introduced by 4870133bfa + +(cherry picked from commit 361cacf49e8fd6b0fc983f0ee507c1d22fa00103) + +Resolves: RHEL-154262 +--- + src/core/manager.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/manager.c b/src/core/manager.c +index ec5e374f24..79408b18dc 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -3695,7 +3695,7 @@ static int manager_run_environment_generators(Manager *m) { + if (MANAGER_IS_TEST_RUN(m) && !(m->test_run_flags & MANAGER_TEST_RUN_ENV_GENERATORS)) + return 0; + +- paths = env_generator_binary_paths(MANAGER_IS_SYSTEM(m)); ++ paths = env_generator_binary_paths(m->runtime_scope); + if (!paths) + return log_oom(); + diff --git a/SOURCES/1271-core-validate-input-cgroup-path-more-prudently.patch b/SOURCES/1327-core-validate-input-cgroup-path-more-prudently.patch similarity index 89% rename from SOURCES/1271-core-validate-input-cgroup-path-more-prudently.patch rename to SOURCES/1327-core-validate-input-cgroup-path-more-prudently.patch index ed379ef..24d8fa7 100644 --- a/SOURCES/1271-core-validate-input-cgroup-path-more-prudently.patch +++ b/SOURCES/1327-core-validate-input-cgroup-path-more-prudently.patch @@ -1,17 +1,17 @@ -From 7750e56f82f608358ba2968ed6d3e53c9f4cd8e6 Mon Sep 17 00:00:00 2001 +From 83bb634dae00614e21744cd78b24412cb70c54dc Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Thu, 26 Feb 2026 11:06:34 +0100 Subject: [PATCH] core: validate input cgroup path more prudently (cherry picked from commit efa6ba2ab625aaa160ac435a09e6482fc63bdbe8) -Resolves: RHEL-155391 +Resolves: RHEL-152082 --- src/core/dbus-manager.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c -index 386b319c86..60515d09f5 100644 +index 3f62b30745..16c9680d80 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -666,6 +666,12 @@ static int method_get_unit_by_control_group(sd_bus_message *message, void *userd diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index a34fb82..ca51212 100644 --- a/SPECS/systemd.spec +++ b/SPECS/systemd.spec @@ -21,7 +21,7 @@ Name: systemd Url: https://systemd.io Version: 252 -Release: 55%{?dist}.9 +Release: 67%{?dist}.2 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: System and Service Manager @@ -1292,68 +1292,124 @@ Patch1206: 1206-core-when-removing-a-job-from-a-transaction-include-.patch Patch1207: 1207-catalog-add-entries-for-the-order-cycle-log-messages.patch Patch1208: 1208-tree-wide-check-more-log-message-format-in-log_struc.patch Patch1209: 1209-core-transaction-do-not-attempt-to-log-n-a-as-a-jour.patch -Patch1210: 1210-meson-etc-systemd-network-is-also-used-by-udevd.patch -Patch1211: 1211-test-add-tests-for-format_timestamp-and-parse_timest.patch -Patch1212: 1212-test-time-util-disable-failing-tests.patch -Patch1213: 1213-test-test-parse_timestamp-in-various-timezone.patch -Patch1214: 1214-systemctl-logind-add-missing-asserts.patch -Patch1215: 1215-systemctl-logind-make-logind_schedule_shutdown-accep.patch -Patch1216: 1216-systemctl-add-option-when-for-scheduled-shutdown.patch -Patch1217: 1217-test-time-util-add-test-cases-to-invalidate-show-and.patch -Patch1218: 1218-sd-bus-make-bus_add_match_full-accept-timeout.patch -Patch1219: 1219-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch -Patch1220: 1220-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch -Patch1221: 1221-core-sd-bus-drop-empty-lines-between-function-call-a.patch -Patch1222: 1222-core-do-not-disconnect-from-bus-when-failed-to-insta.patch -Patch1223: 1223-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch -Patch1224: 1224-manager-s-deserialized_subscribed-subscribed_as_strv.patch -Patch1225: 1225-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch -Patch1226: 1226-core-manager-restore-bus-track-deserialization-clean.patch -Patch1227: 1227-core-manager-drop-duplicate-bus-track-deserializatio.patch -Patch1228: 1228-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch -Patch1229: 1229-Revert-test-time-util-disable-failing-tests.patch -Patch1230: 1230-test-use-get_timezones-to-iterate-all-known-timezone.patch -Patch1231: 1231-test-time-util-do-not-fail-on-DST-change.patch -Patch1232: 1232-test-time-util-suppress-timestamp-conversion-failure.patch -Patch1233: 1233-test-time-util-do-more-suppression-of-time-zone-chec.patch -Patch1234: 1234-test-time-util-fix-truncation-of-usec-to-sec.patch -Patch1235: 1235-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch -Patch1236: 1236-meson-extend-timeout-for-test-time-util.patch -Patch1237: 1237-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch -Patch1238: 1238-time-util-align-string-table.patch -Patch1239: 1239-time-util-rename-variables.patch -Patch1240: 1240-time-util-add-assertions.patch -Patch1241: 1241-time-util-drop-redundant-else.patch -Patch1242: 1242-time-util-do-not-use-strdupa.patch -Patch1243: 1243-time-util-use-result-from-startswith_no_case.patch -Patch1244: 1244-time-util-use-usec_add-and-usec_sub_unsigned.patch -Patch1245: 1245-time-util-shorten-code-a-bit.patch -Patch1246: 1246-time-util-rename-variables.patch -Patch1247: 1247-time-util-drop-unnecessary-assignment-of-timezone-na.patch -Patch1248: 1248-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch -Patch1249: 1249-time-util-fix-typo.patch -Patch1250: 1250-ci-bump-the-tools-tree-to-F42.patch -Patch1251: 1251-cryptsetup-Add-optional-support-for-linking-volume-k.patch -Patch1252: 1252-cryptsetup-fix-typo.patch -Patch1253: 1253-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch -Patch1254: 1254-basic-add-PIDFS-magic-31709.patch -Patch1255: 1255-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch -Patch1256: 1256-coredump-make-check-that-all-argv-meta-data-fields-a.patch -Patch1257: 1257-coredump-restore-compatibility-with-older-patterns.patch -Patch1258: 1258-coredump-use-d-in-kernel-core-pattern.patch -Patch1259: 1259-pidref-add-structure-that-can-reference-a-pid-via-bo.patch -Patch1260: 1260-fd-util-introduce-parse_fd.patch -Patch1261: 1261-coredump-add-support-for-new-F-PIDFD-specifier.patch -Patch1262: 1262-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch -Patch1263: 1263-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch -Patch1264: 1264-test-check-the-next-elapse-timer-timestamp-after-des.patch -Patch1265: 1265-timer-don-t-run-service-immediately-after-restart-of.patch -Patch1266: 1266-test-store-and-compare-just-the-property-value.patch -Patch1267: 1267-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch -Patch1268: 1268-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch -Patch1269: 1269-timer-rebase-last_trigger-timestamp-if-needed.patch -Patch1270: 1270-core-fix-array-size-in-unit_log_resources.patch -Patch1271: 1271-core-validate-input-cgroup-path-more-prudently.patch +Patch1210: 1210-Revert-boot-Use-EFI_BOOT_MANAGER_POLICY_PROTOCOL-to-.patch +Patch1211: 1211-boot-Use-correct-memory-type-for-allocations.patch +Patch1212: 1212-meson-etc-systemd-network-is-also-used-by-udevd.patch +Patch1213: 1213-sd-bus-make-bus_add_match_full-accept-timeout.patch +Patch1214: 1214-core-unit-add-get_timeout_start_usec-in-UnitVTable-a.patch +Patch1215: 1215-core-unit-increase-the-NameOwnerChanged-GetNameOwner.patch +Patch1216: 1216-core-sd-bus-drop-empty-lines-between-function-call-a.patch +Patch1217: 1217-core-do-not-disconnect-from-bus-when-failed-to-insta.patch +Patch1218: 1218-dbus-stash-the-subscriber-list-when-we-disconenct-fr.patch +Patch1219: 1219-manager-s-deserialized_subscribed-subscribed_as_strv.patch +Patch1220: 1220-bus-util-do-not-reset-the-count-returned-by-sd_bus_t.patch +Patch1221: 1221-core-manager-restore-bus-track-deserialization-clean.patch +Patch1222: 1222-core-manager-drop-duplicate-bus-track-deserializatio.patch +Patch1223: 1223-sd-bus-bus-track-use-install_callback-in-sd_bus_trac.patch +Patch1224: 1224-shell-completion-add-kernel-identify-inspect-verbs-f.patch +Patch1225: 1225-test-add-tests-for-format_timestamp-and-parse_timest.patch +Patch1226: 1226-test-time-util-disable-failing-tests.patch +Patch1227: 1227-test-test-parse_timestamp-in-various-timezone.patch +Patch1228: 1228-systemctl-logind-add-missing-asserts.patch +Patch1229: 1229-systemctl-logind-make-logind_schedule_shutdown-accep.patch +Patch1230: 1230-systemctl-add-option-when-for-scheduled-shutdown.patch +Patch1231: 1231-test-time-util-add-test-cases-to-invalidate-show-and.patch +Patch1232: 1232-Introduce-RET_GATHER-and-use-it-in-src-shared.patch +Patch1233: 1233-fd-util-don-t-eat-up-errors-in-fd_cloexec_many.patch +Patch1234: 1234-sd-bus-refuse-to-send-messages-with-an-invalid-strin.patch +Patch1235: 1235-test-check-if-we-correctly-handle-invalid-UTF-8-in-m.patch +Patch1236: 1236-test-fix-a-typo-in-the-cleanup-stuff.patch +Patch1237: 1237-test-explicitly-specify-a-UTF-8-locale-for-UTF-8-she.patch +Patch1238: 1238-test-use-the-correct-file-name-when-restoring-the-or.patch +Patch1239: 1239-core-escape-UTF-8-in-mount-unit-Where-field-before-s.patch +Patch1240: 1240-Revert-test-time-util-disable-failing-tests.patch +Patch1241: 1241-test-use-get_timezones-to-iterate-all-known-timezone.patch +Patch1242: 1242-test-time-util-do-not-fail-on-DST-change.patch +Patch1243: 1243-test-time-util-suppress-timestamp-conversion-failure.patch +Patch1244: 1244-test-time-util-do-more-suppression-of-time-zone-chec.patch +Patch1245: 1245-test-time-util-fix-truncation-of-usec-to-sec.patch +Patch1246: 1246-test-unset-TZ-before-timezone-sensitive-unit-tests-a.patch +Patch1247: 1247-meson-extend-timeout-for-test-time-util.patch +Patch1248: 1248-time-util-use-DEFINE_STRING_TABLE_LOOKUP_TO_STRING-m.patch +Patch1249: 1249-time-util-align-string-table.patch +Patch1250: 1250-time-util-rename-variables.patch +Patch1251: 1251-time-util-add-assertions.patch +Patch1252: 1252-time-util-drop-redundant-else.patch +Patch1253: 1253-time-util-do-not-use-strdupa.patch +Patch1254: 1254-time-util-use-result-from-startswith_no_case.patch +Patch1255: 1255-time-util-use-usec_add-and-usec_sub_unsigned.patch +Patch1256: 1256-time-util-shorten-code-a-bit.patch +Patch1257: 1257-time-util-rename-variables.patch +Patch1258: 1258-time-util-drop-unnecessary-assignment-of-timezone-na.patch +Patch1259: 1259-time-util-make-parse_timestamp-use-the-RFC-822-ISO-8.patch +Patch1260: 1260-time-util-fix-typo.patch +Patch1261: 1261-ci-bump-the-tools-tree-to-F42.patch +Patch1262: 1262-journald-extend-STDOUT_STREAMS_MAX-to-64k.patch +Patch1263: 1263-Revert-Revert-udev-builtin-net_id-use-firmware_node-.patch +Patch1264: 1264-udev-builtin-net_id-ignore-firmware_node-sun-0.patch +Patch1265: 1265-fundamental-fix-compile-check-for-explicit_bzero.patch +Patch1266: 1266-time-util-make-USEC_TIMESTAMP_FORMATTABLE_MAX-for-32.patch +Patch1267: 1267-test-rename-TEST-53-ISSUE-16347-to-TEST-53-TIMER.patch +Patch1268: 1268-test-restarting-elapsed-timer-shouldn-t-trigger-the-.patch +Patch1269: 1269-test-check-the-next-elapse-timer-timestamp-after-des.patch +Patch1270: 1270-timer-don-t-run-service-immediately-after-restart-of.patch +Patch1271: 1271-test-store-and-compare-just-the-property-value.patch +Patch1272: 1272-test-make-test-fd-util-more-lenient-when-using-fd_mo.patch +Patch1273: 1273-basic-add-PIDFS-magic-31709.patch +Patch1274: 1274-man-fix-a-missing-word.patch +Patch1275: 1275-cryptsetup-Add-optional-support-for-linking-volume-k.patch +Patch1276: 1276-cryptsetup-fix-typo.patch +Patch1277: 1277-cryptsetup-HAVE_CRYPT_SET_KEYRING_TO_LINK-is-always-.patch +Patch1278: 1278-coredump-make-check-that-all-argv-meta-data-fields-a.patch +Patch1279: 1279-coredump-restore-compatibility-with-older-patterns.patch +Patch1280: 1280-coredump-use-d-in-kernel-core-pattern.patch +Patch1281: 1281-pidref-add-structure-that-can-reference-a-pid-via-bo.patch +Patch1282: 1282-fd-util-introduce-parse_fd.patch +Patch1283: 1283-coredump-add-support-for-new-F-PIDFD-specifier.patch +Patch1284: 1284-timer-rebase-the-next-elapse-timestamp-only-if-timer.patch +Patch1285: 1285-strv-introduce-string_strv_hashmap_remove.patch +Patch1286: 1286-unit-file-introduce-unit_file_remove_from_name_map.patch +Patch1287: 1287-core-unit-remove-path-to-transient-unit-file-from-un.patch +Patch1288: 1288-TEST-07-PID1-add-reprudcer-for-issue-35190.patch +Patch1289: 1289-coredump-handle-ENOBUFS-and-EMSGSIZE-the-same-way.patch +Patch1290: 1290-ukify-rstrip-and-escape-binary-null-characters-from-.patch +Patch1291: 1291-timer-rebase-last_trigger-timestamp-if-needed.patch +Patch1292: 1292-cryptsetup-generator-refactor-add_crypttab_devices.patch +Patch1293: 1293-cryptsetup-generator-continue-parsing-after-error.patch +Patch1294: 1294-cryptsetup-generator-parse-all-cmdline-devices-too.patch +Patch1295: 1295-cryptsetup-generator-always-process-cmdline-devices.patch +Patch1296: 1296-logind-add-background-light-session-class.patch +Patch1297: 1297-pam_systemd-honor-session-class-provided-via-PAM-env.patch +Patch1298: 1298-core-fix-array-size-in-unit_log_resources.patch +Patch1299: 1299-pid1-add-env-var-to-override-default-mount-rate-limi.patch +Patch1300: 1300-pid1-add-env-var-to-override-default-mount-rate-limi.patch +Patch1301: 1301-core-service-fix-error-cause-in-the-log.patch +Patch1302: 1302-fstab-generator-drop-assertions-for-mount-opts.patch +Patch1303: 1303-fstab-generator-fix-options-in-systemd.mount-extra-a.patch +Patch1304: 1304-core-reorder-systemd-arguments-on-reexec.patch +Patch1305: 1305-basic-add-RuntimeScope-enum.patch +Patch1306: 1306-runtime-scope-add-helper-that-turns-RuntimeScope-enu.patch +Patch1307: 1307-sd-path-add-support-for-XDG_STATE_HOME.patch +Patch1308: 1308-sd-path-bring-spacing-in-sd-path.h-and-systemd-path-.patch +Patch1309: 1309-path-tool-add-some-basic-ansi-highlighing.patch +Patch1310: 1310-execude-include-RuntimeScope-field-in-ExecParameters.patch +Patch1311: 1311-execute-remove-redundant-assignment.patch +Patch1312: 1312-execute-when-recursively-chowning-StateDirectory-whe.patch +Patch1313: 1313-execute-add-support-for-XDG_STATE_HOME-for-placing-s.patch +Patch1314: 1314-execute-associate-logs-from-setup_exec_directory-wit.patch +Patch1315: 1315-execute-shorten-some-code-by-using-RET_NERRNO.patch +Patch1316: 1316-execute-shorten-code-by-making-use-of-laccess-return.patch +Patch1317: 1317-execute-don-t-bother-with-chowning-StateDirectory-an.patch +Patch1318: 1318-test-add-test-for-new-XDG_STATE_HOME-handling.patch +Patch1319: 1319-man-mention-the-newly-added-XDG_STATE_HOME.patch +Patch1320: 1320-man-rebreak-lines-in-file-hierarchy-7-a-bit.patch +Patch1321: 1321-man-properly-close-XML-tags.patch +Patch1322: 1322-tmpfiles-teach-tmpfiles-the-new-XDG_STATE_HOME-varia.patch +Patch1323: 1323-test-use-XDG_STATE_HOME-for-S-and-L.patch +Patch1324: 1324-man-fully-adopt-.local-state.patch +Patch1325: 1325-core-only-activate-transaction-that-contain-useful-j.patch +Patch1326: 1326-manager-fix-scope-for-environment-generators.patch +Patch1327: 1327-core-validate-input-cgroup-path-more-prudently.patch # Downstream-only patches (9000–9999) @@ -2231,33 +2287,74 @@ systemd-hwdb update &>/dev/null || : %{_prefix}/lib/dracut/modules.d/70rhel-net-naming-sysattrs/* %changelog -* Thu Apr 02 2026 systemd maintenance team - 252-55.9 -- core: validate input cgroup path more prudently (RHEL-155391) +* Thu Apr 02 2026 systemd maintenance team - 252-67.2 +- core: validate input cgroup path more prudently (RHEL-152082) -* Tue Feb 24 2026 systemd maintenance team - 252-55.8 -- update specfile and sources after renaming rhel-net-naming-sysattrs to net-naming-sysattrs (RHEL-150628) +* Tue Mar 24 2026 systemd maintenance team - 252-67.1 +- manager: fix scope for environment generators (RHEL-154262) -* Mon Dec 01 2025 systemd maintenance team - 252-55.7 -- core: fix array size in unit_log_resources() (RHEL-132120) +* Mon Feb 23 2026 systemd maintenance team - 252-67 +- core: only activate transaction that contain useful jobs (RHEL-143727) -* Mon Nov 24 2025 systemd maintenance team - 252-55.6 -- timer: rebase last_trigger timestamp if needed (RHEL-127022) +* Mon Feb 23 2026 systemd maintenance team - 252-66 +- core/service: fix error cause in the log (RHEL-138414) +- fstab-generator: drop assertions for mount opts (RHEL-92752) +- fstab-generator: fix options in systemd.mount-extra= arg (RHEL-92752) +- core: reorder systemd arguments on reexec (RHEL-111135) +- basic: add RuntimeScope enum (RHEL-137252) +- runtime-scope: add helper that turns RuntimeScope enum into --system/--user string (RHEL-137252) +- sd-path: add support for XDG_STATE_HOME (RHEL-137252) +- sd-path: bring spacing in sd-path.h and systemd-path tool in sync (RHEL-137252) +- path tool: add some basic ansi highlighing (RHEL-137252) +- execude: include RuntimeScope field in ExecParameters (RHEL-137252) +- execute: remove redundant assignment (RHEL-137252) +- execute: when recursively chowning StateDirectory= when spawning services, follow initial symlink (RHEL-137252) +- execute: add support for XDG_STATE_HOME for placing service state data in --user mode (RHEL-137252) +- execute: associate logs from setup_exec_directory() with the unit name (RHEL-137252) +- execute: shorten some code by using RET_NERRNO() (RHEL-137252) +- execute: shorten code by making use of laccess() return code properly (RHEL-137252) +- execute: don't bother with chowning StateDirectory= and friends in user mode (RHEL-137252) +- test: add test for new XDG_STATE_HOME handling (RHEL-137252) +- man: mention the newly-added XDG_STATE_HOME (RHEL-137252) +- man: rebreak lines in file-hierarchy(7) a bit (RHEL-137252) +- man: properly close XML tags (RHEL-137252) +- tmpfiles: teach tmpfiles the new XDG_STATE_HOME variable too (RHEL-137252) +- test: use XDG_STATE_HOME for %%S and %%L (RHEL-137252) +- man: fully adopt ~/.local/state/ (RHEL-137252) -* Tue Nov 18 2025 systemd maintenance team - 252-55.5 -- test: rename TEST-53-ISSUE-16347 to TEST-53-TIMER (RHEL-127022) -- test: restarting elapsed timer shouldn't trigger the corresponding service (RHEL-127022) -- test: check the next elapse timer timestamp after deserialization (RHEL-127022) -- timer: don't run service immediately after restart of a timer (RHEL-127022) -- test: store and compare just the property value (RHEL-127022) -- timer: rebase the next elapse timestamp only if timer didn't already run (RHEL-127022) -- coredump: handle ENOBUFS and EMSGSIZE the same way (RHEL-126114) +* Wed Feb 18 2026 systemd maintenance team - 252-65 +- update specfile and sources after renaming rhel-net-naming-sysattrs to net-naming-sysattrs (RHEL-150622) -* Thu Nov 06 2025 systemd maintenance team - 252-55.4 -- cryptsetup: Add optional support for linking volume key in keyring. (RHEL-118294) -- cryptsetup: fix typo (RHEL-118294) -- cryptsetup: HAVE_CRYPT_SET_KEYRING_TO_LINK is always defined (RHEL-118294) -- basic: add PIDFS magic (#31709) (RHEL-118294) -- time-util: make USEC_TIMESTAMP_FORMATTABLE_MAX for 32bit system off by one day (RHEL-118294) +* Fri Dec 12 2025 systemd maintenance team - 252-64 +- core: fix array size in unit_log_resources() (RHEL-131338) +- pid1: add env var to override default mount rate limit burst (RHEL-129153) +- pid1: add env var to override default mount rate limit interval (RHEL-129153) + +* Thu Nov 27 2025 systemd maintenance team - 252-63 +- cryptsetup-generator: refactor add_crypttab_devices() (RHEL-127859) +- cryptsetup-generator: continue parsing after error (RHEL-127859) +- cryptsetup-generator: parse all cmdline devices too (RHEL-127859) +- cryptsetup-generator: always process cmdline devices (RHEL-127859) +- logind: add "background-light" session class (RHEL-109833) +- pam_systemd: honor session class provided via PAM environment (RHEL-109833) + +* Mon Nov 24 2025 systemd maintenance team - 252-62 +- ukify: rstrip and escape binary null characters from 'inspect' output (#38607) (RHEL-109558) +- timer: rebase last_trigger timestamp if needed (RHEL-118215) + +* Fri Nov 21 2025 systemd maintenance team - 252-61 +- timer: rebase the next elapse timestamp only if timer didn't already run (RHEL-118215) +- strv: introduce string_strv_hashmap_remove() (RHEL-14112) +- unit-file: introduce unit_file_remove_from_name_map() (RHEL-14112) +- core/unit: remove path to transient unit file from unit name maps on stop (RHEL-14112) +- TEST-07-PID1: add reprudcer for issue #35190 (RHEL-14112) +- coredump: handle ENOBUFS and EMSGSIZE the same way (RHEL-103801) + +* Wed Nov 05 2025 systemd maintenance team - 252-60 +- man: fix a missing word (RHEL-115182) +- cryptsetup: Add optional support for linking volume key in keyring. (RHEL-97175) +- cryptsetup: fix typo (RHEL-97175) +- cryptsetup: HAVE_CRYPT_SET_KEYRING_TO_LINK is always defined (RHEL-97175) - coredump: make check that all argv[] meta data fields are passed strict (RHEL-104138) - coredump: restore compatibility with older patterns (RHEL-104138) - coredump: use %d in kernel core pattern (RHEL-104138) @@ -2265,50 +2362,73 @@ systemd-hwdb update &>/dev/null || : - fd-util: introduce parse_fd() (RHEL-104138) - coredump: add support for new %F PIDFD specifier (RHEL-104138) -* Fri Sep 12 2025 systemd maintenance team - 252-55.2 -- Revert "test-time-util: disable failing tests" (RHEL-110954) -- test: use get_timezones() to iterate all known timezones (RHEL-110954) -- test-time-util: do not fail on DST change (RHEL-110954) -- test-time-util: suppress timestamp conversion failures for Africa/Khartoum timezone (RHEL-110954) -- test-time-util: do more suppression of time zone checks (RHEL-110954) -- test-time-util: fix truncation of usec to sec (RHEL-110954) -- test: unset TZ before timezone-sensitive unit tests are run (RHEL-110954) -- meson: extend timeout for test-time-util (RHEL-110954) -- time-util: use DEFINE_STRING_TABLE_LOOKUP_TO_STRING() macro (RHEL-110954) -- time-util: align string table (RHEL-110954) -- time-util: rename variables (RHEL-110954) -- time-util: add assertions (RHEL-110954) -- time-util: drop redundant else (RHEL-110954) -- time-util: do not use strdupa() (RHEL-110954) -- time-util: use result from startswith_no_case() (RHEL-110954) -- time-util: use usec_add() and usec_sub_unsigned() (RHEL-110954) -- time-util: shorten code a bit (RHEL-110954) -- time-util: rename variables (RHEL-110954) -- time-util: drop unnecessary assignment of timezone name (RHEL-110954) -- time-util: make parse_timestamp() use the RFC-822/ISO 8601 standard timezone spec (RHEL-110954) -- time-util: fix typo (RHEL-110954) -- ci: bump the tools tree to F42 (RHEL-110954) +* Thu Oct 02 2025 systemd maintenance team - 252-59 +- test: rename TEST-53-ISSUE-16347 to TEST-53-TIMER (RHEL-118215) +- test: restarting elapsed timer shouldn't trigger the corresponding service (RHEL-118215) +- test: check the next elapse timer timestamp after deserialization (RHEL-118215) +- timer: don't run service immediately after restart of a timer (RHEL-118215) +- test: store and compare just the property value (RHEL-118215) +- test: make test-fd-util more lenient when using fd_move_above_stdio() (RHEL-114974) +- basic: add PIDFS magic (#31709) (RHEL-114974) -* Fri Aug 29 2025 systemd maintenance team - 252-55.1 -- meson: /etc/systemd/network is also used by udevd (RHEL-111611) -- test: add tests for format_timestamp() and parse_timestamp() with various timezone (RHEL-110954) -- test-time-util: disable failing tests (RHEL-110954) -- test: test parse_timestamp() in various timezone (RHEL-110954) -- systemctl: logind: add missing asserts (RHEL-110954) -- systemctl: logind: make logind_schedule_shutdown accept action as param (RHEL-110954) -- systemctl: add option --when for scheduled shutdown (RHEL-110954) -- test-time-util: add test cases to invalidate "show" and "cancel" (RHEL-110954) -- sd-bus: make bus_add_match_full accept timeout (RHEL-111630) -- core/unit: add get_timeout_start_usec in UnitVTable and define it for service (RHEL-111630) -- core/unit: increase the NameOwnerChanged/GetNameOwner timeout to the unit's start timeout (RHEL-111630) -- core,sd-bus: drop empty lines between function call and error check (RHEL-111630) -- core: do not disconnect from bus when failed to install signal match (RHEL-111630) -- dbus: stash the subscriber list when we disconenct from the bus (RHEL-111630) -- manager: s/deserialized_subscribed/subscribed_as_strv (RHEL-111630) -- bus-util: do not reset the count returned by sd_bus_track_count_name() (RHEL-111630) -- core/manager: restore bus track deserialization cleanup in manager_reload() (RHEL-111630) -- core/manager: drop duplicate bus track deserialization (RHEL-111630) -- sd-bus/bus-track: use install_callback in sd_bus_track_add_name() (RHEL-111630) +* Tue Sep 16 2025 systemd maintenance team - 252-57 +- Revert "boot: Use EFI_BOOT_MANAGER_POLICY_PROTOCOL to connect console devices" (RHEL-108596) +- boot: Use correct memory type for allocations (RHEL-108555) +- meson: /etc/systemd/network is also used by udevd (RHEL-109096) +- sd-bus: make bus_add_match_full accept timeout (RHEL-31756) +- core/unit: add get_timeout_start_usec in UnitVTable and define it for service (RHEL-31756) +- core/unit: increase the NameOwnerChanged/GetNameOwner timeout to the unit's start timeout (RHEL-31756) +- core,sd-bus: drop empty lines between function call and error check (RHEL-31756) +- core: do not disconnect from bus when failed to install signal match (RHEL-31756) +- dbus: stash the subscriber list when we disconenct from the bus (RHEL-31756) +- manager: s/deserialized_subscribed/subscribed_as_strv (RHEL-31756) +- bus-util: do not reset the count returned by sd_bus_track_count_name() (RHEL-31756) +- core/manager: restore bus track deserialization cleanup in manager_reload() (RHEL-31756) +- core/manager: drop duplicate bus track deserialization (RHEL-31756) +- sd-bus/bus-track: use install_callback in sd_bus_track_add_name() (RHEL-31756) +- shell completion: add kernel-identify/inspect verbs for bootctl (RHEL-108576) +- test: add tests for format_timestamp() and parse_timestamp() with various timezone (RHEL-109488) +- test-time-util: disable failing tests (RHEL-109488) +- test: test parse_timestamp() in various timezone (RHEL-109488) +- systemctl: logind: add missing asserts (RHEL-109488) +- systemctl: logind: make logind_schedule_shutdown accept action as param (RHEL-109488) +- systemctl: add option --when for scheduled shutdown (RHEL-109488) +- test-time-util: add test cases to invalidate "show" and "cancel" (RHEL-109488) +- Introduce RET_GATHER and use it in src/shared/ (RHEL-108598) +- fd-util: don't eat up errors in fd_cloexec_many (RHEL-108598) +- sd-bus: refuse to send messages with an invalid string (RHEL-108584) +- test: check if we correctly handle invalid UTF-8 in mount stuff (RHEL-108584) +- test: fix a typo in the cleanup stuff (RHEL-108584) +- test: explicitly specify a UTF-8 locale for UTF-8 shenanigans (RHEL-108584) +- test: use the correct file name when restoring the original fstab (RHEL-108584) +- core: escape UTF-8 in mount unit Where field before sending to clients (RHEL-108584) +- Revert "test-time-util: disable failing tests" (RHEL-109488) +- test: use get_timezones() to iterate all known timezones (RHEL-109488) +- test-time-util: do not fail on DST change (RHEL-109488) +- test-time-util: suppress timestamp conversion failures for Africa/Khartoum timezone (RHEL-109488) +- test-time-util: do more suppression of time zone checks (RHEL-109488) +- test-time-util: fix truncation of usec to sec (RHEL-109488) +- test: unset TZ before timezone-sensitive unit tests are run (RHEL-109488) +- meson: extend timeout for test-time-util (RHEL-109488) +- time-util: use DEFINE_STRING_TABLE_LOOKUP_TO_STRING() macro (RHEL-109488) +- time-util: align string table (RHEL-109488) +- time-util: rename variables (RHEL-109488) +- time-util: add assertions (RHEL-109488) +- time-util: drop redundant else (RHEL-109488) +- time-util: do not use strdupa() (RHEL-109488) +- time-util: use result from startswith_no_case() (RHEL-109488) +- time-util: use usec_add() and usec_sub_unsigned() (RHEL-109488) +- time-util: shorten code a bit (RHEL-109488) +- time-util: rename variables (RHEL-109488) +- time-util: drop unnecessary assignment of timezone name (RHEL-109488) +- time-util: make parse_timestamp() use the RFC-822/ISO 8601 standard timezone spec (RHEL-109488) +- time-util: fix typo (RHEL-109488) +- ci: bump the tools tree to F42 (RHEL-109488) +- journald: extend STDOUT_STREAMS_MAX to 64k (RHEL-111065) +- Revert "Revert "udev-builtin-net_id: use firmware_node/sun for ID_NET_NAME_SLOT"" (RHEL-50103) +- udev-builtin-net_id: ignore firmware_node/sun == 0 (RHEL-50103) +- fundamental: fix compile check for explicit_bzero (RHEL-108568) +- time-util: make USEC_TIMESTAMP_FORMATTABLE_MAX for 32bit system off by one day (RHEL-109488) * Fri Aug 15 2025 systemd maintenance team - 252-55 - tree-wide: check more log message format in log_struct() and friends (RHEL-100353)