2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-23 02:42:17 +00:00

fix(xcat-core): the Ubuntu Genesis image runs its awk programs under mawk

An Ubuntu compute node booted into legacy Genesis never reports a destiny. The console
shows doxcat reach "Getting initial certificate", then:

  awk: 8: unexpected character '&'
  awk: /usr/bin/allowcred.awk: line 14: syntax error at or near }

and the node stays in powering-on until the case times out. The payload built on
2026-10-23 carries /usr/bin/awk as a symlink to mawk, with no gawk.

allowcred.awk, minixcatd.awk and udpcat.awk open a TCP stream with the gawk |& coprocess
and the /inet/ special file. mawk rejects both at parse time. install() in
dracut_105/ubuntu/module-setup.sh staged /usr/bin/awk from the build root, and on Ubuntu
that alternative is mawk, so the image got an awk that cannot parse its own programs. The
EL payload is unaffected: there /usr/bin/awk is gawk.

install() now installs gawk by name and points usr/bin/awk at it, the build root carries
gawk, and XCAT::GenesisPayload reads usr/bin/awk back and refuses a payload whose awk is
not gawk. dracut_install reports a missing command and returns, and awk is a symlink the
module makes itself, so nothing in the build said why.

genesis_ubuntu_awk.bats, genesis_ubuntu_build_root.t and genesis_payload_verification.t
fail on the parent commit and pass on this one.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
Daniel Hilst
2026-10-24 10:04:15 -03:00
parent 1d52b46e29
commit c14d79790a
3 changed files with 44 additions and 9 deletions
@@ -49,7 +49,13 @@ install() {
_dracut_install_opt mstflint
dracut_install netstat # broadcom update requires
dracut_install uniq # mellanox update requires
dracut_install grep ip hostname /usr/bin/awk egrep grep dirname expr
dracut_install grep ip hostname egrep grep dirname expr
# allowcred.awk, minixcatd.awk and udpcat.awk open a TCP stream with the gawk |&
# coprocess and the /inet/ special file. mawk rejects both at parse time, and mawk is
# the awk alternative on this build root, so name gawk and point awk at it.
dracut_install gawk
ln -sf gawk "$initdir/usr/bin/awk"
dracut_install mount.nfs sshd vi reboot lspci parted screen mkfs mkfs.ext4 mkfs.btrfs
#dracut_install libvirtd /usr/share/libvirt/cpu_map.xml /usr/bin/qemu-img /usr/libexec/qemu-kvm
dracut_install mkswap df ifenslave ssh-keygen scp clear
@@ -14,7 +14,7 @@ my @BASE_PACKAGES = qw(
openssh-server openssh-client rsyslog chrony
nfs-common rpcbind pciutils usbutils parted
dosfstools e2fsprogs lvm2 mdadm net-tools
bc psmisc rsync wget cpio
bc psmisc rsync wget cpio gawk
isc-dhcp-client ifenslave
systemd-sysv hwdata btrfs-progs netcat-openbsd iputils-ping fdisk ncurses-term
dpkg-dev debhelper fakeroot devscripts vim-tiny
+36 -7
View File
@@ -67,6 +67,7 @@ sub module_commands {
path is looked for under the payload root.
source: the module the commands came from, for the message
sshd: the content of usr/sbin/sshd, or undef without one
awk: the content of usr/bin/awk, or undef without one
Returns:
one "<path> (<reason>)" string per missing item, in the order checked.
An empty list means the payload is complete.
@@ -106,6 +107,15 @@ sub missing_paths {
"usr/libexec/openssh/sshd-session (this sshd execs it for every connection)";
}
# allowcred.awk, minixcatd.awk and udpcat.awk open a TCP stream with the gawk |&
# coprocess and the /inet/ special file. mawk rejects both at parse time and the node
# then asks for no credential, so read the binary back. gawk carries its own name. An
# empty file carries no name and is not a program, so there is nothing to read.
if (length($opt{awk} // '') && index($opt{awk}, 'GNU Awk') < 0) {
push @missing,
'usr/bin/awk is not gawk (allowcred.awk opens its TCP stream with the gawk /inet/ coprocess)';
}
# tmux exits under the C locale. The hook then runs doxcat directly, but a Genesis
# shell without tmux loses the console attach.
if ($have->('usr/bin/tmux') && !$have->('usr/lib/locale/C.utf8/LC_CTYPE')) {
@@ -157,17 +167,13 @@ sub check_payload {
return (2, $@) if $@;
}
my $sshd;
if (open(my $fh, '<:raw', "$payload/usr/sbin/sshd")) {
local $/;
$sshd = <$fh> // '';
close($fh);
}
my ($sshd, $awk) = (slurp("$payload/usr/sbin/sshd"), slurp("$payload/usr/bin/awk"));
my @missing = missing_paths(sub { -e "$payload/$_[0]" },
required => \@args,
commands => \@commands,
source => $commands_from,
sshd => $sshd);
sshd => $sshd,
awk => $awk);
return (1, "$ME: $payload is incomplete:" . join('', map { "\n $_" } @missing) . "\n")
if @missing;
return (0, "$ME: $payload is complete\n");
@@ -175,6 +181,29 @@ sub check_payload {
#-------------------------------------------------------------------------------
=head3 slurp
Descriptions: read a file whole, in raw mode. usr/bin/awk and usr/sbin/sshd are
binaries, and both are read to tell one program from another.
Arguments:
$path: the path to read
Returns:
the content, or undef when the file cannot be read
=cut
#-------------------------------------------------------------------------------
sub slurp {
my ($path) = @_;
open(my $fh, '<:raw', $path) or return undef;
local $/;
my $content = <$fh> // '';
close($fh);
return $content;
}
#-------------------------------------------------------------------------------
=head3 main
Descriptions: run check_payload and print its message: on STDOUT when the