commit e1ec28ac9d5f0aac30b16d580e7915bbd7e2f295 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:19:52 2019 -0400 Package init diff --git a/which-2.21-coverity-fixes.patch b/which-2.21-coverity-fixes.patch new file mode 100644 index 0000000..0be9e3f --- /dev/null +++ b/which-2.21-coverity-fixes.patch @@ -0,0 +1,27 @@ +diff -up which-2.21/tilde/tilde.c.me which-2.21/tilde/tilde.c +--- which-2.21/tilde/tilde.c.me 2018-07-23 14:32:47.002225732 +0200 ++++ which-2.21/tilde/tilde.c 2018-07-23 14:49:06.363623898 +0200 +@@ -196,7 +196,8 @@ tilde_expand (string) + int result_size, result_index; + + result_index = result_size = 0; +- if (result = strchr (string, '~')) ++ result = strchr (string, '~'); ++ if (result) + result = (char *)xmalloc (result_size = (strlen (string) + 16)); + else + result = (char *)xmalloc (result_size = (strlen (string) + 1)); +diff -up which-2.21/which.c.me which-2.21/which.c +diff -up which-2.21/which.c.me which-2.21/which.c +--- which-2.21/which.c.me 2018-07-23 15:09:04.355222509 +0200 ++++ which-2.21/which.c 2018-07-25 14:57:43.696309701 +0200 +@@ -671,6 +671,9 @@ int main(int argc, char *argv[]) + } + } + ++ if (abs_path) ++ free(abs_path); ++ + return fail_count; + } + diff --git a/which-2.21.tar.gz b/which-2.21.tar.gz new file mode 100644 index 0000000..ee8c428 Binary files /dev/null and b/which-2.21.tar.gz differ diff --git a/which.spec b/which.spec new file mode 100644 index 0000000..9d0a667 --- /dev/null +++ b/which.spec @@ -0,0 +1,51 @@ +Name: which +Version: 2.21 +Release: 12 +Summary: Show the full path of commands +License: GPLv3 +URL: https://savannah.gnu.org/projects/which/ +Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz +Source1: which2.sh +Source2: which2.csh +Patch0: which-2.21-coverity-fixes.patch + +BuildRequires: gcc git + +%description +Which takes one or more arguments. For each of its arguments it prints to stdout +the full path of the executables that would have been executed when this argument +had been entered at the shell prompt. + +%package help +Summary: Help files for which +%description help +Contains documents and manuals files for which + +%prep +%autosetup -n %{name}-%{version} -p1 -S git + +%build +%configure +%make_build + +%install +%make_install + +mkdir -p %{buildroot}/%{_sysconfdir}/profile.d +install -p -m 0644 %{SOURCE1} %{SOURCE2} %{buildroot}/%{_sysconfdir}/profile.d +rm -f %{buildroot}/%{_datadir}/info/dir + +%files +%doc AUTHORS +%license COPYING +%{_sysconfdir}/profile.d/%{name}* +%{_bindir}/%{name} + +%files help +%doc EXAMPLES NEWS README +%{_mandir}/man1/%{name}.1.gz +%{_datadir}/info/%{name}.info.gz + +%changelog +* Wed Aug 28 2019 luhuaxin - 2.21-12 +- Package init diff --git a/which2.csh b/which2.csh new file mode 100644 index 0000000..da9655e --- /dev/null +++ b/which2.csh @@ -0,0 +1,3 @@ +# Initialization script for csh + +# alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' diff --git a/which2.sh b/which2.sh new file mode 100644 index 0000000..d7e5373 --- /dev/null +++ b/which2.sh @@ -0,0 +1,7 @@ +# Initialization script for bash and sh + +if [ "$0" = ksh ] ; then + alias which='(alias; typeset -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' +else + alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' +fi