mirror of
https://github.com/systemd/systemd.git
synced 2026-08-10 17:14:31 +00:00
Make bus acquisition conditional in verb_edit() and verb_cat(), following the same pattern used in verb_enable(). When install_client_side() returns non-zero (indicating --global, --root, offline, or similar scenarios), skip acquiring a D-Bus connection and perform all operations client-side. Changes: - Only acquire bus when install_client_side() returns NO - Use mangle_names() instead of expand_unit_names() in client-side mode - Pass force_client_side flag based on bus availability - Skip bus-dependent operations (need_daemon_reload, etc.) when bus is NULL This allows 'systemctl edit --global' and 'systemctl cat --global' to work correctly, fixing the regression introduced by commitd77d42ed3a. Test cases added to verify: - Creating and editing global user units with --runtime - Reading global units with cat --global - Proper detection and rejection of masked units in client-side mode - Tests use /run/ instead of /etc/ for safer temporary testing Fixes https://github.com/systemd/systemd/issues/31272 (cherry picked from commitebd222b1c8)