]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Revert "systemctl: allow --marker with start/stop too"
authorMike Yuan <me@yhndnzj.com>
Tue, 24 Feb 2026 14:22:28 +0000 (15:22 +0100)
committerMike Yuan <me@yhndnzj.com>
Tue, 24 Feb 2026 14:48:53 +0000 (15:48 +0100)
This reverts commit 351b4dd123f89f7f8491239b2d3f77bef5d00797.

I'm pretty sure we should not create more of these multiplexer
interfaces, which in this specific also leads to a fair bit of
confusion: start/stop/reload-or-restart --marked all enqueue
all job types.

Instead, a dedicated verb will be introduced in later commits.

man/systemctl.xml
src/systemctl/systemctl-main.c
src/systemctl/systemctl.c

index 619805891c129275308cc483324ac3fdf94bbd80..63454505dcb78d1dec10f1195a566ad8ea0a49c5 100644 (file)
@@ -2855,10 +2855,10 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
       <varlistentry>
         <term><option>--marked</option></term>
 
-        <listitem><para>Only allowed with <command>reload-or-restart</command>, <command>start</command>, or
-        <command>stop</command>. Enqueues jobs for all units that are marked. When a unit marked for reload
-        does not support reload, restart will be queued. Those properties can be set using
-        <command>set-property Markers=…</command>.</para>
+        <listitem><para>Only allowed with <command>reload-or-restart</command>. Enqueues restart jobs for all
+        units that have the <literal>needs-restart</literal> mark, and reload jobs for units that have the
+        <literal>needs-reload</literal> mark. When a unit marked for reload does not support reload, restart
+        will be queued. Those properties can be set using <command>set-property Markers=…</command>.</para>
 
         <para>Unless <option>--no-block</option> is used, <command>systemctl</command> will wait for the
         queued jobs to finish.</para>
index b23bc4e6fff870bc2bad87843114b434bf2fc555..c0596cfb861d3f30fdef5695837daad7e645c720 100644 (file)
@@ -59,8 +59,8 @@ static int systemctl_main(int argc, char *argv[]) {
                 { "list-machines",         VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_list_machines           },
                 { "clear-jobs",            VERB_ANY, 1,        VERB_ONLINE_ONLY, verb_trivial_method          },
                 { "cancel",                VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_cancel                  },
-                { "start",                 VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_start                   },
-                { "stop",                  VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, verb_start                   },
+                { "start",                 2,        VERB_ANY, VERB_ONLINE_ONLY, verb_start                   },
+                { "stop",                  2,        VERB_ANY, VERB_ONLINE_ONLY, verb_start                   },
                 { "condstop",              2,        VERB_ANY, VERB_ONLINE_ONLY, verb_start                   }, /* For compatibility with ALTLinux */
                 { "reload",                2,        VERB_ANY, VERB_ONLINE_ONLY, verb_start                   },
                 { "restart",               2,        VERB_ANY, VERB_ONLINE_ONLY, verb_start                   },
index fef1cb7a77b8b82417fe0d38c76dd2a1ba68f832..382a50e312322cd08d9c222caece3693f3475d1b 100644 (file)
@@ -1069,13 +1069,14 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                        "--wait may not be combined with --no-block.");
 
+        bool do_reload_or_restart = streq_ptr(argv[optind], "reload-or-restart");
         if (arg_marked) {
-                if (!STRPTR_IN_SET(argv[optind], "reload-or-restart", "start", "stop"))
+                if (!do_reload_or_restart)
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
-                                               "--marked may only be used with 'reload-or-restart', 'start', or 'stop'.");
+                                               "--marked may only be used with 'reload-or-restart'.");
                 if (optind + 1 < argc)
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
-                                               "No additional arguments allowed with '%s --marked'.", strna(argv[optind]));
+                                               "No additional arguments allowed with 'reload-or-restart --marked'.");
                 if (arg_wait)
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                                "--marked --wait is not supported.");
@@ -1083,10 +1084,10 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
                                                "--marked --show-transaction is not supported.");
 
-        } else if (STRPTR_IN_SET(argv[optind], "reload-or-restart", "start", "stop")) {
+        } else if (do_reload_or_restart) {
                 if (optind + 1 >= argc)
                         return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
-                                               "List of units to %s is required.", strna(argv[optind]));
+                                               "List of units to restart/reload is required.");
         }
 
         if (arg_image && arg_root)