1
0
mirror of https://github.com/systemd/systemd synced 2024-07-01 07:34:28 +00:00

tree-wide: change --kill-who to --kill-whom

getopt allows non-ambiguous abbreviations, so backwards-compat is maintained, and
people can use --kill-who (or even shorter abbreviations). English is flexible,
so in common speach people would use both forms, even if "whom" is technically
more correct. The advantage of using the longer form in the code is that we
effectively allow both forms, so we stop punishing people who DTGCT¹, but still
allow people to use the spoken form if they prefer.

1. Do the gramatically correct thing
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-08-24 10:41:30 +02:00 committed by Yu Watanabe
parent 2f968def11
commit 4ccde410a3
18 changed files with 53 additions and 52 deletions

View File

@ -122,7 +122,7 @@
<term><command>kill-session</command> <replaceable>ID</replaceable></term>
<listitem><para>Send a signal to one or more processes of the session. Use
<option>--kill-who=</option> to select which process to kill. Use <option>--signal=</option> to
<option>--kill-whom=</option> to select which process to kill. Use <option>--signal=</option> to
select the signal to send. If the argument is specified as empty string the signal is sent to the
session invoking the command.</para></listitem>
</varlistentry>
@ -320,7 +320,7 @@
</varlistentry>
<varlistentry>
<term><option>--kill-who=</option></term>
<term><option>--kill-whom=</option></term>
<listitem><para>When used with
<command>kill-session</command>, choose which processes to

View File

@ -279,7 +279,7 @@
<listitem><para>Send a signal to one or more processes of the
virtual machine or container. This means processes as seen by
the host, not the processes inside the virtual machine or
container. Use <option>--kill-who=</option> to select which
container. Use <option>--kill-whom=</option> to select which
process to kill. Use <option>--signal=</option> to select the
signal to send.</para></listitem>
</varlistentry>
@ -682,7 +682,7 @@
</varlistentry>
<varlistentry>
<term><option>--kill-who=</option></term>
<term><option>--kill-whom=</option></term>
<listitem><para>When used with <command>kill</command>, choose
which processes to kill. Must be one of

View File

@ -498,7 +498,7 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
<listitem>
<para>Send a signal to one or more processes of the
unit. Use <option>--kill-who=</option> to select which
unit. Use <option>--kill-whom=</option> to select which
process to kill. Use <option>--signal=</option> to select
the signal to send.</para>
</listitem>
@ -2086,7 +2086,7 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
</varlistentry>
<varlistentry>
<term><option>--kill-who=</option></term>
<term><option>--kill-whom=</option></term>
<listitem>
<para>When used with <command>kill</command>, choose which

View File

@ -42,7 +42,7 @@ _loginctl () {
local -A OPTS=(
[STANDALONE]='--all -a --help -h --no-pager --version
--no-legend --no-ask-password -l --full --value'
[ARG]='--host -H --kill-who --property -p --signal -s -M --machine
[ARG]='--host -H --kill-whom --property -p --signal -s -M --machine
-n --lines -o --output -P'
)
@ -52,7 +52,7 @@ _loginctl () {
_signals
return
;;
--kill-who)
--kill-whom|--kill-who)
comps='all leader'
;;
--host|-H)

View File

@ -36,7 +36,7 @@ _machinectl() {
local -A OPTS=(
[STANDALONE]='--all -a -l --full --help -h --no-ask-password --no-legend --no-pager --version --value
--mkdir --read-only --force -q --quiet'
[ARG]='--host -H --kill-who -M --machine --property -p --signal -s --uid -E --setenv -n --lines
[ARG]='--host -H --kill-whom -M --machine --property -p --signal -s --uid -E --setenv -n --lines
-o --output --verify --format --max-addresses'
)
@ -64,7 +64,7 @@ _machinectl() {
_signals
return
;;
--kill-who)
--kill-whom|--kill-who)
comps='all leader'
;;
--host|-H)

View File

@ -128,7 +128,7 @@ _systemctl () {
--help -h --no-ask-password --no-block --legend=no --no-pager --no-reload --no-wall --now
--quiet -q --system --user --version --runtime --recursive -r --firmware-setup
--show-types --plain --failed --value --fail --dry-run --wait'
[ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root
[ARG]='--host -H --kill-whom --property -p --signal -s --type -t --state --job-mode --root
--preset-mode -n --lines -o --output -M --machine --message --timestamp --check-inhibitors'
)
@ -156,7 +156,7 @@ _systemctl () {
comps='fail replace replace-irreversibly isolate
ignore-dependencies ignore-requirements flush'
;;
--kill-who)
--kill-whom|--kill-who)
comps='all control main'
;;
--root)

