Add double quotes around the printf statements in yum_update.sh

This is consistent with the other printf statements in the file. This
keeps the sorted data with the newlines as they are, and avoids
breaking down the data again. Otherwise, the sorting order can be
altered which breaks comm comparison and causes the "Run yum_update.sh"
task to fail with the following error:

    "stderr_lines": [
        "comm: file 2 is not in sorted order",
        "error while running runtime: exit status 1"
    ],

This is particularly important for the $available variable which
contains the repoquery output, often very large and with unusual
characters. The error happens consistently when including RHEL 7 server
repos or RHEL 8 BaseOS repo and prevents the update from working at
all.

This patch also adds -u when sorting the $available output. Once the
versions are removed with cut, there can be a tremendous amount of
duplication in the data obtained from repoquery. That makes verbose
mode even more difficult to navigate when debugging.

Change-Id: Id64a8c2e395de28945d5d6b4370c44b80392e543
This commit is contained in:
Julie Pichon 2020-01-16 12:59:56 +00:00
parent eff235ee72
commit bb6f78deca
1 changed files with 3 additions and 3 deletions

View File

@ -23,11 +23,11 @@ if [ -n "$1" ] && [[ -n $REPOQUERY_CMD ]]; then
uptodate_versions=$(comm -12 <(printf "%s\n" "$installed_versions") <(printf "%s\n" "$available_versions"))
installed=$(printf "%s\n" "$installed_versions" | cut -d= -f1 | sort)
available=$(printf "%s\n" "$available_versions" | cut -d= -f1 | sort)
available=$(printf "%s\n" "$available_versions" | cut -d= -f1 | sort -u)
uptodate=$(printf "%s\n" "$uptodate_versions" | cut -d= -f1 | sort)
installed_for_update=$(comm -23 <(printf "%s\n" $installed) <(printf "%s\n" $uptodate))
packages_for_update=$(comm -12 <(printf "%s\n" $installed_for_update) <(printf "%s\n" $available))
installed_for_update=$(comm -23 <(printf "%s\n" "$installed") <(printf "%s\n" "$uptodate"))
packages_for_update=$(comm -12 <(printf "%s\n" "$installed_for_update") <(printf "%s\n" "$available"))
fi
if [ -z "$packages_for_update" ]; then