Browse Source

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
changes/80/704780/2
Julie Pichon 1 month ago
parent
commit
bb6f78deca
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      templates/yum_update.sh.j2

+ 3
- 3
templates/yum_update.sh.j2 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

Loading…
Cancel
Save