From 3084cf67cec2141b05bd9035b41d857e22dbc115 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Tue, 6 Apr 2021 12:24:16 +0100 Subject: [PATCH] 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: Pierre Riteau Change-Id: I468d4e0460c13791b9f01d5854ef45472528c6fe Story: 2008795 Task: 42215 --- dev/functions | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev/functions b/dev/functions index 00377528d..03113027d 100644 --- a/dev/functions +++ b/dev/functions @@ -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