diff --git a/SOURCES/which2.sh b/SOURCES/which2.sh index 2b8b20a..6ef7979 100644 --- a/SOURCES/which2.sh +++ b/SOURCES/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 diff --git a/SPECS/which.spec b/SPECS/which.spec index 299703c..46d38a9 100644 --- a/SPECS/which.spec +++ b/SPECS/which.spec @@ -1,7 +1,7 @@ Summary: Displays where a particular program in your path is located Name: which Version: 2.21 -Release: 14%{?dist} +Release: 16%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,13 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Wed May 05 2021 Than Ngo - 2.21-16 +- Related: #1940468, fixed unbound variable + + +* Fri Apr 30 2021 Than Ngo - 2.21-15 +- Related: #1940468, fix error when the user runs which in bash with strict bash environment + * Tue Mar 23 2021 Than Ngo - 2.21-14 - Related: #1940468, fix regression if SHELL=zsh