grep, gzip: update gnulib patch
should be the final time, all upstream issues are fixed :)
This commit is contained in:
parent
69c4673016
commit
310793630d
@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Command which searches one or more input files for lines
|
||||
TERMUX_PKG_LICENSE="GPL-3.0"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=3.7
|
||||
TERMUX_PKG_REVISION=1
|
||||
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/grep/grep-${TERMUX_PKG_VERSION}.tar.xz
|
||||
TERMUX_PKG_SHA256=5c10da312460aec721984d5d83246d24520ec438dd48d7ab5a05dbc0d6d6823c
|
||||
TERMUX_PKG_DEPENDS="libandroid-support, pcre"
|
||||
|
@ -18,6 +18,92 @@ index a39102957..b3c7e6d28 100644
|
||||
-e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
|
||||
-e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
|
||||
-e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
|
||||
diff --git a/lib/strerror_r.c b/lib/strerror_r.c
|
||||
index f0244520b..90043c223 100644
|
||||
--- a/lib/strerror_r.c
|
||||
+++ b/lib/strerror_r.c
|
||||
@@ -34,33 +34,26 @@
|
||||
|
||||
#include "strerror-override.h"
|
||||
|
||||
-#if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */
|
||||
+#if STRERROR_R_CHAR_P
|
||||
|
||||
-# define USE_XPG_STRERROR_R 1
|
||||
-extern
|
||||
-#ifdef __cplusplus
|
||||
-"C"
|
||||
-#endif
|
||||
-int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
|
||||
+# if HAVE___XPG_STRERROR_R
|
||||
+_GL_EXTERN_C int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
|
||||
+# endif
|
||||
|
||||
-#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__)
|
||||
+#elif HAVE_DECL_STRERROR_R
|
||||
|
||||
-/* The system's strerror_r function is OK, except that its third argument
|
||||
+/* The system's strerror_r function's API is OK, except that its third argument
|
||||
is 'int', not 'size_t', or its return type is wrong. */
|
||||
|
||||
# include <limits.h>
|
||||
|
||||
-# define USE_SYSTEM_STRERROR_R 1
|
||||
-
|
||||
-#else /* (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__ ? !HAVE___XPG_STRERROR_R : !HAVE_DECL_STRERROR_R) */
|
||||
+#else
|
||||
|
||||
/* Use the system's strerror(). Exclude glibc and cygwin because the
|
||||
system strerror_r has the wrong return type, and cygwin 1.7.9
|
||||
strerror_r clobbers strerror. */
|
||||
# undef strerror
|
||||
|
||||
-# define USE_SYSTEM_STRERROR 1
|
||||
-
|
||||
# if defined __NetBSD__ || defined __hpux || (defined _WIN32 && !defined __CYGWIN__) || defined __sgi || (defined __sun && !defined _LP64) || defined __CYGWIN__
|
||||
|
||||
/* No locking needed. */
|
||||
@@ -166,22 +159,28 @@ strerror_r (int errnum, char *buf, size_t buflen)
|
||||
int ret;
|
||||
int saved_errno = errno;
|
||||
|
||||
-#if USE_XPG_STRERROR_R
|
||||
+#if STRERROR_R_CHAR_P
|
||||
|
||||
{
|
||||
+ ret = 0;
|
||||
+
|
||||
+# if HAVE___XPG_STRERROR_R
|
||||
ret = __xpg_strerror_r (errnum, buf, buflen);
|
||||
if (ret < 0)
|
||||
ret = errno;
|
||||
+# endif
|
||||
+
|
||||
if (!*buf)
|
||||
{
|
||||
/* glibc 2.13 would not touch buf on err, so we have to fall
|
||||
back to GNU strerror_r which always returns a thread-safe
|
||||
untruncated string to (partially) copy into our buf. */
|
||||
- safe_copy (buf, buflen, strerror_r (errnum, buf, buflen));
|
||||
+ char *errstring = strerror_r (errnum, buf, buflen);
|
||||
+ ret = errstring ? safe_copy (buf, buflen, errstring) : errno;
|
||||
}
|
||||
}
|
||||
|
||||
-#elif USE_SYSTEM_STRERROR_R
|
||||
+#elif HAVE_DECL_STRERROR_R
|
||||
|
||||
if (buflen > INT_MAX)
|
||||
buflen = INT_MAX;
|
||||
@@ -245,7 +244,7 @@ strerror_r (int errnum, char *buf, size_t buflen)
|
||||
}
|
||||
# endif
|
||||
|
||||
-#else /* USE_SYSTEM_STRERROR */
|
||||
+#else /* strerror_r is not declared. */
|
||||
|
||||
/* Try to do what strerror (errnum) does, but without clobbering the
|
||||
buffer used by strerror(). */
|
||||
diff --git a/lib/string.in.h b/lib/string.in.h
|
||||
index fa2e40c25..8977153c8 100644
|
||||
--- a/lib/string.in.h
|
||||
|
@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Standard GNU file compression utilities"
|
||||
TERMUX_PKG_LICENSE="GPL-3.0"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=1.11
|
||||
TERMUX_PKG_REVISION=2
|
||||
TERMUX_PKG_REVISION=3
|
||||
TERMUX_PKG_SRCURL=https://mirrors.kernel.org/gnu/gzip/gzip-${TERMUX_PKG_VERSION}.tar.xz
|
||||
TERMUX_PKG_SHA256=9b9a95d68fdcb936849a4d6fada8bf8686cddf58b9b26c9c4289ed0c92a77907
|
||||
TERMUX_PKG_ESSENTIAL=true
|
||||
|
@ -18,6 +18,92 @@ index a39102957..b3c7e6d28 100644
|
||||
-e 's|@''REPLACE_MBSINIT''@|$(REPLACE_MBSINIT)|g' \
|
||||
-e 's|@''REPLACE_MBRTOWC''@|$(REPLACE_MBRTOWC)|g' \
|
||||
-e 's|@''REPLACE_MBRLEN''@|$(REPLACE_MBRLEN)|g' \
|
||||
diff --git a/lib/strerror_r.c b/lib/strerror_r.c
|
||||
index f0244520b..90043c223 100644
|
||||
--- a/lib/strerror_r.c
|
||||
+++ b/lib/strerror_r.c
|
||||
@@ -34,33 +34,26 @@
|
||||
|
||||
#include "strerror-override.h"
|
||||
|
||||
-#if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */
|
||||
+#if STRERROR_R_CHAR_P
|
||||
|
||||
-# define USE_XPG_STRERROR_R 1
|
||||
-extern
|
||||
-#ifdef __cplusplus
|
||||
-"C"
|
||||
-#endif
|
||||
-int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
|
||||
+# if HAVE___XPG_STRERROR_R
|
||||
+_GL_EXTERN_C int __xpg_strerror_r (int errnum, char *buf, size_t buflen);
|
||||
+# endif
|
||||
|
||||
-#elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__)
|
||||
+#elif HAVE_DECL_STRERROR_R
|
||||
|
||||
-/* The system's strerror_r function is OK, except that its third argument
|
||||
+/* The system's strerror_r function's API is OK, except that its third argument
|
||||
is 'int', not 'size_t', or its return type is wrong. */
|
||||
|
||||
# include <limits.h>
|
||||
|
||||
-# define USE_SYSTEM_STRERROR_R 1
|
||||
-
|
||||
-#else /* (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__ ? !HAVE___XPG_STRERROR_R : !HAVE_DECL_STRERROR_R) */
|
||||
+#else
|
||||
|
||||
/* Use the system's strerror(). Exclude glibc and cygwin because the
|
||||
system strerror_r has the wrong return type, and cygwin 1.7.9
|
||||
strerror_r clobbers strerror. */
|
||||
# undef strerror
|
||||
|
||||
-# define USE_SYSTEM_STRERROR 1
|
||||
-
|
||||
# if defined __NetBSD__ || defined __hpux || (defined _WIN32 && !defined __CYGWIN__) || defined __sgi || (defined __sun && !defined _LP64) || defined __CYGWIN__
|
||||
|
||||
/* No locking needed. */
|
||||
@@ -166,22 +159,28 @@ strerror_r (int errnum, char *buf, size_t buflen)
|
||||
int ret;
|
||||
int saved_errno = errno;
|
||||
|
||||
-#if USE_XPG_STRERROR_R
|
||||
+#if STRERROR_R_CHAR_P
|
||||
|
||||
{
|
||||
+ ret = 0;
|
||||
+
|
||||
+# if HAVE___XPG_STRERROR_R
|
||||
ret = __xpg_strerror_r (errnum, buf, buflen);
|
||||
if (ret < 0)
|
||||
ret = errno;
|
||||
+# endif
|
||||
+
|
||||
if (!*buf)
|
||||
{
|
||||
/* glibc 2.13 would not touch buf on err, so we have to fall
|
||||
back to GNU strerror_r which always returns a thread-safe
|
||||
untruncated string to (partially) copy into our buf. */
|
||||
- safe_copy (buf, buflen, strerror_r (errnum, buf, buflen));
|
||||
+ char *errstring = strerror_r (errnum, buf, buflen);
|
||||
+ ret = errstring ? safe_copy (buf, buflen, errstring) : errno;
|
||||
}
|
||||
}
|
||||
|
||||
-#elif USE_SYSTEM_STRERROR_R
|
||||
+#elif HAVE_DECL_STRERROR_R
|
||||
|
||||
if (buflen > INT_MAX)
|
||||
buflen = INT_MAX;
|
||||
@@ -245,7 +244,7 @@ strerror_r (int errnum, char *buf, size_t buflen)
|
||||
}
|
||||
# endif
|
||||
|
||||
-#else /* USE_SYSTEM_STRERROR */
|
||||
+#else /* strerror_r is not declared. */
|
||||
|
||||
/* Try to do what strerror (errnum) does, but without clobbering the
|
||||
buffer used by strerror(). */
|
||||
diff --git a/lib/string.in.h b/lib/string.in.h
|
||||
index fa2e40c25..8977153c8 100644
|
||||
--- a/lib/string.in.h
|
||||
|
Loading…
Reference in New Issue
Block a user