Skip to content
Snippets Groups Projects
Commit 3084cf67 authored by Mark Goddard's avatar Mark Goddard
Browse files

CentOS Stream 8: Use /usr/bin/which instead of bash function

A bug has been introduced to the which package in CentOS Stream 8 which
causes it to fail when used with the following bash options:

set -u
set -o pipefail

Then, when running which we see the following output:

environment: line 1: _declare: unbound variable

As found by Pierre, this seems to be caused by the implementation of
which as a bash function which references an unbound variable
(_declare). It's tracked in Fedora by
https://bugzilla.redhat.com/show_bug.cgi?id=1944877#

.

This change works around the issue by using the /usr/bin/which binary.

Co-Authored-By: default avatarPierre Riteau <pierre@stackhpc.com>

Change-Id: I468d4e0460c13791b9f01d5854ef45472528c6fe
Story: 2008795
Task: 42215
parent fefba581
No related branches found
No related tags found
No related merge requests found
......@@ -122,7 +122,7 @@ function config_init {
function is_dnf {
if [[ -e /etc/centos-release ]]; then
which dnf >/dev/null 2>&1
/usr/bin/which dnf >/dev/null 2>&1
else
return 1
fi
......@@ -130,7 +130,7 @@ function is_dnf {
function is_yum {
if [[ -e /etc/centos-release ]]; then
which yum >/dev/null 2>&1
/usr/bin/which yum >/dev/null 2>&1
else
return 1
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment