aboutgitcode
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2022-05-05 14:54:29 +0200
committerStefano Brivio <sbrivio@redhat.com>2022-05-05 14:54:29 +0200
commit2de05069d2d8195d75790bb392e5825c34ed3f36 (patch)
treeaaefd79a8993818b55fb17e90325b0f425938eca
parent30b4e9ecfdc5939af9051bd4fc1d7f30871b8118 (diff)
downloadmbuto-2de05069d2d8195d75790bb392e5825c34ed3f36.tar
mbuto-2de05069d2d8195d75790bb392e5825c34ed3f36.tar.gz
mbuto-2de05069d2d8195d75790bb392e5825c34ed3f36.tar.bz2
mbuto-2de05069d2d8195d75790bb392e5825c34ed3f36.tar.lz
mbuto-2de05069d2d8195d75790bb392e5825c34ed3f36.tar.xz
mbuto-2de05069d2d8195d75790bb392e5825c34ed3f36.tar.zst
mbuto-2de05069d2d8195d75790bb392e5825c34ed3f36.zip
mbuto: In prog_add(), look for executable path in output from which
...instead of just picking the output: on Fedora and RHEL 'which' itself is an alias, but its actual path will also be reported by 'which -a'. Reported-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
-rwxr-xr-xmbuto10
1 files changed, 9 insertions, 1 deletions
diff --git a/mbuto b/mbuto
index abfad76..20427ad 100755
--- a/mbuto
+++ b/mbuto
@@ -780,7 +780,15 @@ prog_add() {
IFS=','
for __a in ${1}; do
- __bin="$(${WHICH} "${__a}")" && break
+ # We might have alias definitions too, look for a path
+ IFS='
+'
+ __bin=
+ for __path in $(${WHICH} -a "${__a}" 2>/dev/null); do
+ [ -x "${__path}" ] && __bin="${__path}" && break
+ done
+ [ -n "${__bin}" ] && break
+ IFS=','
done
unset IFS
[ -z "${__bin}" ] && err "Can't source ${1}"