diff --git a/which.spec b/which.spec index ad06ed9..b644114 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: 27%{?dist} +Release: 28%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Sun Oct 10 2021 Than Ngo - 2.21-28 +- Resolves: #2009547, which treats function contents as aliases when parsing ksh + * Fri Jul 23 2021 Fedora Release Engineering - 2.21-27 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild diff --git a/which2.sh b/which2.sh index 6ef7979..2a108e6 100644 --- a/which2.sh +++ b/which2.sh @@ -1,19 +1,18 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -which_declare="declare -f" -which_opt="-f" which_shell="$(cat /proc/$$/comm)" if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then - which_declare="typeset -f" + alias which_declare="typeset -fS" which_opt="" +else + which_opt="-f" + alias which_declare="declare -f" fi -which () -{ -(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" +which () { + (alias; which_declare) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ } -export which_declare export ${which_opt} which