Compare commits
10 Commits
36c3f93f98
...
e2431b46c9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2431b46c9 | ||
|
|
ad61dc8069 | ||
|
|
b05a8ccd00 | ||
|
|
cfba490d3a | ||
|
|
2726a91b0c | ||
|
|
6ed697e294 | ||
|
|
cf18d6c40a | ||
|
|
a7445acfc8 | ||
|
|
61b15fc489 | ||
|
|
e2702e3d9d |
59
0001-which-fails-for-long-path.patch
Normal file
59
0001-which-fails-for-long-path.patch
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
From 77420bf2e35444f348b19e0acaf1f77bb4ed3f76 Mon Sep 17 00:00:00 2001
|
||||||
|
From: fandeyuan <fandeyuan@kylinos.cn>
|
||||||
|
Date: Tue, 30 Apr 2024 14:18:20 +0800
|
||||||
|
Subject: [PATCH] which fails for long path
|
||||||
|
|
||||||
|
---
|
||||||
|
which.c | 11 ++++++++---
|
||||||
|
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/which.c b/which.c
|
||||||
|
index 1606052..525c0d0 100644
|
||||||
|
--- a/which.c
|
||||||
|
+++ b/which.c
|
||||||
|
@@ -19,10 +19,15 @@
|
||||||
|
#include "sys.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
+#include <limits.h>
|
||||||
|
#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, const char *path_list)
|
||||||
|
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;
|
||||||
|
@@ -162,7 +167,7 @@ static char *find_command_in_path(const char *name, const char *path_list, int *
|
||||||
|
return (found);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static char cwd[256];
|
||||||
|
+static char cwd[PATH_MAX];
|
||||||
|
static size_t cwdlen;
|
||||||
|
|
||||||
|
static void get_current_working_directory(void)
|
||||||
|
@@ -194,7 +199,7 @@ static void get_current_working_directory(void)
|
||||||
|
|
||||||
|
static char *path_clean_up(const char *path)
|
||||||
|
{
|
||||||
|
- static char result[256];
|
||||||
|
+ static char result[PATH_MAX];
|
||||||
|
|
||||||
|
const char *p1 = path;
|
||||||
|
char *p2 = result;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
34
which.spec
34
which.spec
@ -1,15 +1,14 @@
|
|||||||
Name: which
|
Name: which
|
||||||
Version: 2.21
|
Version: 2.21
|
||||||
Release: 13
|
Release: 16
|
||||||
Summary: Show the full path of commands
|
Summary: Show the full path of commands
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
URL: https://savannah.gnu.org/projects/which/
|
URL: https://savannah.gnu.org/projects/which/
|
||||||
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
|
|
||||||
Source2: which2.csh
|
|
||||||
Patch0: which-2.21-coverity-fixes.patch
|
|
||||||
|
|
||||||
BuildRequires: gcc git
|
Patch1: 0001-which-fails-for-long-path.patch
|
||||||
|
|
||||||
|
BuildRequires: gcc
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Which takes one or more arguments. For each of its arguments it prints to stdout
|
Which takes one or more arguments. For each of its arguments it prints to stdout
|
||||||
@ -22,7 +21,7 @@ Summary: Help files for which
|
|||||||
Contains documents and manuals files for which
|
Contains documents and manuals files for which
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{name}-%{version} -p1 -S git
|
%autosetup -n %{name}-%{version} -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure
|
%configure
|
||||||
@ -31,13 +30,10 @@ Contains documents and manuals files for which
|
|||||||
%install
|
%install
|
||||||
%make_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
|
rm -f %{buildroot}/%{_datadir}/info/dir
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%license COPYING AUTHORS
|
%license COPYING AUTHORS
|
||||||
%{_sysconfdir}/profile.d/%{name}*
|
|
||||||
%{_bindir}/%{name}
|
%{_bindir}/%{name}
|
||||||
|
|
||||||
%files help
|
%files help
|
||||||
@ -46,7 +42,25 @@ rm -f %{buildroot}/%{_datadir}/info/dir
|
|||||||
%{_datadir}/info/%{name}.info.gz
|
%{_datadir}/info/%{name}.info.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Wed Oct 10 2019 luhuaxin <luhuaxin@huawei.com> - 2.21-13
|
* Tue Apr 30 2024 Deyuan Fan <fandeyuan@kylinos.cn> - 2.21-16
|
||||||
|
- Type: bugfix
|
||||||
|
- ID: NA
|
||||||
|
- SUG: NA
|
||||||
|
- DESC: fix:which fails for long path
|
||||||
|
|
||||||
|
* Mon Jun 20 2022 yangzhao <yangzhao1@kylinos.cn> - 2.21-15
|
||||||
|
- Type: enhancement
|
||||||
|
- ID: NA
|
||||||
|
- SUG: NA
|
||||||
|
- DESC: remove unnecessary -S git
|
||||||
|
|
||||||
|
* Wed Jan 8 2020 openEuler Buildteam <buildteam@openeuler.org> - 2.21-14
|
||||||
|
- Type: enhancement
|
||||||
|
- ID: NA
|
||||||
|
- SUG: NA
|
||||||
|
- DESC: remove unnecessary files
|
||||||
|
|
||||||
|
* Thu Oct 10 2019 luhuaxin <luhuaxin@huawei.com> - 2.21-13
|
||||||
- Type: enhancement
|
- Type: enhancement
|
||||||
- ID: NA
|
- ID: NA
|
||||||
- SUG: NA
|
- SUG: NA
|
||||||
|
|||||||
5
which.yaml
Normal file
5
which.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
version_control: NA
|
||||||
|
src_repo:
|
||||||
|
tag_prefix:
|
||||||
|
seperator:
|
||||||
|
url: http://ftp.gnu.org/gnu/which/
|
||||||
@ -1,3 +0,0 @@
|
|||||||
# Initialization script for csh
|
|
||||||
|
|
||||||
# alias which 'alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
# 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
|
|
||||||
Loading…
x
Reference in New Issue
Block a user