From f5c35cec968dae7e1afae320adc63007755fb8f6 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Dec 04 2021 07:09:03 +0000 Subject: import which-2.21-17.el8 --- diff --git a/SOURCES/which2.sh b/SOURCES/which2.sh index 6ef7979..0f47f9e 100644 --- a/SOURCES/which2.sh +++ b/SOURCES/which2.sh @@ -1,18 +1,27 @@ # shellcheck shell=sh # Initialization script for bash, sh, mksh and ksh -which_declare="declare -f" -which_opt="-f" -which_shell="$(cat /proc/$$/comm)" +case "$(basename $(readlink /proc/$$/exe))" in +*ksh*) + which_declare="" + which_opt="" + ;; +zsh) + which_declare="typeset -f" + which_opt="" + ;; +bash|sh) + which_declare="declare -f" + which_opt="-f" + ;; +*) + which_declare="" + which_opt="" + ;; +esac -if [ "$which_shell" = "ksh" ] || [ "$which_shell" = "mksh" ] || [ "$which_shell" = "zsh" ] ; then - which_declare="typeset -f" - which_opt="" -fi - -which () -{ -(alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot "$@" +which () { + (alias; eval ${which_declare}) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot $@ } export which_declare diff --git a/SPECS/which.spec b/SPECS/which.spec index 46d38a9..489f39c 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: 16%{?dist} +Release: 17%{?dist} License: GPLv3 Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz Source1: which2.sh @@ -9,7 +9,8 @@ Source2: which2.csh Patch0: which-2.21-coverity-fixes.patch Patch1: which-2.21-coverity.patch Url: https://savannah.gnu.org/projects/which/ -BuildRequires: gcc +Requires: coreutils +BuildRequires: gcc BuildRequires: readline-devel %description @@ -41,6 +42,10 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir %{_mandir}/man1/which.1* %changelog +* Thu Nov 25 2021 Than Ngo - 2.21-17 +- Resolves: #2025709, check shell correctly +- Resolves: #2009547, which treats function contents as aliases when parsing ksh + * Wed May 05 2021 Than Ngo - 2.21-16 - Related: #1940468, fixed unbound variable