From cdd9067aebbbe6860240787ce17faab384f759be Mon Sep 17 00:00:00 2001 From: MSVSphere Packaging Team Date: Tue, 26 Nov 2024 19:41:18 +0300 Subject: [PATCH] import which-2.21-42.el10 --- .gitignore | 1 + .which.metadata | 1 + SOURCES/which-2.21-coverity-fixes.patch | 65 ++++ SOURCES/which-2.21-path_max.patch | 46 +++ SOURCES/which2.csh | 3 + SOURCES/which2.sh | 13 + SPECS/which.spec | 397 ++++++++++++++++++++++++ 7 files changed, 526 insertions(+) create mode 100644 .gitignore create mode 100644 .which.metadata create mode 100644 SOURCES/which-2.21-coverity-fixes.patch create mode 100644 SOURCES/which-2.21-path_max.patch create mode 100644 SOURCES/which2.csh create mode 100644 SOURCES/which2.sh create mode 100644 SPECS/which.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a1a37ab --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/which-2.21.tar.gz diff --git a/.which.metadata b/.which.metadata new file mode 100644 index 0000000..926ff4f --- /dev/null +++ b/.which.metadata @@ -0,0 +1 @@ +6b6bec3d2b3d4661c164feb81b9b1d22d1359ded SOURCES/which-2.21.tar.gz diff --git a/SOURCES/which-2.21-coverity-fixes.patch b/SOURCES/which-2.21-coverity-fixes.patch new file mode 100644 index 0000000..fbcb636 --- /dev/null +++ b/SOURCES/which-2.21-coverity-fixes.patch @@ -0,0 +1,65 @@ +diff -up which-2.21/tilde/tilde.c.coverity which-2.21/tilde/tilde.c +--- which-2.21/tilde/tilde.c.coverity 2008-01-16 18:51:57.000000000 +0100 ++++ which-2.21/tilde/tilde.c 2021-03-21 11:43:00.338160051 +0100 +@@ -193,10 +193,10 @@ tilde_expand (string) + const char *string; + { + char *result; +- int result_size, result_index; ++ int result_size = 0, result_index = 0; + +- 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)); +@@ -270,7 +270,7 @@ isolate_tilde_prefix (fname, lenp) + char *ret; + int i; + +- ret = (char *)xmalloc (strlen (fname)); ++ ret = (char *)xmalloc (strlen (fname) + 1); + #if defined (__MSDOS__) + for (i = 1; fname[i] && fname[i] != '/' && fname[i] != '\\'; i++) + #else +diff -up which-2.21/which.c.coverity which-2.21/which.c +--- which-2.21/which.c.coverity 2015-03-19 17:50:24.000000000 +0100 ++++ which-2.21/which.c 2021-03-21 12:19:31.289160885 +0100 +@@ -76,16 +76,16 @@ static int skip_functions = 0, read_func + + static char *find_command_in_path(const char *name, const char *path_list, int *path_index) + { +- char *found = NULL, *full_path; ++ char *found = NULL, *full_path = NULL; + int status, name_len; + + name_len = strlen(name); ++ char *p; + + if (!absolute_program(name)) + absolute_path_given = 0; + else + { +- char *p; + absolute_path_given = 1; + + if (abs_path) +@@ -159,6 +159,7 @@ static char *find_command_in_path(const + free(full_path); + } + ++ name = NULL; p = NULL; path_list = NULL; + return (found); + } + +@@ -540,7 +541,7 @@ int main(int argc, char *argv[]) + int function_start_type = 0; + if (read_alias || read_functions) + { +- char buf[1024]; ++ char buf[1024] = {}; + int processing_aliases = read_alias; + + if (isatty(0)) diff --git a/SOURCES/which-2.21-path_max.patch b/SOURCES/which-2.21-path_max.patch new file mode 100644 index 0000000..eec9958 --- /dev/null +++ b/SOURCES/which-2.21-path_max.patch @@ -0,0 +1,46 @@ +diff -up which-2.21/which.c.me which-2.21/which.c +--- which-2.21/which.c.me 2022-11-07 13:11:03.580798950 +0100 ++++ which-2.21/which.c 2022-11-07 15:45:41.366085798 +0100 +@@ -19,10 +19,15 @@ + #include "sys.h" + #include + #include ++#include + #include "getopt.h" + #include "tilde/tilde.h" + #include "bash.h" + ++#ifndef PATH_MAX ++#define PATH_MAX 4096 ++#endif ++ + static const char *progname; + + static void print_usage(FILE *out) +@@ -63,7 +68,7 @@ static void print_fail(const char *name, + fprintf(stderr, "%s: no %s in (%s)\n", progname, name, path_list); + } + +-static char home[256]; ++static char home[PATH_MAX]; + static size_t homelen = 0; + + static int absolute_path_given; +@@ -163,7 +168,7 @@ static char *find_command_in_path(const + return (found); + } + +-static char cwd[256]; ++static char cwd[PATH_MAX]; + static size_t cwdlen; + + static void get_current_working_directory(void) +@@ -195,7 +200,7 @@ static void get_current_working_director + + static char *path_clean_up(const char *path) + { +- static char result[256]; ++ static char result[PATH_MAX]; + + const char *p1 = path; + char *p2 = result; diff --git a/SOURCES/which2.csh b/SOURCES/which2.csh new file mode 100644 index 0000000..da9655e --- /dev/null +++ b/SOURCES/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/SOURCES/which2.sh b/SOURCES/which2.sh new file mode 100644 index 0000000..a7db49c --- /dev/null +++ b/SOURCES/which2.sh @@ -0,0 +1,13 @@ +# shellcheck shell=sh +# Initialization script for bash, sh, mksh and ksh + +case "$(basename $(readlink /proc/$$/exe))" in +*ksh*|zsh) + alias which='alias | /usr/bin/which --tty-only --read-alias --show-tilde --show-dot' + ;; +bash|sh) + alias which='(alias; declare -f) | /usr/bin/which --tty-only --read-alias --read-functions --show-tilde --show-dot' + ;; +*) + ;; +esac diff --git a/SPECS/which.spec b/SPECS/which.spec new file mode 100644 index 0000000..724ccf4 --- /dev/null +++ b/SPECS/which.spec @@ -0,0 +1,397 @@ +%global has_which2_alias 1 + +Summary: Displays where a particular program in your path is located +Name: which +Version: 2.21 +Release: 42%{?dist} +License: GPL-3.0-only +Source0: http://ftp.gnu.org/gnu/which/%{name}-%{version}.tar.gz +Source1: which2.sh +Source2: which2.csh +Patch0: which-2.21-coverity-fixes.patch +Patch1: which-2.21-path_max.patch +Url: https://savannah.gnu.org/projects/which/ +Requires: coreutils +BuildRequires: make +BuildRequires: gcc +BuildRequires: readline-devel + +%description +The which command shows the full pathname of a specified program, if +the specified program is in your PATH. + +%prep +%autosetup -p1 + +%build +%configure +%make_build + +%install +%make_install + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d +%if %{has_which2_alias} + install -p -m 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d/ +%endif +rm -f $RPM_BUILD_ROOT%{_infodir}/dir + +%files +%license COPYING +%doc EXAMPLES README AUTHORS NEWS +%if %{has_which2_alias} +%attr(0644,root,root) %{_sysconfdir}/profile.d/which2.* +%endif +%{_bindir}/which +%{_infodir}/which.info* +%{_mandir}/man1/which.1* + +%changelog +* Mon Jun 24 2024 Troy Dawson - 2.21-42 +- Bump release for June 2024 mass rebuild + +* Sat Jan 27 2024 Fedora Release Engineering - 2.21-41 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sat Jul 22 2023 Fedora Release Engineering - 2.21-40 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Mar 08 2023 Than Ngo - 2.21-39 +- fixed #2175953, enable which2 alias + +* Sun Feb 19 2023 Than Ngo - 2.21-38 +- migrated to SPDX license + +* Sat Jan 21 2023 Fedora Release Engineering - 2.21-37 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Mon Nov 07 2022 Than Ngo - 2.21-36 +- which fails for long path + +* Fri Aug 05 2022 Than Ngo - 2.21-35 +- disable which2 alias and function by default as it caused more problems than benefits + +* Sat Jul 23 2022 Fedora Release Engineering - 2.21-34 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Wed Feb 09 2022 Than Ngo - 2.21-33 +- make which2.sh script more robust, + +* Sat Jan 22 2022 Fedora Release Engineering - 2.21-32 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Dec 02 2021 Than Ngo - 2.21-31 +- check shell correctly + +* Tue Oct 26 2021 Than Ngo - 2.21-30 +- disable the --read-functions option in korn shells + +* Fri Oct 15 2021 Than Ngo - 2.21-29 +- Fixed regression, use export instead alias + +* 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 + +* Tue May 04 2021 Than Ngo - 2.21-26 +- Resolves: #1942153, fixed unbound variable + +* Mon Apr 26 2021 Than Ngo - 2.21-25 +- improved which2.sh + +* Tue Mar 23 2021 Than Ngo - 2.21-24 +- fixed regression if SHELL=zsh + +* Sun Mar 21 2021 Than Ngo - 2.21-23 +- fixed coverity issues +- improved which2.sh + +* Thu Mar 18 2021 Than Ngo - 2.21-22 +- fixed syntax error testcase: a=b which ls + +* Wed Jan 27 2021 Fedora Release Engineering - 2.21-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 2.21-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Mar 25 2020 Than Ngo - 2.21-19 +- fixed #1817138 - Invalid syntax in /etc/profile.d/which2 + +* Tue Mar 24 2020 Than Ngo - 2.21-18 +- set correct alias for mksh + +* Fri Jan 31 2020 Fedora Release Engineering - 2.21-17 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Tue Nov 05 2019 Than Ngo - 2.21-16 +- set correct alias for ksh + +* Sat Jul 27 2019 Fedora Release Engineering - 2.21-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Feb 04 2019 Than Ngo - 2.21-14 +- bump release + +* Mon Feb 04 2019 Than Ngo - 2.21-13 +- bump release + +* Sun Feb 03 2019 Fedora Release Engineering - 2.21-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jul 26 2018 Than Ngo - 2.21-11 +- fixed more coverity issue + +* Mon Jul 23 2018 Than Ngo - 2.21-10 +- Fix coverity issues + +* Sat Jul 14 2018 Fedora Release Engineering - 2.21-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Fri Feb 16 2018 Jason L Tibbitts III - 2.21-8 +- Fix invalid [ ... ] syntax which results in complaints by zsh. + https://bugzilla.redhat.com/show_bug.cgi?id=1546221 +- Remove pointless Group tag, buildroot cleaning and %%defattr. + +* Fri Feb 09 2018 Fedora Release Engineering - 2.21-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Mon Feb 05 2018 Than Ngo - 2.21-6 +- added CI tests using the standard test interface + +* Wed Jan 31 2018 Than Ngo - 2.21-5 +- fixed bz#1526500 - 'declare' not found under ksh + +* Thu Aug 03 2017 Fedora Release Engineering - 2.21-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Thu Jul 27 2017 Fedora Release Engineering - 2.21-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Sat Feb 11 2017 Fedora Release Engineering - 2.21-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Mon Jun 27 2016 Than Ngo - 2.21-1 +- update to 2.21 + +* Fri Feb 05 2016 Fedora Release Engineering - 2.20-13 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Fri Jun 19 2015 Fedora Release Engineering - 2.20-12 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat Feb 21 2015 Till Maas - 2.20-11 +- Rebuilt for Fedora 23 Change + https://fedoraproject.org/wiki/Changes/Harden_all_packages_with_position-independent_code + +* Thu Feb 19 2015 Till Maas - 2.20-10 +- Use alias instead of exported function for which to avoid bashism, +http://unix.stackexchange.com/questions/59360/#59431 + +* Wed Feb 18 2015 Till Maas - 2.20-9 +- Check functions (#1194044) +- Use %%license + +* Mon Aug 18 2014 Fedora Release Engineering - 2.20-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sun Jun 08 2014 Fedora Release Engineering - 2.20-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Sun Aug 04 2013 Fedora Release Engineering - 2.20-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Fri Feb 15 2013 Fedora Release Engineering - 2.20-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Sun Jul 22 2012 Fedora Release Engineering - 2.20-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Sat Jan 14 2012 Fedora Release Engineering - 2.20-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Feb 07 2011 Fedora Release Engineering - 2.20-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Wed Jan 19 2011 Than Ngo - 2.20-1 +- 2.2.0 +- disable alias which for cshell + +* Mon Jul 27 2009 Fedora Release Engineering - 2.19-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed Feb 25 2009 Fedora Release Engineering - 2.19-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Thu Mar 06 2008 Warren Togami 2.19-3 +- install-info should exit gracefully when --nodocs + +* Fri Feb 15 2008 Than Ngo 2.19-2 +- rebuilt + +* Fri Jan 25 2008 Than Ngo 2.19-1 +- 2.19, fix #399551, #430159 + +* Tue Nov 27 2007 Than Ngo - 2.18-5 +- fix permission which-2 scripts + +* Tue Nov 27 2007 Than Ngo 2.18-4 +- fix permission which-2 scripts + +* Mon Nov 26 2007 Karsten Hopp 2.18-3 +- add dir entry for info page + +* Tue Nov 20 2007 Than Ngo 2.18-2 +- cleanup specfile + +* Tue Nov 13 2007 Than Ngo 2.18-1 +- 2.18 + +* Tue Nov 13 2007 Than Ngo 2.16-10 +- cleanup specfile +- get rid of dev dependency + +* Mon Apr 23 2007 Than Ngo - 2.16-9 +- add missing which-2 script for csh +- cleanup specfile #226539 + +* Mon Jan 22 2007 Than Ngo - 2.16-8 +- install-info scriptlet failures + +* Fri Jul 14 2006 Jesse Keating - 2.16-7 +- rebuild + +* Fri Feb 10 2006 Jesse Keating - 2.16-6.2.1 +- bump again for double-long bug on ppc(64) + +* Tue Feb 07 2006 Jesse Keating - 2.16-6.2 +- rebuilt for new gcc4.1 snapshot and glibc changes + +* Fri Dec 09 2005 Jesse Keating +- rebuilt + +* Mon Mar 07 2005 Than Ngo 2.16-6 +- rebuilt + +* Wed Feb 09 2005 Than Ngo 2.16-5 +- rebuilt + +* Sat Aug 07 2004 Than Ngo 2.16-4 +- add missing URL (thanks to Robert Scheck) + +* Tue Jun 15 2004 Elliot Lee +- rebuilt + +* Fri Feb 13 2004 Elliot Lee +- rebuilt + +* Wed Sep 24 2003 Florian La Roche +- update to 2.16 +- fix %%preun + +* Thu Jul 17 2003 Than Ngo 2.14-8 +- rebuild + +* Thu Jul 17 2003 Than Ngo 2.14-7 +- added Prereq: dev (bug #99275) + +* Wed Jun 04 2003 Elliot Lee +- rebuilt + +* Wed Jan 22 2003 Tim Powers +- rebuilt + +* Tue Dec 10 2002 Than Ngo 2.14-4 +- cleanup code (bug #78478) + +* Thu Nov 14 2002 Tim Powers 2.14-3 +- redirect info dir warnings to /dev/null + +* Thu Nov 7 2002 Than Ngo 2.14-1 +- add missing info file + +* Mon Jul 29 2002 Florian La Roche +- update to 2.14 wih better support for current bash + +* Fri Jun 21 2002 Tim Powers +- automated rebuild + +* Thu May 23 2002 Tim Powers +- automated rebuild + +* Wed Feb 27 2002 Than Ngo 2.13-3 +- use access instead stat in AFS environment (bug #60353) + +* Wed Jan 09 2002 Tim Powers +- automated rebuild + +* Wed Dec 05 2001 Florian La Roche +- update to 2.13 + +* Sat Aug 4 2001 Than Ngo +- fix bug 50844 + +* Sun Jun 24 2001 Elliot Lee +- Bump release + rebuild. + +* Sun Sep 10 2000 Florian La Roche +- 2.12 (only man-page fix) + +* Thu Jul 13 2000 Prospector +- automatic rebuild + +* Sun Jun 18 2000 Than Ngo +- FHS packaging. + +* Sun May 21 2000 Ngo Than +- put man pages in /usr/share/man/* + +* Thu Apr 20 2000 Florian La Roche +- update to 2.11 +- change from root:bin -> root:root + +* Mon Feb 07 2000 Preston Brown +- rebuild to gzip man page + +* Sun Jan 16 2000 Preston Brown +- newer stuff rom Carlo (2.10). Author's email: carlo@gnu.org + +* Thu Jan 13 2000 Preston Brown +- adopted Carlo's specfile. + +* Fri Sep 24 1999 Carlo Wood +- There should not be a reason anymore to include README.alias in the rpm docs. +- Don't install as root.root in RPM_BUILD_ROOT, in order to allow to build + rpm as non-root. +- Bug fix +- Added /etc/profile.d for automatic alias inclusion. + +* Wed Aug 25 1999 Carlo Wood +- Added README.alias. + +* Wed Aug 11 1999 Carlo Wood +- Typo in comment. + +* Thu May 27 1999 Carlo Wood +- Typo fix +- Moved maintainer targets from makefile to Makefile.am. + +* Tue May 18 1999 Carlo Wood +- Typo in appended changelog. +- Appended the old change log of `which-2.0.spec' to (this) changelog, + which is generated from the CVS log of `which-2.0.spec.in'. +- Generate which-2.spec from which-2.spec.in with automatic VERSION + and CHANGELOG substitution. + +* Fri May 14 1999 Carlo Wood +- Moved assignment of CFLAGS to the configure line, using RPM_OPT_FLAGS now. +- Corrected Source: line to point to ftp.gnu.org. + +* Sat Apr 17 1999 Carlo Wood +- Started to use automake and autoconf + +* Fri Apr 09 1999 Carlo Wood +- Renamed which-2.0.spec to which-2.spec +