View File

@ -169,7 +169,7 @@ _arguments -s \
'--version[Show package version]' \
\*{-p+,--property=}'[Show only properties by this name]:unit property' \
{-a,--all}'[Show all properties, including empty ones]' \
'--kill-who=[Who to send signal to]:killwho:(main control all)' \
'--kill-whom=[Whom to send signal to]:killwhom:(main control all)' \
{-s+,--signal=}'[Which signal to send]:signal:_signals' \
{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
{-M+,--machine=}'[Operate on local container]:machine:_sd_machines' \

View File

@ -95,7 +95,7 @@ _arguments \
{-a,--all}'[Show all properties.]' \
{-q,--quiet}'[Suppress output.]' \
{-l,--full}'[Do not ellipsize cgroup members.]' \
'--kill-who=[Who to send signal to.]:killwho:(leader all)' \
'--kill-whom=[Whom to send signal to.]:killwhom:(leader all)' \
{-s+,--signal=}'[Which signal to send.]:signal:_signals' \
'--read-only[Create read-only bind mount.]' \
'--mkdir[Create directory before bind mounting, if missing.]' \

View File

@ -489,7 +489,7 @@ _arguments -s \
'--global[Enable/disable/mask default user unit files globally]' \
"--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
'--no-ask-password[Do not ask for system passwords]' \
'--kill-who=[Who to send signal to]:killwho:(main control all)' \
'--kill-whom=[Whom to send signal to]:killwhom:(main control all)' \
{-s+,--signal=}'[Which signal to send]:signal:_signals' \
{-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
'--root=[Enable/disable/mask unit files in the specified root directory]:directory:_directories' \

View File

@ -43,7 +43,7 @@ static BusPrintPropertyFlags arg_print_flags = 0;
static bool arg_full = false;
static PagerFlags arg_pager_flags = 0;
static bool arg_legend = true;
static const char *arg_kill_who = NULL;
static const char *arg_kill_whom = NULL;
static int arg_signal = SIGTERM;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
static char *arg_host = NULL;
@ -1005,8 +1005,8 @@ static int kill_session(int argc, char *argv[], void *userdata) {
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
if (!arg_kill_who)
arg_kill_who = "all";
if (!arg_kill_whom)
arg_kill_whom = "all";
for (int i = 1; i < argc; i++) {
@ -1015,7 +1015,7 @@ static int kill_session(int argc, char *argv[], void *userdata) {
bus_login_mgr,
"KillSession",
&error, NULL,
"ssi", argv[i], arg_kill_who, arg_signal);
"ssi", argv[i], arg_kill_whom, arg_signal);
if (r < 0)
return log_error_errno(r, "Could not kill session: %s", bus_error_message(&error, r));
}
@ -1113,8 +1113,8 @@ static int kill_user(int argc, char *argv[], void *userdata) {
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
if (!arg_kill_who)
arg_kill_who = "all";
if (!arg_kill_whom)
arg_kill_whom = "all";
for (int i = 1; i < argc; i++) {
uid_t uid;
@ -1277,7 +1277,7 @@ static int help(int argc, char *argv[], void *userdata) {
" -a --all Show all properties, including empty ones\n"
" --value When showing properties, only print the value\n"
" -l --full Do not ellipsize output\n"
" --kill-who=WHO Who to send signal to\n"
" --kill-whom=WHOM Whom to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n"
" -n --lines=INTEGER Number of journal entries to show\n"
" -o --output=STRING Change journal output mode (short, short-precise,\n"
@ -1300,7 +1300,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_VALUE,
ARG_NO_PAGER,
ARG_NO_LEGEND,
ARG_KILL_WHO,
ARG_KILL_WHOM,
ARG_NO_ASK_PASSWORD,
};
@ -1313,7 +1313,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "full", no_argument, NULL, 'l' },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
{ "kill-who", required_argument, NULL, ARG_KILL_WHO },
{ "kill-whom", required_argument, NULL, ARG_KILL_WHOM },
{ "signal", required_argument, NULL, 's' },
{ "host", required_argument, NULL, 'H' },
{ "machine", required_argument, NULL, 'M' },
@ -1399,8 +1399,8 @@ static int parse_argv(int argc, char *argv[]) {
arg_ask_password = false;
break;
case ARG_KILL_WHO:
arg_kill_who = optarg;
case ARG_KILL_WHOM:
arg_kill_whom = optarg;
break;
case 's':

View File

@ -68,7 +68,7 @@ static BusPrintPropertyFlags arg_print_flags = 0;
static bool arg_full = false;
static PagerFlags arg_pager_flags = 0;
static bool arg_legend = true;
static const char *arg_kill_who = NULL;
static const char *arg_kill_whom = NULL;
static int arg_signal = SIGTERM;
static BusTransport arg_transport = BUS_TRANSPORT_LOCAL;
static const char *arg_host = NULL;
@ -1044,8 +1044,8 @@ static int kill_machine(int argc, char *argv[], void *userdata) {
polkit_agent_open_if_enabled(arg_transport, arg_ask_password);
if (!arg_kill_who)
arg_kill_who = "all";
if (!arg_kill_whom)
arg_kill_whom = "all";
for (int i = 1; i < argc; i++) {
r = bus_call_method(
@ -1054,7 +1054,7 @@ static int kill_machine(int argc, char *argv[], void *userdata) {
"KillMachine",
&error,
NULL,
"ssi", argv[i], arg_kill_who, arg_signal);
"ssi", argv[i], arg_kill_whom, arg_signal);
if (r < 0)
return log_error_errno(r, "Could not kill machine: %s", bus_error_message(&error, r));
}
@ -1063,14 +1063,14 @@ static int kill_machine(int argc, char *argv[], void *userdata) {
}
static int reboot_machine(int argc, char *argv[], void *userdata) {
arg_kill_who = "leader";
arg_kill_whom = "leader";
arg_signal = SIGINT; /* sysvinit + systemd */
return kill_machine(argc, argv, userdata);
}
static int poweroff_machine(int argc, char *argv[], void *userdata) {
arg_kill_who = "leader";
arg_kill_whom = "leader";
arg_signal = SIGRTMIN+4; /* only systemd */
return kill_machine(argc, argv, userdata);
@ -2500,7 +2500,7 @@ static int help(int argc, char *argv[], void *userdata) {
" -a --all Show all properties, including empty ones\n"
" --value When showing properties, only print the value\n"
" -l --full Do not ellipsize output\n"
" --kill-who=WHO Who to send signal to\n"
" --kill-whom=WHOM Whom to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n"
" --uid=USER Specify user ID to invoke shell as\n"
" -E --setenv=VAR[=VALUE] Add an environment variable for shell\n"
@ -2534,7 +2534,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_NO_PAGER,
ARG_NO_LEGEND,
ARG_VALUE,
ARG_KILL_WHO,
ARG_KILL_WHOM,
ARG_READ_ONLY,
ARG_MKDIR,
ARG_NO_ASK_PASSWORD,
@ -2554,7 +2554,7 @@ static int parse_argv(int argc, char *argv[]) {
{ "full", no_argument, NULL, 'l' },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
{ "no-legend", no_argument, NULL, ARG_NO_LEGEND },
{ "kill-who", required_argument, NULL, ARG_KILL_WHO },
{ "kill-whom", required_argument, NULL, ARG_KILL_WHOM },
{ "signal", required_argument, NULL, 's' },
{ "host", required_argument, NULL, 'H' },
{ "machine", required_argument, NULL, 'M' },
@ -2693,8 +2693,8 @@ static int parse_argv(int argc, char *argv[]) {
arg_legend = false;
break;
case ARG_KILL_WHO:
arg_kill_who = optarg;
case ARG_KILL_WHOM:
arg_kill_whom = optarg;
break;
case 's':

View File

@ -8,7 +8,7 @@
int verb_kill(int argc, char *argv[], void *userdata) {
_cleanup_strv_free_ char **names = NULL;
char *kill_who = NULL;
char *kill_whom = NULL;
sd_bus *bus;
int r, q;
@ -18,12 +18,12 @@ int verb_kill(int argc, char *argv[], void *userdata) {
polkit_agent_open_maybe();
if (!arg_kill_who)
arg_kill_who = "all";
if (!arg_kill_whom)
arg_kill_whom = "all";
/* --fail was specified */
if (streq(arg_job_mode(), "fail"))
kill_who = strjoina(arg_kill_who, "-fail");
kill_whom = strjoina(arg_kill_whom, "-fail");
r = expand_unit_names(bus, strv_skip(argv, 1), NULL, &names, NULL);
if (r < 0)
@ -38,7 +38,7 @@ int verb_kill(int argc, char *argv[], void *userdata) {
"KillUnit",
&error,
NULL,
"ssi", *name, kill_who ? kill_who : arg_kill_who, arg_signal);
"ssi", *name, kill_whom ?: arg_kill_whom, arg_signal);
if (q < 0) {
log_error_errno(q, "Failed to kill unit %s: %s", *name, bus_error_message(&error, q));
if (r == 0)

View File

@ -89,7 +89,7 @@ bool arg_ask_password = false;
bool arg_runtime = false;
UnitFilePresetMode arg_preset_mode = UNIT_FILE_PRESET_FULL;
char **arg_wall = NULL;
const char *arg_kill_who = NULL;
const char *arg_kill_whom = NULL;
int arg_signal = SIGTERM;
char *arg_root = NULL;
usec_t arg_when = 0;
@ -117,7 +117,7 @@ STATIC_DESTRUCTOR_REGISTER(arg_states, strv_freep);
STATIC_DESTRUCTOR_REGISTER(arg_properties, strv_freep);
STATIC_DESTRUCTOR_REGISTER(_arg_job_mode, unsetp);
STATIC_DESTRUCTOR_REGISTER(arg_wall, strv_freep);
STATIC_DESTRUCTOR_REGISTER(arg_kill_who, unsetp);
STATIC_DESTRUCTOR_REGISTER(arg_kill_whom, unsetp);
STATIC_DESTRUCTOR_REGISTER(arg_root, freep);
STATIC_DESTRUCTOR_REGISTER(arg_reboot_argument, unsetp);
STATIC_DESTRUCTOR_REGISTER(arg_host, unsetp);
@ -262,7 +262,7 @@ static int systemctl_help(void) {
" Whether to check inhibitors before shutting down,\n"
" sleeping, or hibernating\n"
" -i Shortcut for --check-inhibitors=no\n"
" --kill-who=WHO Whom to send signal to\n"
" --kill-whom=WHOM Whom to send signal to\n"
" -s --signal=SIGNAL Which signal to send\n"
" --what=RESOURCES Which types of resources to remove\n"
" --now Start or stop unit after enabling or disabling it\n"
@ -403,7 +403,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
ARG_NO_WALL,
ARG_ROOT,
ARG_NO_RELOAD,
ARG_KILL_WHO,
ARG_KILL_WHOM,
ARG_NO_ASK_PASSWORD,
ARG_FAILED,
ARG_RUNTIME,
@ -459,7 +459,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
{ "root", required_argument, NULL, ARG_ROOT },
{ "force", no_argument, NULL, 'f' },
{ "no-reload", no_argument, NULL, ARG_NO_RELOAD },
{ "kill-who", required_argument, NULL, ARG_KILL_WHO },
{ "kill-whom", required_argument, NULL, ARG_KILL_WHOM },
{ "signal", required_argument, NULL, 's' },
{ "no-ask-password", no_argument, NULL, ARG_NO_ASK_PASSWORD },
{ "host", required_argument, NULL, 'H' },
@ -693,8 +693,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
arg_no_reload = true;
break;
case ARG_KILL_WHO:
arg_kill_who = optarg;
case ARG_KILL_WHOM:
arg_kill_whom = optarg;
break;
case 's':

View File

@ -74,7 +74,7 @@ extern bool arg_ask_password;
extern bool arg_runtime;
extern UnitFilePresetMode arg_preset_mode;
extern char **arg_wall;
extern const char *arg_kill_who;
extern const char *arg_kill_whom;
extern int arg_signal;
extern char *arg_root;
extern usec_t arg_when;

View File

@ -6,4 +6,5 @@ After=testsuite-57-bound-by.service
[Service]
ExecStart=/bin/sleep infinity
# --kill-who= (no 'm') to check that the short form is accepted
ExecStopPost=systemctl kill --kill-who=main -sRTMIN+1 testsuite-57.service

View File

@ -7,4 +7,4 @@ StopPropagatedFrom=testsuite-57-prop-stop-two.service
[Service]
ExecStart=/bin/sleep infinity
ExecStopPost=systemctl kill --kill-who=main -sUSR2 testsuite-57.service
ExecStopPost=systemctl kill --kill-whom=main -sUSR2 testsuite-57.service

View File

@ -12,7 +12,7 @@ fi
echo "$counter" > /tmp/testsuite-57.counter
if [ "$counter" -eq 5 ] ; then
systemctl kill --kill-who=main -sUSR1 testsuite-57.service
systemctl kill --kill-whom=main -sUSR1 testsuite-57.service
fi
exec sleep 1.5