diff --git a/which.spec b/which.spec index e3fe1e9..0c2e87b 100644 --- a/which.spec +++ b/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 25%{?dist} +Release: 26%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -40,6 +40,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Fri May 07 2021 Than Ngo - 2.21-26 +- Related: #1940464, fixed unbound variable + * Fri Apr 16 2021 Mohan Boddu - 2.21-25 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 diff --git a/which2.sh b/which2.sh index 2b8b20a..6ef7979 100644 --- a/which2.sh +++ b/which2.sh @@ -1,18 +1,19 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -_declare="declare -f" -_opt="-f" -_shell="$(basename $SHELL)" +which_declare="declare -f" +which_opt="-f" +which_shell="$(cat /proc/$$/comm)" -if [ "$_shell" = "ksh" ] || [ "$_shell" = "mksh" ] || [ "$_shell" = "zsh" ] ; then - _declare="typeset -f" - _opt="" +if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then + which_declare="typeset -f" + which_opt="" fi which () { -(alias; eval ${_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" +(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" } -export ${_opt} which +export which_declare +export ${which_opt} which