From 6f5958c74d3e173437bf0aee71b1d1bc72af592b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 11 Jun 2025 21:40:21 +0900 Subject: [PATCH 1/3] man/machinectl: underscore is not allowed in machine name Fixes #27481. --- man/machinectl.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/man/machinectl.xml b/man/machinectl.xml index eab1a7d99e..13fa0eae71 100644 --- a/man/machinectl.xml +++ b/man/machinectl.xml @@ -778,8 +778,7 @@ non-empty label strings, separated by dots. No leading or trailing dots are allowed. No sequences of multiple dots are allowed. The label strings may only consist of alphanumeric characters as well - as the dash and underscore. The maximum length of a machine name - is 64 characters. + as the dash. The maximum length of a machine name is 64 characters. A special machine with the name .host refers to the running host system itself. This is useful for execution From 093b0255488f8996130c21ec94e35af10b69b413 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 11 Jun 2025 22:37:58 +0900 Subject: [PATCH 2/3] machinectl: align table --- src/machine/machinectl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index 32849529c9..146fe6e99c 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -68,14 +68,14 @@ typedef enum MachineRunner { } MachineRunner; static const char* const machine_runner_table[_RUNNER_MAX] = { - [RUNNER_NSPAWN] = "nspawn", + [RUNNER_NSPAWN] = "nspawn", [RUNNER_VMSPAWN] = "vmspawn", }; DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(machine_runner, MachineRunner); static const char* const machine_runner_unit_prefix_table[_RUNNER_MAX] = { - [RUNNER_NSPAWN] = "systemd-nspawn", + [RUNNER_NSPAWN] = "systemd-nspawn", [RUNNER_VMSPAWN] = "systemd-vmspawn", }; From b52d575845786f9d2898da1118bfe418f278e61b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 11 Jun 2025 22:40:30 +0900 Subject: [PATCH 3/3] machinectl: use _RUNNER_MAX rather than ELEMENTSOF() --- src/machine/machinectl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index 146fe6e99c..20fe2d1b0f 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -1694,7 +1694,7 @@ static int make_service_name(const char *name, char **ret) { assert(name); assert(ret); - assert(arg_runner >= 0 && arg_runner < (MachineRunner) ELEMENTSOF(machine_runner_unit_prefix_table)); + assert(arg_runner >= 0 && arg_runner < _RUNNER_MAX); if (!hostname_is_valid(name, 0)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL),