about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-01 11:43:19 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-01 11:43:19 +0000
commitb7a09b9201b09b722209cb430813709505927be0 (patch)
treed42f6b7a1beba0394311fc49c20b7f81f678cab4
parent6a87697239310dd529781d9db1ee705eeaa5405e (diff)
downloadglibc-b7a09b9201b09b722209cb430813709505927be0.tar.gz
glibc-b7a09b9201b09b722209cb430813709505927be0.tar.xz
glibc-b7a09b9201b09b722209cb430813709505927be0.zip
Updated to fedora-glibc-20041001T1134 cvs/fedora-glibc-2_3_3-62
-rw-r--r--ChangeLog5
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in6
-rw-r--r--iconv/iconv_prog.c2
-rw-r--r--nptl/ChangeLog10
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S9
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S18
-rw-r--r--posix/Makefile3
-rw-r--r--posix/bug-glob1.c82
9 files changed, 125 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index 4bd6ca1116..0e6269c659 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-09-30  Ulrich Drepper  <drepper@redhat.com>
 
+	* posix/Makefile: Add rules to build and run bug-glob1.
+	* posix/bug-glob1.c: New file.
+
+	* iconv/iconv_prog.c (main): Print progress information to stderr.
+
 	* nscd/nscd.c (termination_handler): Reset timestamp so that
 	clients immediately stop using the database.
 
diff --git a/fedora/branch.mk b/fedora/branch.mk
index 9f401a0c8b..763b4cf699 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -1,5 +1,5 @@
 # This file is updated automatically by Makefile.
 glibc-branch := fedora
 glibc-base := HEAD
-fedora-sync-date := 2004-09-30 08:38 UTC
-fedora-sync-tag := fedora-glibc-20040930T0838
+fedora-sync-date := 2004-10-01 11:34 UTC
+fedora-sync-tag := fedora-glibc-20041001T1134
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index a6d0d71af2..c2c4afea28 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 61
+%define glibcrelease 62
 %define auxarches i586 i686 athlon sparcv9 alphaev6
 %define prelinkarches noarch
 %define nptlarches i386 i686 athlon x86_64 ia64 s390 s390x sparcv9 ppc ppc64
