]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
strstr, strcasestr: Add workaround against glibc-2.28 bug.
authorBruno Haible <bruno@clisp.org>
Sat, 15 Sep 2018 10:04:03 +0000 (12:04 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 15 Sep 2018 10:07:55 +0000 (12:07 +0200)
Reported by Michael Brunnbauer via Siddhesh Poyarekar and Eric Blake.

* m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Set
gl_cv_func_strstr_works_always to 'no' on glibc 2.28.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Set
gl_cv_func_strcasestr_works_always to 'no' on glibc 2.28.
* doc/posix-functions/strstr.texi: Document the glibc 2.28 bug.
* doc/glibc-functions/strcasestr.texi: Likewise.

ChangeLog
doc/glibc-functions/strcasestr.texi
doc/posix-functions/strstr.texi
m4/strcasestr.m4
m4/strstr.m4

index 35cc2722572418a2f2aa2cb57d0eedf079315bb0..79516723b2fc32fa8c8289ef274fc8c26b8d74d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2018-09-15  Bruno Haible  <bruno@clisp.org>
+
+       strstr, strcasestr: Add workaround against glibc-2.28 bug.
+       Reported by Michael Brunnbauer via Siddhesh Poyarekar and Eric Blake.
+       * m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE): Set
+       gl_cv_func_strstr_works_always to 'no' on glibc 2.28.
+       * m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): Set
+       gl_cv_func_strcasestr_works_always to 'no' on glibc 2.28.
+       * doc/posix-functions/strstr.texi: Document the glibc 2.28 bug.
+       * doc/glibc-functions/strcasestr.texi: Likewise.
+
 2018-09-14  Bruno Haible  <bruno@clisp.org>
 
        doc: Fix bottom of top-level page.
index f87ae1f4fcd7f19802a98c2793aa1ae6da01b581..7f38de921be8c28410722b935477682eb882dd77 100644 (file)
@@ -11,15 +11,16 @@ or @code{strcasestr}:
 This function is missing on some platforms:
 AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x,
 mingw, MSVC 14, BeOS.
-
 @item
 This function can trigger memchr bugs on some platforms:
 glibc 2.10.
-
 @item
 This function can trigger false positives for long periodic needles on
 some platforms:
 glibc 2.12, Cygwin 1.7.7.
+@item
+This function may fail to find matches on some platforms:
+glibc 2.28.
 @end itemize
 
 Portability problems fixed by Gnulib module @code{strcasestr}:
index 08636737885316c4664be525148f341e1c0907f2..ca2266016376df3f34454597242e8e4366834b5a 100644 (file)
@@ -16,6 +16,9 @@ glibc 2.10.
 This function can trigger false positives for long periodic needles on
 some platforms:
 glibc 2.12, Cygwin 1.7.7.
+@item
+This function may fail to find matches on some platforms:
+glibc 2.28.
 @end itemize
 
 Portability problems fixed by Gnulib @code{strstr}:
index 974aee2dcbdffd161ae7d2be609fa92512833075..c57ac4f79c4f839e114476d57b5b4d904af9cd6f 100644 (file)
@@ -1,4 +1,4 @@
-# strcasestr.m4 serial 23
+# strcasestr.m4 serial 24
 dnl Copyright (C) 2005, 2007-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -20,25 +20,34 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
     if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
       REPLACE_STRCASESTR=1
     else
