- Fixed regression, use export instead alias
This commit is contained in:
parent
a9da4a55f2
commit
1fa13a9bff
@ -1,7 +1,7 @@
|
|||||||
Summary: Displays where a particular program in your path is located
|
Summary: Displays where a particular program in your path is located
|
||||||
Name: which
|
Name: which
|
||||||
Version: 2.21
|
Version: 2.21
|
||||||
Release: 28%{?dist}
|
Release: 29%{?dist}
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz
|
Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz
|
||||||
Source1: which2.sh
|
Source1: which2.sh
|
||||||
@ -41,6 +41,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
|||||||
%{_mandir}/man1/which.1*
|
%{_mandir}/man1/which.1*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Oct 15 2021 Than Ngo <than@redhat.com> - 2.21-29
|
||||||
|
- Fixed regression, use export instead alias
|
||||||
|
|
||||||
* Sun Oct 10 2021 Than Ngo <than@redhat.com> - 2.21-28
|
* Sun Oct 10 2021 Than Ngo <than@redhat.com> - 2.21-28
|
||||||
- Resolves: #2009547, which treats function contents as aliases when parsing ksh
|
- Resolves: #2009547, which treats function contents as aliases when parsing ksh
|
||||||
|
|
||||||
|
26
which2.sh
26
which2.sh
@ -1,18 +1,24 @@
|
|||||||
# shellcheck shell=sh
|
# shellcheck shell=sh
|
||||||
# Initialization script for bash, sh, mksh and ksh
|
# Initialization script for bash, sh, mksh and ksh
|
||||||
|
|
||||||
which_shell="$(cat /proc/$$/comm)"
|
case "$(cat /proc/$$/comm)" in
|
||||||
|
ksh|mksh)
|
||||||
|
which_declare="typeset -fS"
|
||||||
|
which_opt=""
|
||||||
|
;;
|
||||||
|
zsh)
|
||||||
|
which_declare="typeset -f"
|
||||||
|
which_opt=""
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
which_declare="declare -f"
|
||||||
|
which_opt="-f"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then
|
|
||||||
alias which_declare="typeset -fS"
|
|
||||||
which_opt=""
|
|
||||||
else
|
|
||||||
which_opt="-f"
|
|
||||||
alias which_declare="declare -f"
|
|
||||||
fi
|
|
||||||
|
|
||||||
which () {
|
which () {
|
||||||
(alias; which_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 which_declare
|
||||||
export ${which_opt} which
|
export ${which_opt} which
|
||||||
|
Loading…
Reference in New Issue
Block a user