1
0
mirror of https://pagure.io/fedora-qa/os-autoinst-distri-fedora.git synced 2024-12-22 10:23:09 +00:00

Fix escaping in the caret workaround

So these kind of things go through perl *and* bash string
interpretation and the escaping can get pretty wacky. Turns out
we need *eight* slashes here to get four through to bash (which
we need to deal with *sed*'s escaping rules), and it only works
in single quotes for some reason, not double quotes.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2022-02-25 14:05:10 -08:00
parent 371cb1c6eb
commit c5e6d80684

View File

@ -1063,8 +1063,11 @@ sub advisory_check_nonmatching_packages {
# one in the update. The sed replaces the caret - "^" - with "\^" (literal # one in the update. The sed replaces the caret - "^" - with "\^" (literal
# slash then a caret) in the package NVRA; this is necessary to workaround # slash then a caret) in the package NVRA; this is necessary to workaround
# a bug in RPM - https://bugzilla.redhat.com/show_bug.cgi?id=2002038 . It # a bug in RPM - https://bugzilla.redhat.com/show_bug.cgi?id=2002038 . It
# can be removed when that bug is fixed # can be removed when that bug is fixed. Yes, it really needs eight slashes
script_run 'for pkg in $(cat /var/log/updatepkgnames.txt); do rpm -q $pkg && rpm -q $pkg --last | head -1 | cut -d" " -f1 | sed -e "s,\^,\\\\^,g" | xargs rpm -q --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" >> /tmp/installedupdatepkgs.txt; done'; # (we need four to reach bash, and half of them get eaten by perl or
# something along the way). Yes, it only works with *single* quotes. Yes,
# I hate escaping
script_run 'for pkg in $(cat /var/log/updatepkgnames.txt); do rpm -q $pkg && rpm -q $pkg --last | head -1 | cut -d" " -f1 | sed -e \'s,\^,\\\\\\\\^,g\' | xargs rpm -q --qf "%{SOURCERPM} %{EPOCH} %{NAME}-%{VERSION}-%{RELEASE}\n" >> /tmp/installedupdatepkgs.txt; done';
script_run 'sort -u -o /tmp/installedupdatepkgs.txt /tmp/installedupdatepkgs.txt'; script_run 'sort -u -o /tmp/installedupdatepkgs.txt /tmp/installedupdatepkgs.txt';
# for debugging, may as well always upload these, can't hurt anything # for debugging, may as well always upload these, can't hurt anything
upload_logs "/tmp/installedupdatepkgs.txt", failok=>1; upload_logs "/tmp/installedupdatepkgs.txt", failok=>1;