Skip to content

fix(go-xcat): read apt candidates in the C locale - #8011

Open
viniciusferrao wants to merge 9 commits into
xcat2:masterfrom
VersatusHPC:fix/go-xcat-apt-listing
Open

viniciusferrao wants to merge 9 commits into
xcat2:masterfrom
VersatusHPC:fix/go-xcat-apt-listing

Conversation

@viniciusferrao

Copy link
Copy Markdown
Member

go-xcat check, install and update print a table of the xCAT packages with the version that the repositories offer. On apt, check_repo_version_apt looks for the Candidate: label of apt-cache policy, and a translated apt prints that label in the user's language. The table then shows every package as (not found).

check_repo_version_apt now runs apt-cache policy with LC_ALL="C", so the table and the install filter of #8002 both read the untranslated labels.

There is also a fix for the same table:

  • With an unknown or unset TERM, tput no longer prints an error into the output. tput cols keeps its stderr, because the tput of ncurses 5 (EL7) reads the terminal width through it.

Depends on #8002 and includes its commits.

apt 3, which Ubuntu 26.04 ships, has no apt-key, so go-xcat stopped with
"import xcat apt key failed" before it configured a repository. On Ubuntu
18.04 to 24.04, apt-key also fails when gnupg is not installed, and go-xcat
does not install it.

Decode the armored key with base64 and install it as the binary keyring
/etc/apt/trusted.gpg.d/xcat.gpg. Every apt release reads that file, while
apt 1.0 and 1.2 on Ubuntu 14.04 and 16.04 ignore an armored key there. The
key stays trusted for all repositories, as it was with apt-key. A complete
uninstall removes the key with the repository files.

As with apt-key, a download that holds no public key stops go-xcat and
leaves the installed key in place. go-xcat refuses a download whose armored
blocks do not all end with their END line, as a truncated download does. It
accepts the keyring only when it starts with a public key packet, the check
apt applies to a binary keyring.
The default xcat-core repository installs the decoded key blocks as one
binary keyring in trusted.gpg.d while apt-key fails as it does on apt 3.
An empty or HTML download, a block truncated after a valid base64 prefix,
a body that is not base64 and a block without a public key stop go-xcat
and keep the installed key. A complete uninstall removes that key and
keeps the other keys.
The apt-cache double printed nothing, so a go-xcat that asks apt which
packages have a candidate would find none. Report a candidate for every
package. go-xcat today reads that answer only for its package listing.
On apt, go-xcat handed its whole list to one apt-get install, so a package the
repositories lack aborted the install. ipxe-xcat is in the install list but
not in the latest apt repositories, and no riscv64 apt repository has
xcat-genesis-openembedded-riscv64.

Install the packages that have a candidate and warn about each one that has
none, as dnf --setopt=strict=0 already does on EL. A missing xcat metapackage
still stops the install, because it depends on every package a management
node needs. A failed apt-cache policy query also stops it, so a broken cache
is not taken for missing packages. The query runs in the C locale, because a
translated apt prints no "Candidate:" label.
An unknown package and a package with no candidate are skipped with a warning
while the others install, and a translated apt still installs the packages
that have a candidate. A missing xcat metapackage or a failed apt-cache
policy query stops the install before apt-get runs.
check_repo_version_apt looks for the "Candidate:" label of apt-cache
policy. A translated apt prints that label in the user's language. The
package table of go-xcat check, install and update then showed every
package as "(not found)" in the repositories.

Run apt-cache policy with LC_ALL="C" inside check_repo_version_apt, so
that every caller gets the untranslated labels. Drop the LC_ALL=C that
the install filter added.
Share the apt-cache double of the apt install tests. Check that
list_xcat_packages shows the apt candidates in the C locale and under a
translated apt.
list_xcat_packages reads the terminal width with tput cols. With an
unknown or unset TERM, tput prints "unknown terminal" or "No value for
$TERM" in the middle of the go-xcat output.

Check the terminal type with tput longname, with its output discarded,
before reading the width. tput cols keeps its stderr, because the tput
of ncurses 5 (EL7) reads the width through stderr. With stderr
discarded, it reports 80 columns on a wider terminal.
Check that list_xcat_packages adds no tput error to its output when
TERM names a terminal type that tput does not know, or is empty.
@viniciusferrao
viniciusferrao requested a review from dhilst October 31, 2026 03:44
@viniciusferrao viniciusferrao self-assigned this Oct 31, 2026
@viniciusferrao viniciusferrao added this to the 2.20 milestone Oct 31, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant