Compare commits

...

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

3 changed files with 107 additions and 107 deletions

View File

@ -1,65 +1,27 @@
diff -up which-2.21/tilde/tilde.c.coverity which-2.21/tilde/tilde.c diff -up which-2.21/tilde/tilde.c.me 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.me 2018-07-23 14:32:47.002225732 +0200
+++ which-2.21/tilde/tilde.c 2021-03-21 11:43:00.338160051 +0100 +++ which-2.21/tilde/tilde.c 2018-07-23 14:49:06.363623898 +0200
@@ -193,10 +193,10 @@ tilde_expand (string) @@ -196,7 +196,8 @@ tilde_expand (string)
const char *string; int result_size, result_index;
{
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, '~')) - if (result = strchr (string, '~'))
+ result = strchr (string, '~'); + result = strchr (string, '~');
+ if (result) + if (result)
result = (char *)xmalloc (result_size = (strlen (string) + 16)); result = (char *)xmalloc (result_size = (strlen (string) + 16));
else else
result = (char *)xmalloc (result_size = (strlen (string) + 1)); result = (char *)xmalloc (result_size = (strlen (string) + 1));
@@ -270,7 +270,7 @@ isolate_tilde_prefix (fname, lenp) diff -up which-2.21/which.c.me which-2.21/which.c
char *ret; diff -up which-2.21/which.c.me which-2.21/which.c
int i; --- 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
- ret = (char *)xmalloc (strlen (fname)); @@ -671,6 +671,9 @@ int main(int argc, char *argv[])
+ 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; + if (abs_path)
return (found); + free(abs_path);
+
return fail_count;
} }
@@ -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

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