which: update to 2.23 (#5343)

This commit is contained in:
Suyun 2025-04-21 02:20:01 +08:00 committed by GitHub
parent 999cfeef62
commit ef866c75e8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 33 deletions

View File

@ -2,7 +2,7 @@
# Contributor: Ray Donnelly <mingw.android@gmail.com>
pkgname=which
pkgver=2.21
pkgver=2.23
pkgrel=4
pkgdesc="A utility to show the full path of commands"
arch=('i686' 'x86_64')
@ -12,18 +12,15 @@ msys2_references=(
)
license=('GPL3')
source=("https://ftp.gnu.org/gnu/${pkgname}/${pkgname}-${pkgver}.tar.gz"
am-1.14.all.patch
msys2-allow-windows-mixed-absolute-paths.patch)
depends=('sh')
makedepends=('autotools' 'gcc')
#options=('debug' '!strip')
sha256sums=('f4a245b94124b377d8b49646bf421f9155d36aa7614b6ebf83705d3ffc76eaad'
'c4957d7730d84cd656dfde2086e81c75447d27d78f03f559a5d465774caf1ce3'
'3dcec525a2760c2caebc4d19f217916801c3911988fb601755dbbee14d2a07e8')
sha256sums=('a2c558226fc4d9e4ce331bd2fd3c3f17f955115d2c00e447618a4ef9978a2a73'
'adf32a958c3cb212e20bc95b716a988a02eac3f297007db201e56d29434be8c3')
prepare() {
cd ${srcdir}/${pkgname}-${pkgver}
patch -p1 -i ${srcdir}/am-1.14.all.patch
patch -p1 -i ${srcdir}/msys2-allow-windows-mixed-absolute-paths.patch
}

View File

@ -1,17 +0,0 @@
--- which-2.20/Makefile.am.orig 2007-10-10 00:11:42.000000000 +0000
+++ which-2.20/Makefile.am 2013-07-25 11:44:32.103848400 +0000
@@ -1,5 +1,5 @@
AUTOMAKE_OPTIONS = no-texinfo.tex
-ACLOCAL_AMFLAGS=@ACLOCAL_CWFLAGS@
+ACLOCAL_AMFLAGS = @ACLOCAL_CWFLAGS@
SUBDIRS = tilde .
--- which-2.20/tilde/Makefile.am.orig 2008-01-16 17:51:57.000000000 +0000
+++ which-2.20/tilde/Makefile.am 2013-07-25 11:45:06.456210600 +0000
@@ -1,4 +1,4 @@
-ACLOCAL_AMFLAGS=@ACLOCAL_CWFLAGS@
+ACLOCAL_AMFLAGS = @ACLOCAL_CWFLAGS@
AUTOMAKE_OPTIONS = foreign
noinst_LIBRARIES = libtilde.a
libtilde_a_SOURCES = tilde.c shell.c tilde.h ansi_stdlib.h bashansi.h xmalloc.h

View File

@ -1,32 +1,33 @@
diff -urN which-2.21.orig/which.c which-2.21/which.c
--- which-2.21.orig/which.c 2015-07-17 11:17:53.621936700 +0100
+++ which-2.21/which.c 2015-07-17 12:13:21.629563300 +0100
@@ -91,7 +91,14 @@
diff --git a/which.c b/which.c
index 496db08..f9f609b 100644
--- a/which.c
+++ b/which.c
@@ -104,7 +104,14 @@ static char *find_command_in_path(const char *name, const char *path_list, int *
if (abs_path)
free(abs_path);
+#if defined(__MSYS__)
+ if (*name != '.' && *name != '/' && *name != '~'
+ if (*name != '.' && !IS_ABSOLUTE(name) && *name != '~'
+ && !((strlen (name) > 2
+ && tolower (name[0]) >= 'a' && tolower (name[0]) <= 'z'
+ && name[1] == ':' && name[2] == '/')))
+#else
if (*name != '.' && *name != '/' && *name != '~')
if (*name != '.' && !IS_ABSOLUTE(name) && *name != '~')
+#endif
{
abs_path = (char *)xmalloc(3 + name_len);
abs_path = (char *) xmalloc(3 + name_len);
strcpy(abs_path, "./");
@@ -201,7 +208,14 @@
@@ -250,7 +257,14 @@ static char *path_clean_up(const char *path)
int saw_slash = 0, saw_slash_dot = 0, saw_slash_dot_dot = 0;
+#if defined(__MSYS__)
+ if (*p1 != '/'
+ if (!IS_ABSOLUTE(p1)
+ && !((strlen (p1) > 2
+ && tolower (p1[0]) >= 'a' && tolower (p1[0]) <= 'z'
+ && p1[1] == ':' && p1[2] == '/')))
+#else
if (*p1 != '/')
if (!IS_ABSOLUTE(p1))
+#endif
{
get_current_working_directory();