2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-27 12:52:16 +00:00

fix(xcat-core): chtab receives only the first setting of a [Table_*] value

With [Table_vm] othersettings=cpumode:host-passthrough;firmware:efi-secureboot,
xcattest gives chtab only cpumode:host-passthrough, and bash runs
firmware:efi-secureboot as a command. The environment setup then fails.

chtab_command joined its words unquoted, and xcattest runs the command
through /bin/bash -c. chtab_command now quotes every word, the row selector
included, with the same _quote that chdef_command uses.

xcattest_conf_chtab_command.t passes with this change and fails 3 of 4
checks on the previous commit.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-30 10:01:30 -03:00
parent e813f1eed0
commit 2107bd6069
+4 -1
View File
@@ -130,6 +130,9 @@ sub chdef_command {
Descriptions:
The chtab command that applies one row of a [Table_*] block.
xcattest runs every command through /bin/bash -c, so each word is quoted, the row
selector too. A vm.othersettings value carries a semicolon.
The assignments are sorted, so one conf builds one command.
Arguments:
$table - the table name, as the section name spells it
@@ -150,7 +153,7 @@ sub chtab_command {
my $value = defined $attrs->{$attr} ? $attrs->{$attr} : '';
push @words, "$table.$attr=$value";
}
return join ' ', 'chtab', @words;
return join ' ', 'chtab', map { _quote($_) } @words;
}
#-------------------------------------------------------------------------------