From bb6f78deca04e23cdf42c7be78af8d099f24a41a Mon Sep 17 00:00:00 2001 From: Julie Pichon Date: Thu, 16 Jan 2020 12:59:56 +0000 Subject: [PATCH] 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 --- templates/yum_update.sh.j2 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/yum_update.sh.j2 b/templates/yum_update.sh.j2 index f6cd603..6d4a28b 100755 --- a/templates/yum_update.sh.j2 +++ b/templates/yum_update.sh.j2 @@ -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