diff --git a/glibc-testsuite.changes b/glibc-testsuite.changes
index b5896e6..ff458cb 100644
--- a/glibc-testsuite.changes
+++ b/glibc-testsuite.changes
@@ -1,3 +1,12 @@
+-------------------------------------------------------------------
+Wed Jul 31 12:20:38 UTC 2013 - schwab@suse.de
+
+- i686-strcasecmp-fallback.patch: fix fallback in i686
+ strcasecmp/strncasecmp
+- nonascii-case.patch: also test strncasecmp
+- pldd-wait-ptrace-stop.patch: fix pldd not to leave process stopped after
+ detaching (bnc#819383)
+
-------------------------------------------------------------------
Mon Jul 22 12:32:34 UTC 2013 - schwab@suse.de
diff --git a/glibc-testsuite.spec b/glibc-testsuite.spec
index 54504c9..0e68577 100644
--- a/glibc-testsuite.spec
+++ b/glibc-testsuite.spec
@@ -277,6 +277,10 @@ Patch2015: printf-overrun.patch
Patch2016: aarch64-sigsetjmp.patch
# PATCH-FIX-UPSTREAM Fix strcasecmp for tr_TR.ISO-8859-9
Patch2017: nonascii-case.patch
+# PATCH-FIX-UPSTREAM Fix fallback in i686 strcasecmp/strncasecmp
+Patch2018: i686-strcasecmp-fallback.patch
+# PATCH-FIX-UPSTREAM Fix pldd not to leave process stopped after detaching
+Patch2019: pldd-wait-ptrace-stop.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@@ -496,6 +500,8 @@ rm nscd/s-stamp
%patch2015 -p1
%patch2016 -p1
%patch2017 -p1
+%patch2018 -p1
+%patch2019 -p1
%patch3000
diff --git a/glibc-utils.changes b/glibc-utils.changes
index b5896e6..ff458cb 100644
--- a/glibc-utils.changes
+++ b/glibc-utils.changes
@@ -1,3 +1,12 @@
+-------------------------------------------------------------------
+Wed Jul 31 12:20:38 UTC 2013 - schwab@suse.de
+
+- i686-strcasecmp-fallback.patch: fix fallback in i686
+ strcasecmp/strncasecmp
+- nonascii-case.patch: also test strncasecmp
+- pldd-wait-ptrace-stop.patch: fix pldd not to leave process stopped after
+ detaching (bnc#819383)
+
-------------------------------------------------------------------
Mon Jul 22 12:32:34 UTC 2013 - schwab@suse.de
diff --git a/glibc-utils.spec b/glibc-utils.spec
index d7845d4..5ce393d 100644
--- a/glibc-utils.spec
+++ b/glibc-utils.spec
@@ -276,6 +276,10 @@ Patch2015: printf-overrun.patch
Patch2016: aarch64-sigsetjmp.patch
# PATCH-FIX-UPSTREAM Fix strcasecmp for tr_TR.ISO-8859-9
Patch2017: nonascii-case.patch
+# PATCH-FIX-UPSTREAM Fix fallback in i686 strcasecmp/strncasecmp
+Patch2018: i686-strcasecmp-fallback.patch
+# PATCH-FIX-UPSTREAM Fix pldd not to leave process stopped after detaching
+Patch2019: pldd-wait-ptrace-stop.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@@ -496,6 +500,8 @@ rm nscd/s-stamp
%patch2015 -p1
%patch2016 -p1
%patch2017 -p1
+%patch2018 -p1
+%patch2019 -p1
%patch3000
diff --git a/glibc.changes b/glibc.changes
index b5896e6..ff458cb 100644
--- a/glibc.changes
+++ b/glibc.changes
@@ -1,3 +1,12 @@
+-------------------------------------------------------------------
+Wed Jul 31 12:20:38 UTC 2013 - schwab@suse.de
+
+- i686-strcasecmp-fallback.patch: fix fallback in i686
+ strcasecmp/strncasecmp
+- nonascii-case.patch: also test strncasecmp
+- pldd-wait-ptrace-stop.patch: fix pldd not to leave process stopped after
+ detaching (bnc#819383)
+
-------------------------------------------------------------------
Mon Jul 22 12:32:34 UTC 2013 - schwab@suse.de
diff --git a/glibc.spec b/glibc.spec
index e44831d..322f605 100644
--- a/glibc.spec
+++ b/glibc.spec
@@ -277,6 +277,10 @@ Patch2015: printf-overrun.patch
Patch2016: aarch64-sigsetjmp.patch
# PATCH-FIX-UPSTREAM Fix strcasecmp for tr_TR.ISO-8859-9
Patch2017: nonascii-case.patch
+# PATCH-FIX-UPSTREAM Fix fallback in i686 strcasecmp/strncasecmp
+Patch2018: i686-strcasecmp-fallback.patch
+# PATCH-FIX-UPSTREAM Fix pldd not to leave process stopped after detaching
+Patch2019: pldd-wait-ptrace-stop.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@@ -496,6 +500,8 @@ rm nscd/s-stamp
%patch2015 -p1
%patch2016 -p1
%patch2017 -p1
+%patch2018 -p1
+%patch2019 -p1
%patch3000
diff --git a/i686-strcasecmp-fallback.patch b/i686-strcasecmp-fallback.patch
new file mode 100644
index 0000000..7790ce1
--- /dev/null
+++ b/i686-strcasecmp-fallback.patch
@@ -0,0 +1,74 @@
+ * sysdeps/i386/i686/multiarch/strcmp-sse4.S (__strcasecmp_sse4_2)
+ (__strncasecmp_sse4_2) [PIC]: Restore %ebx before falling through
+ to __strcasecmp_nonascii and __strncasecmp_nonascii.
+ * sysdeps/i386/i686/multiarch/strcmp-ssse3.S (__strcasecmp_ssse3)
+ (__strncasecmp_ssse3) [PIC]: Likewise.
+
+Index: glibc-2.17/sysdeps/i386/i686/multiarch/strcmp-sse4.S
+===================================================================
+--- glibc-2.17.orig/sysdeps/i386/i686/multiarch/strcmp-sse4.S
++++ glibc-2.17/sysdeps/i386/i686/multiarch/strcmp-sse4.S
+@@ -121,8 +121,14 @@ ENTRY (__strcasecmp_sse4_2)
+ movl (%eax), %eax
+ # endif
+ testl $1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%eax)
++# ifdef PIC
++ je L(ascii)
++ POP (%ebx)
++ jmp __strcasecmp_nonascii
++# else
+ jne __strcasecmp_nonascii
+ jmp L(ascii)
++# endif
+ END (__strcasecmp_sse4_2)
+ #endif
+
+@@ -152,8 +158,14 @@ ENTRY (__strncasecmp_sse4_2)
+ movl (%eax), %eax
+ # endif
+ testl $1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%eax)
++# ifdef PIC
++ je L(ascii)
++ POP (%ebx)
++ jmp __strncasecmp_nonascii
++# else
+ jne __strncasecmp_nonascii
+ jmp L(ascii)
++# endif
+ END (__strncasecmp_sse4_2)
+ #endif
+
+Index: glibc-2.17/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
+===================================================================
+--- glibc-2.17.orig/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
++++ glibc-2.17/sysdeps/i386/i686/multiarch/strcmp-ssse3.S
+@@ -138,8 +138,14 @@ ENTRY (__strcasecmp_ssse3)
+ movl (%eax), %eax
+ # endif
+ testl $1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%eax)
++# ifdef PIC
++ je L(ascii)
++ POP (%ebx)
++ jmp __strcasecmp_nonascii
++# else
+ jne __strcasecmp_nonascii
+ jmp L(ascii)
++# endif
+ END (__strcasecmp_ssse3)
+ #endif
+
+@@ -169,8 +175,14 @@ ENTRY (__strncasecmp_ssse3)
+ movl (%eax), %eax
+ # endif
+ testl $1, LOCALE_DATA_VALUES+_NL_CTYPE_NONASCII_CASE*SIZEOF_VALUES(%eax)
++# ifdef PIC
++ je L(ascii)
++ POP (%ebx)
++ jmp __strncasecmp_nonascii
++# else
+ jne __strncasecmp_nonascii
+ jmp L(ascii)
++# endif
+ END (__strncasecmp_ssse3)
+ #endif
+
diff --git a/nonascii-case.patch b/nonascii-case.patch
index 946173d..e07297f 100644
--- a/nonascii-case.patch
+++ b/nonascii-case.patch
@@ -1,9 +1,10 @@
[BZ #15736]
* locale/categories.def (LC_CTYPE): Add "nonascii-case" element.
- * string/Makefile (test-strcasecmp-ENV)
- (test-strcasecmp-ifunc-ENV): Define.
+ * string/Makefile (test-strcasecmp-ENV, test-strncasecmp-ENV)
+ (test-strcasecmp-ifunc-ENV, test-strncasecmp-ifunc-ENV): Define.
* string/test-strcasecmp.c (test_main): Run tests in several
locales.
+ * string/test-strncasecmp.c (test_main): Likewise.
Index: glibc-2.17/locale/categories.def
===================================================================
@@ -21,12 +22,14 @@ Index: glibc-2.17/string/Makefile
===================================================================
--- glibc-2.17.orig/string/Makefile
+++ glibc-2.17/string/Makefile
-@@ -69,6 +69,8 @@ noinl-tester-ENV = LANGUAGE=C
+@@ -69,6 +69,10 @@ noinl-tester-ENV = LANGUAGE=C
tst-strxfrm-ENV = LOCPATH=$(common-objpfx)localedata
tst-strxfrm2-ENV = LOCPATH=$(common-objpfx)localedata
bug-strcoll1-ENV = LOCPATH=$(common-objpfx)localedata
+test-strcasecmp-ENV = LOCPATH=$(common-objpfx)localedata
++test-strncasecmp-ENV = LOCPATH=$(common-objpfx)localedata
+test-strcasecmp-ifunc-ENV = LOCPATH=$(common-objpfx)localedata
++test-strncasecmp-ifunc-ENV = LOCPATH=$(common-objpfx)localedata
CFLAGS-inl-tester.c = -fno-builtin
CFLAGS-noinl-tester.c = -fno-builtin
CFLAGS-tst-strlen.c = -fno-builtin
@@ -85,3 +88,61 @@ Index: glibc-2.17/string/test-strcasecmp.c
return ret;
}
+Index: glibc-2.17/string/test-strncasecmp.c
+===================================================================
+--- glibc-2.17.orig/string/test-strncasecmp.c
++++ glibc-2.17/string/test-strncasecmp.c
+@@ -17,6 +17,7 @@
+ License along with the GNU C Library; if not, see
+ . */
+
++#include
+ #include
+ #define TEST_MAIN
+ #define TEST_NAME "strncasecmp"
+@@ -280,17 +281,21 @@ bz14195 (void)
+ check_result (impl, empty_string, "", 5, 0);
+ }
+
+-int
+-test_main (void)
++static void
++test_locale (const char *locale)
+ {
+ size_t i;
+
+- test_init ();
++ if (setlocale (LC_CTYPE, locale) == NULL)
++ {
++ error (0, 0, "cannot set locale \"%s\"", locale);
++ ret = 1;
++ }
+
+ bz12205 ();
+ bz14195 ();
+
+- printf ("%23s", "");
++ printf ("%23s", locale);
+ FOR_EACH_IMPL (impl, 0)
+ printf ("\t%s", impl->name);
+ putchar ('\n');
+@@ -353,6 +358,19 @@ test_main (void)
+ }
+
+ do_random_tests ();
++}
++
++int
++test_main (void)
++{
++ test_init ();
++
++ test_locale ("C");
++ test_locale ("en_US.ISO-8859-1");
++ test_locale ("en_US.UTF-8");
++ test_locale ("tr_TR.ISO-8859-9");
++ test_locale ("tr_TR.UTF-8");
++
+ return ret;
+ }
+
diff --git a/pldd-wait-ptrace-stop.patch b/pldd-wait-ptrace-stop.patch
new file mode 100644
index 0000000..099cfea
--- /dev/null
+++ b/pldd-wait-ptrace-stop.patch
@@ -0,0 +1,59 @@
+2013-07-31 Andreas Schwab
+
+ * elf/pldd.c (wait_for_ptrace_stop): New function.
+ (main): Call it after attaching.
+
+Index: glibc-2.17/elf/pldd.c
+===================================================================
+--- glibc-2.17.orig/elf/pldd.c
++++ glibc-2.17/elf/pldd.c
+@@ -34,6 +34,7 @@
+ #include
+ #include
+ #include
++#include
+
+ #include
+ #include
+@@ -85,6 +86,7 @@ static char *exe;
+
+ /* Local functions. */
+ static int get_process_info (int dfd, long int pid);
++static void wait_for_ptrace_stop (long int pid);
+
+
+ int
+@@ -173,6 +175,8 @@ main (int argc, char *argv[])
+ tid);
+ }
+
++ wait_for_ptrace_stop (tid);
++
+ struct thread_list *newp = alloca (sizeof (*newp));
+ newp->tid = tid;
+ newp->next = thread_list;
+@@ -197,6 +201,24 @@ main (int argc, char *argv[])
+ }
+
+
++/* Wait for PID to enter ptrace-stop state after being attached. */
++static void
++wait_for_ptrace_stop (long int pid)
++{
++ int status;
++
++ /* While waiting for SIGSTOP being delivered to the tracee we have to
++ reinject any other pending signal. Ignore all other errors. */
++ while (waitpid (pid, &status, __WALL) == pid && WIFSTOPPED (status))
++ {
++ /* The STOP signal should not be delivered to the tracee. */
++ if (WSTOPSIG (status) == SIGSTOP)
++ return;
++ ptrace (PTRACE_CONT, pid, NULL, (void *) (uintptr_t) WSTOPSIG (status));
++ }
++}
++
++
+ /* Handle program arguments. */
+ static error_t
+ parse_opt (int key, char *arg, struct argp_state *state)