-      dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092.
+      dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092
+      dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637.
       AC_CACHE_CHECK([whether strcasestr works],
         [gl_cv_func_strcasestr_works_always],
-        [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+        [AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM([[
 #include <string.h> /* for strcasestr */
+#ifdef __GNU_LIBRARY__
+ #include <features.h>
+ #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28
+  Unlucky user
+ #endif
+#endif
 #define P "_EF_BF_BD"
 #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P
 #define NEEDLE P P P P P
-]], [[return !!strcasestr (HAYSTACK, NEEDLE);
-      ]])],
-          [gl_cv_func_strcasestr_works_always=yes],
-          [gl_cv_func_strcasestr_works_always=no],
-          [dnl glibc 2.12 and cygwin 1.7.7 have a known bug.  uClibc is not
-           dnl affected, since it uses different source code for strcasestr
-           dnl than glibc.
-           dnl Assume that it works on all other platforms, even if it is not
-           dnl linear.
-           AC_EGREP_CPP([Lucky user],
-             [
+]],
+              [[return !!strcasestr (HAYSTACK, NEEDLE);
+              ]])],
+           [gl_cv_func_strcasestr_works_always=yes],
+           [gl_cv_func_strcasestr_works_always=no],
+           [dnl glibc 2.12 and cygwin 1.7.7 have a known bug.  uClibc is not
+            dnl affected, since it uses different source code for strcasestr
+            dnl than glibc.
+            dnl Assume that it works on all other platforms, even if it is not
+            dnl linear.
+            AC_EGREP_CPP([Lucky user],
+              [
 #ifdef __GNU_LIBRARY__
  #include <features.h>
  #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \
@@ -53,10 +62,10 @@ AC_DEFUN([gl_FUNC_STRCASESTR_SIMPLE],
 #else
   Lucky user
 #endif
-             ],
-             [gl_cv_func_strcasestr_works_always="guessing yes"],
-             [gl_cv_func_strcasestr_works_always="guessing no"])
-          ])
+              ],
+              [gl_cv_func_strcasestr_works_always="guessing yes"],
+              [gl_cv_func_strcasestr_works_always="guessing no"])
+           ])
         ])
       case "$gl_cv_func_strcasestr_works_always" in
         *yes) ;;
index aa590a97b6bd1b2fee041eb3dde8c852df04bbf1..40dbeacbb911a46561bb1e5226f4197cb057de81 100644 (file)
@@ -1,4 +1,4 @@
-# strstr.m4 serial 19
+# strstr.m4 serial 20
 dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,25 +12,34 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
   if test $HAVE_MEMCHR = 0 || test $REPLACE_MEMCHR = 1; then
     REPLACE_STRSTR=1
   else
-    dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092.
+    dnl Detect https://sourceware.org/bugzilla/show_bug.cgi?id=12092
+    dnl and https://sourceware.org/bugzilla/show_bug.cgi?id=23637.
     AC_CACHE_CHECK([whether strstr works],
       [gl_cv_func_strstr_works_always],
-      [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+      [AC_RUN_IFELSE(
+         [AC_LANG_PROGRAM([[
 #include <string.h> /* for strstr */
+#ifdef __GNU_LIBRARY__
+ #include <features.h>
+ #if __GLIBC__ == 2 && __GLIBC_MINOR__ == 28
+  Unlucky user
+ #endif
+#endif
 #define P "_EF_BF_BD"
 #define HAYSTACK "F_BD_CE_BD" P P P P "_C3_88_20" P P P "_C3_A7_20" P
 #define NEEDLE P P P P P
-]], [[return !!strstr (HAYSTACK, NEEDLE);
-    ]])],
-        [gl_cv_func_strstr_works_always=yes],
-        [gl_cv_func_strstr_works_always=no],
-        [dnl glibc 2.12 and cygwin 1.7.7 have a known bug.  uClibc is not
-         dnl affected, since it uses different source code for strstr than
-         dnl glibc.
-         dnl Assume that it works on all other platforms, even if it is not
-         dnl linear.
-         AC_EGREP_CPP([Lucky user],
-           [
+]],
+            [[return !!strstr (HAYSTACK, NEEDLE);
+            ]])],
+         [gl_cv_func_strstr_works_always=yes],
+         [gl_cv_func_strstr_works_always=no],
+         [dnl glibc 2.12 and cygwin 1.7.7 have a known bug.  uClibc is not
+          dnl affected, since it uses different source code for strstr than
+          dnl glibc.
+          dnl Assume that it works on all other platforms, even if it is not
+          dnl linear.
+          AC_EGREP_CPP([Lucky user],
+            [
 #ifdef __GNU_LIBRARY__
  #include <features.h>
  #if ((__GLIBC__ == 2 && __GLIBC_MINOR__ > 12) || (__GLIBC__ > 2)) \
@@ -45,10 +54,10 @@ AC_DEFUN([gl_FUNC_STRSTR_SIMPLE],
 #else
   Lucky user
 #endif
-           ],
-           [gl_cv_func_strstr_works_always="guessing yes"],
-           [gl_cv_func_strstr_works_always="guessing no"])
-        ])
+            ],
+            [gl_cv_func_strstr_works_always="guessing yes"],
+            [gl_cv_func_strstr_works_always="guessing no"])
+         ])
       ])
     case "$gl_cv_func_strstr_works_always" in
       *yes) ;;