Compare commits

...

No commits in common. "c8" and "c9-beta" have entirely different histories.
c8 ... c9-beta

3 changed files with 107 additions and 107 deletions

View File

@ -1,27 +1,65 @@
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;
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;
- 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[])
}
@@ -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);
}
+ if (abs_path)
+ free(abs_path);
+
return fail_count;
+ 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))

View File

@ -1,62 +0,0 @@
diff -up which-2.21/tilde/tilde.c.coverity2 which-2.21/tilde/tilde.c
--- which-2.21/tilde/tilde.c.coverity2 2021-03-21 21:04:34.691775991 +0100
+++ which-2.21/tilde/tilde.c 2021-03-21 21:13:36.853129481 +0100
@@ -193,9 +193,8 @@ 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;
result = strchr (string, '~');
if (result)
result = (char *)xmalloc (result_size = (strlen (string) + 16));
@@ -271,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.coverity2 which-2.21/which.c
--- which-2.21/which.c.coverity2 2021-03-21 21:04:34.691775991 +0100
+++ which-2.21/which.c 2021-03-21 21:04:34.692775983 +0100
@@ -76,8 +76,9 @@ 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;
+ char *p;
name_len = strlen(name);
@@ -85,7 +86,6 @@ static char *find_command_in_path(const
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))

View File

@ -1,16 +1,16 @@
Summary: Displays where a particular program in your path is located
Name: which
Version: 2.21
Release: 20%{?dist}
Release: 29%{?dist}
License: GPLv3
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-coverity.patch
Patch2: which-2.21-path_max.patch
Patch1: which-2.21-path_max.patch
Url: https://savannah.gnu.org/projects/which/
Requires: coreutils
BuildRequires: make
BuildRequires: gcc
BuildRequires: readline-devel
@ -21,8 +21,7 @@ the specified program is in your PATH.
%prep
%setup -q
%patch0 -p1 -b .coverity
%patch1 -p1 -b .coverity2
%patch2 -p1 -b .path_max
%patch1 -p1 -b .path_max
%build
%configure
@ -44,38 +43,63 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
%{_mandir}/man1/which.1*
%changelog
* Wed Mar 22 2023 Than Ngo <than@redhat.com> - 2.21-20
- Related: #2140566, bring test over from Brew dist-git
* Mon Mar 27 2023 Than Ngo <than@redhat.com> - 2.21-29
- Resolves: #2181974, which fails for long path
* Tue Mar 21 2023 Than Ngo <than@redhat.com> - 2.21-19
- Resolves: #2140566, which fails for long path
* Fri Apr 15 2022 Than Ngo <than@redhat.com> - 2.21-28
- Resolves: #2050996, error on login when using ksh as the default shell
* Mon Apr 11 2022 Than Ngo <than@redhat.com> - 2.21-18
- Resolves: #2044450 - custom profile generates shell error
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2.21-27
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Nov 25 2021 Than Ngo <than@redhat.com> - 2.21-17
- Resolves: #2025709, check shell correctly
- Resolves: #2009547, which treats function contents as aliases when parsing ksh
* Fri May 07 2021 Than Ngo <than@redhat.com> - 2.21-26
- Related: #1940464, fixed unbound variable
* Wed May 05 2021 Than Ngo <than@redhat.com> - 2.21-16
- Related: #1940468, fixed unbound variable
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.21-25
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Mar 23 2021 Than Ngo <than@redhat.com> - 2.21-24
- fix regression in zsh
* Fri Apr 30 2021 Than Ngo <than@redhat.com> - 2.21-15
- Related: #1940468, fix error when the user runs which in bash with strict bash environment
* Sun Mar 21 2021 Than Ngo <than@redhat.com> - 2.21-23
- improved which2.sh
* Tue Mar 23 2021 Than Ngo <than@redhat.com> - 2.21-14
- Related: #1940468, fix regression if SHELL=zsh
* Thu Mar 18 2021 Than Ngo <than@redhat.com> - 2.21-22
- Resolves: #1940464, fixed syntax error testcase: a=b which ls
* Fri Mar 19 2021 Than Ngo <than@redhat.com> - 2.21-13
- Resolves: #1940468, fixed syntax error caused by testcase: a=b which ls
Coverity issue
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Nov 19 2019 Than Ngo <than@redhat.com> - 2.21-12
- Fixed coverity issue
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Nov 19 2019 Than Ngo <than@redhat.com> - 2.21-11
- Resolves: #1768506, fix wrong alias
* Wed Mar 25 2020 Than Ngo <than@redhat.com> - 2.21-19
- fixed #1817138 - Invalid syntax in /etc/profile.d/which2
* Tue Mar 24 2020 Than Ngo <than@redhat.com> - 2.21-18
- set correct alias for mksh
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-17
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Tue Nov 05 2019 Than Ngo <than@redhat.com> - 2.21-16
- set correct alias for ksh
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Feb 04 2019 Than Ngo <than@redhat.com> - 2.21-14
- bump release
* Mon Feb 04 2019 Than Ngo <than@redhat.com> - 2.21-13
- bump release
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.21-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 26 2018 Than Ngo <than@redhat.com> - 2.21-11
- fixed more coverity issue
* Mon Jul 23 2018 Than Ngo <than@redhat.com> - 2.21-10
- Fix coverity issues