Repository navigation
fix(go-xcat): read apt candidates in the C locale - #8011
Open
viniciusferrao wants to merge 9 commits into
Open
viniciusferrao wants to merge 9 commits into
viniciusferrao wants to merge 9 commits into
Conversation
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.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
go-xcat check,installandupdateprint a table of the xCAT packages with the version that the repositories offer. On apt,check_repo_version_aptlooks for theCandidate:label ofapt-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_aptnow runsapt-cache policywithLC_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:
TERM,tputno longer prints an error into the output.tput colskeeps its stderr, because thetputof ncurses 5 (EL7) reads the terminal width through it.Depends on #8002 and includes its commits.