@@ -1239,6 +1239,10 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Fri Oct  1 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-62
+- update from CVS
+  - fix NPTL pthread_mutex_timedwait on i386/x86_64 (BZ #417)
+
 * Thu Sep 30 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-61
 - update from CVS
   - some nscd fixes (#134193)
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
index 26b3c24f31..86852857a3 100644
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -283,7 +283,7 @@ conversion from `%s' and to `%s' are not supported"),
 	    int fd, ret;
 
 	    if (verbose)
-	      printf ("%s:\n", argv[remaining]);
+	      fprintf (stderr, "%s:\n", argv[remaining]);
 	    if (strcmp (argv[remaining], "-") == 0)
 	      fd = 0;
 	    else
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index aba6fc4661..da7d842b36 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,13 @@
+2004-10-01  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+	(__lll_mutex_timedlock_wait): I woken but cannot get the lock,
+	make sure 2 is stored in the futex and we looked at the old value.
+	* sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+	(__lll_mutex_timedlock_wait): Likewise.  Fix a few other problems
+	which might very well made the code not working at all before.
+	[BZ #417]
+
 2004-09-28  Ulrich Drepper  <drepper@redhat.com>
 
 	* sysdeps/unix/sysv/linux/pthread_kill.c (__pthread_kill): Don't
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
index 96ea35caac..dc65b709a1 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/lowlevellock.S
@@ -132,9 +132,8 @@ __lll_mutex_timedlock_wait:
 	ENTER_KERNEL
 	movl	%eax, %ecx
 
-8:
+8:				/* NB: %edx == 2 */
 	xorl	%eax, %eax
-	movl	$2, %edx
 	LOCK
 	cmpxchgl %edx, (%ebx)
 
@@ -150,6 +149,12 @@ __lll_mutex_timedlock_wait:
 	/* Check whether the time expired.  */
 7:	cmpl	$-ETIMEDOUT, %ecx
 	je	5f
+
+	/* Make sure the current holder knows we are going to sleep.  */
+	movl	%edx, %eax
+	xchgl	%eax, (%ebx)
+	testl	%eax, %eax
+	jz	6b
 	jmp	1b
 
 3:	movl	$EINVAL, %eax
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
index cf3dad18fb..6827804f7f 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S
@@ -95,7 +95,7 @@ __lll_mutex_timedlock_wait:
 	movq	%rsp, %rdi
 	xorq	%rsi, %rsi
 	movq	$VSYSCALL_ADDR_vgettimeofday, %rax
-	/* This is a regular function call, all calleer-save registers
+	/* This is a regular function call, all caller-save registers
 	   might be clobbered.  */
 	callq	*%rax
 
@@ -132,15 +132,13 @@ __lll_mutex_timedlock_wait:
 	syscall
 	movq	%rax, %rcx
 
-	movl	$1, %eax
+8:				/* NB: %edx == 2 */
+	xorl	%eax, %eax
 	LOCK
 	cmpxchgl %edx, (%rdi)
 	jnz	7f
 
-	movl	$2, (%rdi)
-	xorl	%eax, %eax
-
-8:	addq	$16, %rsp
+6:	addq	$16, %rsp
 	popq	%r14
 	popq	%r13
 	popq	%r12
@@ -151,13 +149,19 @@ __lll_mutex_timedlock_wait:
 	/* Check whether the time expired.  */
 7:	cmpq	$-ETIMEDOUT, %rcx
 	je	5f
+
+	/* Make sure the current holder knows we are going to sleep.  */
+	movl	%edx, %eax
+	xchgl	%eax, (%ebx)
+	testl	%eax, %eax
+	jz	6b
 	jmp	1b
 
 3:	movl	$EINVAL, %eax
 	retq
 
 5:	movl	$ETIMEDOUT, %eax
-	jmp	8b
+	jmp	6b
 	.size	__lll_mutex_timedlock_wait,.-__lll_mutex_timedlock_wait
 #endif
 
diff --git a/posix/Makefile b/posix/Makefile
index 82d35378d1..9bf415fdbf 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -82,7 +82,7 @@ tests		:= tstgetopt testfnm runtests runptests	     \
 		   bug-regex21 bug-regex22 bug-regex23 tst-nice tst-nanosleep \
 		   transbug tst-rxspencer tst-pcre tst-boost \
 		   bug-ga1 tst-vfork1 tst-vfork2 tst-waitid \
-		   tst-getaddrinfo2
+		   tst-getaddrinfo2 bug-glob1
 xtests		:= bug-ga2
 ifeq (yes,$(build-shared))
 test-srcs	:= globtest
@@ -172,6 +172,7 @@ tst-rxspencer-ARGS = --utf8 rxspencer/tests
 tst-rxspencer-ENV = LOCPATH=$(common-objpfx)localedata
 tst-pcre-ARGS = PCRE.tests
 tst-boost-ARGS = BOOST.tests
+bug-glob1-ARGS = "$(objpfx)"
 
 testcases.h: TESTS TESTS2C.sed
 	sed -f TESTS2C.sed < $< > $@T
diff --git a/posix/bug-glob1.c b/posix/bug-glob1.c
new file mode 100644
index 0000000000..4f7e981c75
--- /dev/null
+++ b/posix/bug-glob1.c
@@ -0,0 +1,82 @@
+/* Test case for globbing dangling symlink.  By Ulrich Drepper.  */
+#include <errno.h>
+#include <error.h>
+#include <glob.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+static void prepare (int argc, char *argv[]);
+#define PREPARE prepare
+static int do_test (void);
+#define TEST_FUNCTION do_test ()
+
+#include "../test-skeleton.c"
+
+
+static char *fname;
+
+static void
+prepare (int argc, char *argv[])
+{
+  if (argc < 2)
+    error (EXIT_FAILURE, 0, "missing argument");
+
+  size_t len = strlen (argv[1]);
+  static const char ext[] = "globXXXXXX";
+  fname = malloc (len + 1 + sizeof (ext));
+  if (fname == NULL)
+    error (EXIT_FAILURE, errno, "cannot create temp file");
+  strcpy (stpcpy (stpcpy (fname, argv[1]), "/"), ext);
+  fname = mktemp (fname);
+  if (fname == NULL || *fname == '\0')
+    error (EXIT_FAILURE, errno, "cannot create temp file name");
+  if (symlink ("bug-glob1-does-not-exist", fname) != 0)
+    error (EXIT_FAILURE, errno, "cannot create symlink");
+  add_temp_file (fname);
+}
+
+
+static int
+do_test (void)
+{
+  glob_t gl;
+  int retval = 0;
+  int e;
+
+  e = glob (fname, 0, NULL, &gl);
+  if (e == 0)
+    {
+      printf ("glob(\"%s\") succeeded\n", fname);
+      retval = 1;
+    }
+  globfree (&gl);
+
+  size_t fnamelen = strlen (fname);
+  char buf[fnamelen + 2];
+
+  strcpy (buf, fname);
+  buf[fnamelen - 1] = '?';
+  e = glob (buf, 0, NULL, &gl);
+  if (e == 0)
+    {
+      printf ("glob(\"%s\") succeeded\n", buf);
+      retval = 1;
+    }
+  globfree (&gl);
+
+  strcpy (buf, fname);
+  buf[fnamelen] = '*';
+  buf[fnamelen + 1] = '\0';
+  e = glob (buf, 0, NULL, &gl);
+  if (e == 0)
+    {
+      printf ("glob(\"%s\") succeeded\n", buf);
+      retval = 1;
+    }
+  globfree (&gl);
+
+  return retval;
+}