[systemd-devel] Antw: Re: Unexpected behaviour not noticed by systemctl command

Mike Gilbert floppym at gentoo.org
Thu Oct 10 19:09:10 UTC 2019


On Thu, Oct 10, 2019 at 4:46 AM Colin Guthrie <gmane at colin.guthr.ie> wrote:
>
> Andy Pieters wrote on 08/10/2019 11:41:
> > forget about the stop.  that was the context into which I discovered it.
> >
> > I am not saying stop should disable I am saying stop should not accept
> > now and silently ignore it
>
>
> FWIW I'd tend to agree with you.
>
>
> [colin at jimmy Channel (master)]$ sudo systemctl stop --fodslkjsf httpd
>
> systemctl: unrecognized option '--fodslkjsf'

I think this error checking happens automatically with getopt_long(3).

> [colin at jimmy Channel (master)]$ sudo systemctl stop --now httpd
>
> [colin at jimmy Channel (master)]$
>
>
> If --now is irrelevant to the verb, then it should be the equiv of an
> unrecognized option.
>
> Bonus points if it issued a git-style "did you mean systemctl disable
> --now ..." error response.

This would not be caught by getopt_long(3) because it has no way of
knowing about "verbs" or the options that are valid for them.

This kind of error checking would require special-case coding in the
systemctl code. This is more likely to happen if someone submits a PR
for it.


More information about the systemd-devel mailing list