Submitted By: Robert Connolly <robert at linuxfromscratch dot org> (ashes)
Date: 2006-12-03
Initial Package Version: 2.5
Upstream Status: From Upstream
Origin: Robert Connolly (Concept)
	cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/glibc \
		co -rglibc-2_5-branch libc
Description: This is a branch update for Glibc-2.5, and should be
rechecked periodically. See the "Changelog" and "localedata/ChangeLog"
for specific details.

diff -Naur glibc-2.5/ChangeLog libc/ChangeLog
--- glibc-2.5/ChangeLog	2006-09-29 11:45:39.000000000 -0700
+++ libc/ChangeLog	2006-10-06 08:39:29.000000000 -0700
@@ -1,5 +1,62 @@
+2006-10-06  Andreas Jaeger  <aj@suse.de>
+
+	* include/features.h (__GLIBC_MINOR__): It's glibc 2.5 now.
+
+2006-10-06  Ulrich Drepper  <drepper@redhat.com>
+
+	* po/pl.po: Update from translation team.
+
+	* nscd/nscd.c (main): Fix typo in message.
+	Patch by Jakub Bogsz <qboosh@pld-linux.org>.
+
+2006-10-02  Jakub Jelinek  <jakub@redhat.com>
+
+	[BZ #3291]
+	* sysdeps/unix/sysv/linux/sparc/sparc64/pause.c: Include
+	errno.h, signal.h, unistd.h and sysdep-cancel.h.
+	(__sigprocmask): Define.
+
+2006-10-02  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/rtld.c (dl_main): Don't use prelinking if LD_DYNAMIC_WEAK is
+	used.
+
+2006-10-02  Jakub Jelinek  <jakub@redhat.com>
+
+	* nscd/mem.c (mempool_alloc): Round array size to 16 bytes
+	in oldtotal and newtotal calculation.
+	* nscd/nscd-client.h (struct mapped_database): Add datasize
+	field.
+	* nscd/nscd_helper.c (get_mapping): Initialize datasize field.
+	(__nscd_get_map_ref): Get a new mapping even if mapping's data_size
+	increased.
+	(__nscd_cache_search): Add checks to make sure we never reference
+	data beyond the current mapping.
+
+2006-10-02  Dmitry V. Levin  <ldv@altlinux.org>
+
+	* sysdeps/posix/getaddrinfo.c (match_prefix): Make mask and val
+	variables const to avoid compiler warnings.
+
+	* io/fts.c (fts_close): Remove redundant checks.
+	(fts_build): Likewise.
+	(fts_palloc): Likewise.
+
+	* manual/message.texi (Advanced gettext functions,
+	Using gettextized software): Fix typos.
+
+2006-09-30  Ulrich Drepper  <drepper@redhat.com>
+
+	* posix/glob.c (glob_in_dir): Add some comments and asserts to
+	explain why there are no leaks.
+
 2006-09-29  Ulrich Drepper  <drepper@redhat.com>
 
+	* libio/wmemstream.c: Include <wchar.h>.
+	* libio/bug-wmemstream1.c: Likewise.
+	* libio/tst-wmemstream1.c: Likewise.
+	* libio/tst-wmemstream2.c: Likewise.
+
 	* version.h (RELEASE): Bump to 2.5.
 	* README: Regenerated.
 
diff -Naur glibc-2.5/elf/rtld.c libc/elf/rtld.c
--- glibc-2.5/elf/rtld.c	2006-09-29 09:56:15.000000000 -0700
+++ libc/elf/rtld.c	2006-10-02 11:24:37.000000000 -0700
@@ -2087,7 +2087,8 @@
     }
 
   if (main_map->l_info[ADDRIDX (DT_GNU_LIBLIST)]
-      && ! __builtin_expect (GLRO(dl_profile) != NULL, 0))
+      && ! __builtin_expect (GLRO(dl_profile) != NULL, 0)
+      && ! __builtin_expect (GLRO(dl_dynamic_weak), 0))
     {
       ElfW(Lib) *liblist, *liblistend;
       struct link_map **r_list, **r_listend, *l;
diff -Naur glibc-2.5/include/features.h libc/include/features.h
--- glibc-2.5/include/features.h	2006-04-25 13:34:32.000000000 -0700
+++ libc/include/features.h	2006-10-06 08:38:14.000000000 -0700
@@ -304,7 +304,7 @@
 /* Major and minor version number of the GNU C library package.  Use
    these macros to test for features in specific releases.  */
 #define	__GLIBC__	2
-#define	__GLIBC_MINOR__	4
+#define	__GLIBC_MINOR__	5
 
 #define __GLIBC_PREREQ(maj, min) \
 	((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
diff -Naur glibc-2.5/io/fts.c libc/io/fts.c
--- glibc-2.5/io/fts.c	2006-04-08 12:33:17.000000000 -0700
+++ libc/io/fts.c	2006-10-02 09:06:49.000000000 -0700
@@ -251,8 +251,7 @@
 	/* Free up child linked list, sort array, path buffer. */
 	if (sp->fts_child)
 		fts_lfree(sp->fts_child);
-	if (sp->fts_array)
-		free(sp->fts_array);
+	free(sp->fts_array);
 	free(sp->fts_path);
 
 	/* Return to original directory, save errno if necessary. */
@@ -705,8 +704,7 @@
 				 * structures already allocated.
 				 */
 mem1:				saved_errno = errno;
-				if (p)
-					free(p);
+				free(p);
 				fts_lfree(head);
 				(void)__closedir(dirp);
 				cur->fts_info = FTS_ERR;
@@ -1043,10 +1041,7 @@
 	 * We limit fts_pathlen to USHRT_MAX to be safe in both cases.
 	 */
 	if (sp->fts_pathlen < 0 || sp->fts_pathlen >= USHRT_MAX) {
-		if (sp->fts_path) {
-			free(sp->fts_path);
-			sp->fts_path = NULL;
-		}
+		free(sp->fts_path);
 		sp->fts_path = NULL;
 		__set_errno (ENAMETOOLONG);
 		return (1);
diff -Naur glibc-2.5/libio/bug-wmemstream1.c libc/libio/bug-wmemstream1.c
--- glibc-2.5/libio/bug-wmemstream1.c	2006-08-14 15:11:34.000000000 -0700
+++ libc/libio/bug-wmemstream1.c	2006-09-29 17:06:33.000000000 -0700
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <string.h>
+#include <wchar.h>
 
 
 static int
diff -Naur glibc-2.5/libio/tst-wmemstream1.c libc/libio/tst-wmemstream1.c
--- glibc-2.5/libio/tst-wmemstream1.c	2006-01-11 18:02:27.000000000 -0800
+++ libc/libio/tst-wmemstream1.c	2006-09-29 17:06:33.000000000 -0700
@@ -1,3 +1,5 @@
+#include <wchar.h>
+
 #define CHAR_T wchar_t
 #define W(o) L##o
 #define OPEN_MEMSTREAM open_wmemstream
diff -Naur glibc-2.5/libio/tst-wmemstream2.c libc/libio/tst-wmemstream2.c
--- glibc-2.5/libio/tst-wmemstream2.c	2006-01-11 18:02:27.000000000 -0800
+++ libc/libio/tst-wmemstream2.c	2006-09-29 17:06:33.000000000 -0700
@@ -1,3 +1,5 @@
+#include <wchar.h>
+
 #define CHAR_T wchar_t
 #define W(o) L##o
 #define OPEN_MEMSTREAM open_wmemstream
diff -Naur glibc-2.5/libio/wmemstream.c libc/libio/wmemstream.c
--- glibc-2.5/libio/wmemstream.c	2006-08-14 15:13:48.000000000 -0700
+++ libc/libio/wmemstream.c	2006-09-29 17:06:33.000000000 -0700
@@ -20,6 +20,7 @@
 #include "strfile.h"
 #include <stdio.h>
 #include <stdlib.h>
+#include <wchar.h>
 
 
 struct _IO_FILE_wmemstream
diff -Naur glibc-2.5/localedata/ChangeLog libc/localedata/ChangeLog
--- glibc-2.5/localedata/ChangeLog	2006-09-29 11:30:52.000000000 -0700
+++ libc/localedata/ChangeLog	2006-10-06 08:36:50.000000000 -0700
@@ -1,3 +1,16 @@
+2006-10-05  Dmitry V. Levin  <ldv@altlinux.org>
+
+	* locales/tt_RU: Fix territory, title and descriptive comment.
+
+2006-10-05  Ulrich Drepper  <drepper@redhat.com>
+
+	* locales/pa_IN (abday): Fix spelling of Sunday.
+	Patch by Mayank Jain <majain@redhat.com>.
+
+2006-10-01  Ulrich Drepper  <drepper@redhat.com>
+
+	* locales/en_GB: Use more complete en_US data in LC_NAME.
+
 2006-09-29  Ulrich Drepper  <drepper@redhat.com>
 
 	[BZ #39]
diff -Naur glibc-2.5/localedata/locales/en_GB libc/localedata/locales/en_GB
--- glibc-2.5/localedata/locales/en_GB	2006-07-30 15:19:44.000000000 -0700
+++ libc/localedata/locales/en_GB	2006-10-01 09:18:33.000000000 -0700
@@ -146,8 +146,7 @@
 END LC_MEASUREMENT
 
 LC_NAME
-name_fmt    "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
-<U0025><U006D><U0025><U0074><U0025><U0066>"
+copy "en_US"
 END LC_NAME
 
 LC_ADDRESS
diff -Naur glibc-2.5/localedata/locales/pa_IN libc/localedata/locales/pa_IN
--- glibc-2.5/localedata/locales/pa_IN	2006-08-12 22:47:24.000000000 -0700
+++ libc/localedata/locales/pa_IN	2006-10-05 09:54:26.000000000 -0700
@@ -80,7 +80,7 @@
             "<U0A2C><U0A41><U0A71><U0A27><U0020>";/
             "<U0A35><U0A40><U0A30><U0020>";/
             "<U0A36><U0A41><U0A71><U0A15><U0A30><U0020>";/
-            "<U0A36><U0A28><U0A40><U0A1A><U0A30><U0020>"
+            "<U0A36><U0A28><U0A3F><U0A71><U0A1A><U0A30><U0020>"
 %
 % Full weekday names (%A)
 day       "<U0A10><U0A24><U0A35><U0A3E><U0A30><U0020>";/
diff -Naur glibc-2.5/localedata/locales/tt_RU libc/localedata/locales/tt_RU
--- glibc-2.5/localedata/locales/tt_RU	2006-07-30 15:19:43.000000000 -0700
+++ libc/localedata/locales/tt_RU	2006-10-06 08:34:42.000000000 -0700
@@ -1,7 +1,7 @@
 comment_char %
 escape_char  /
 %
-% Tatar Language Locale for Tatarstan
+% Tatar Language Locale for Russia
 % Source:
 % Contact: Pablo Saratxaga, Rinat Norkin
 % Email: <pablo@mandrakesoft.com>, <rinat@taif.ru>
@@ -24,7 +24,7 @@
 % replace cyrillic alphabet
 
 LC_IDENTIFICATION
-title "Tatar language locale for Tatarstan"
+title "Tatar language locale for Russia"
 source "Rinat Norkin"
 address ""
 contact "Pablo Saratxaga, Rinat Norkin"
@@ -32,7 +32,7 @@
 tel ""
 fax ""
 language "Tatar"
-territory "Tatarstan"
+territory "Russia"
 revision "0.4"
 date "2001-01-28"
 
diff -Naur glibc-2.5/manual/message.texi libc/manual/message.texi
--- glibc-2.5/manual/message.texi	2003-08-29 00:15:18.000000000 -0700
+++ libc/manual/message.texi	2006-10-02 09:02:53.000000000 -0700
@@ -1189,7 +1189,7 @@
 with every language this is the only viable solution except for
 hardcoding the information in the code (which still would require the
 possibility of extensions to not prevent the use of new languages).  The
-details are explained in the GNU @code{gettext} manual.  Here only a a
+details are explained in the GNU @code{gettext} manual.  Here only a
 bit of information is provided.
 
 The information about the plural form selection has to be stored in the
@@ -1590,7 +1590,7 @@
 them.
 
 The POSIX locale model uses the environment variables @code{LC_COLLATE},
-@code{LC_CTYPE}, @code{LC_MESSAGES}, @code{LC_MONETARY}, @code{NUMERIC},
+@code{LC_CTYPE}, @code{LC_MESSAGES}, @code{LC_MONETARY}, @code{LC_NUMERIC},
 and @code{LC_TIME} to select the locale which is to be used.  This way
 the user can influence lots of functions.  As we mentioned above the
 @code{gettext} functions also take advantage of this.
diff -Naur glibc-2.5/manual/stdio.texi libc/manual/stdio.texi
--- glibc-2.5/manual/stdio.texi	2006-02-03 23:12:54.000000000 -0800
+++ libc/manual/stdio.texi	2006-10-06 08:33:02.000000000 -0700
@@ -2393,8 +2393,9 @@
 allocates a string (as with @code{malloc}; @pxref{Unconstrained
 Allocation}) to hold the output, instead of putting the output in a
 buffer you allocate in advance.  The @var{ptr} argument should be the
-address of a @code{char *} object, and @code{asprintf} stores a pointer
-to the newly allocated string at that location.
+address of a @code{char *} object, and a successful call to
+@code{asprintf} stores a pointer to the newly allocated string at that
+location.
 
 The return value is the number of characters allocated for the buffer, or
 less than zero if an error occurred. Usually this means that the buffer
diff -Naur glibc-2.5/nscd/mem.c libc/nscd/mem.c
--- glibc-2.5/nscd/mem.c	2005-12-06 21:47:27.000000000 -0800
+++ libc/nscd/mem.c	2006-10-02 09:31:11.000000000 -0700
@@ -1,5 +1,5 @@
 /* Cache memory handling.
-   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2004.
 
@@ -480,12 +480,12 @@
 	{
 	  /* Try to resize the database.  Grow size of 1/8th.  */
 	  size_t oldtotal = (sizeof (struct database_pers_head)
-			     + db->head->module * sizeof (ref_t)
+			     + roundup (db->head->module * sizeof (ref_t), ALIGN)
 			     + db->head->data_size);
 	  size_t new_data_size = (db->head->data_size
 				  + MAX (2 * len, db->head->data_size / 8));
 	  size_t newtotal = (sizeof (struct database_pers_head)
-			     + db->head->module * sizeof (ref_t)
+			     + roundup (db->head->module * sizeof (ref_t), ALIGN)
 			     + new_data_size);
 	  if (newtotal > db->max_db_size)
 	    {
diff -Naur glibc-2.5/nscd/nscd.c libc/nscd/nscd.c
--- glibc-2.5/nscd/nscd.c	2006-05-30 10:29:36.000000000 -0700
+++ libc/nscd/nscd.c	2006-10-06 08:24:36.000000000 -0700
@@ -237,7 +237,7 @@
 
       if (chdir ("/") != 0)
 	error (EXIT_FAILURE, errno,
-	       _("cannot change current working cirectory to \"/\""));
+	       _("cannot change current working directory to \"/\""));
 
       openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
 
diff -Naur glibc-2.5/nscd/nscd-client.h libc/nscd/nscd-client.h
--- glibc-2.5/nscd/nscd-client.h	2006-04-25 16:48:55.000000000 -0700
+++ libc/nscd/nscd-client.h	2006-10-02 09:32:27.000000000 -0700
@@ -258,6 +258,7 @@
   const char *data;
   size_t mapsize;
   int counter;		/* > 0 indicates it is usable.  */
+  size_t datasize;
 };
 #define NO_MAPPING ((struct mapped_database *) -1l)
 
diff -Naur glibc-2.5/nscd/nscd_helper.c libc/nscd/nscd_helper.c
--- glibc-2.5/nscd/nscd_helper.c	2006-04-25 16:47:53.000000000 -0700
+++ libc/nscd/nscd_helper.c	2006-10-02 09:33:51.000000000 -0700
@@ -290,6 +290,7 @@
       newp->data = ((char *) mapping + head.header_size
 		    + roundup (head.module * sizeof (ref_t), ALIGN));
       newp->mapsize = size;
+      newp->datasize = head.data_size;
       /* Set counter to 1 to show it is usable.  */
       newp->counter = 1;
 
@@ -340,7 +341,8 @@
       /* If not mapped or timestamp not updated, request new map.  */
       if (cur == NULL
 	  || (cur->head->nscd_certainly_running == 0
-	      && cur->head->timestamp + MAPPING_TIMEOUT < time (NULL)))
+	      && cur->head->timestamp + MAPPING_TIMEOUT < time (NULL))
+	  || cur->head->data_size > cur->datasize)
 	cur = get_mapping (type, name,
 			   (struct mapped_database **) &mapptr->mapped);
 
@@ -365,14 +367,18 @@
 		     const struct mapped_database *mapped)
 {
   unsigned long int hash = __nis_hash (key, keylen) % mapped->head->module;
+  size_t datasize = mapped->datasize;
 
   ref_t work = mapped->head->array[hash];
-  while (work != ENDREF)
+  while (work != ENDREF && work + sizeof (struct hashentry) <= datasize)
     {
       struct hashentry *here = (struct hashentry *) (mapped->data + work);
 
-      if (type == here->type && keylen == here->len
-	  && memcmp (key, mapped->data + here->key, keylen) == 0)
+      if (type == here->type
+	  && keylen == here->len
+	  && here->key + here->len <= datasize
+	  && memcmp (key, mapped->data + here->key, keylen) == 0
+	  && here->packet + sizeof (struct datahead) <= datasize)
 	{
 	  /* We found the entry.  Increment the appropriate counter.  */
 	  const struct datahead *dh
@@ -380,8 +386,7 @@
 
 	  /* See whether we must ignore the entry or whether something
 	     is wrong because garbage collection is in progress.  */
-	  if (dh->usable && ((char *) dh + dh->allocsize
-			     <= (char *) mapped->head + mapped->mapsize))
+	  if (dh->usable && here->packet + dh->allocsize <= datasize)
 	    return dh;
 	}
 
diff -Naur glibc-2.5/posix/glob.c libc/posix/glob.c
--- glibc-2.5/posix/glob.c	2006-09-25 08:31:56.000000000 -0700
+++ libc/posix/glob.c	2006-09-30 08:08:44.000000000 -0700
@@ -1287,8 +1287,15 @@
 	      for (size_t i = 0; i < cur; ++i)
 		free (names->name[i]);
 	      names = names->next;
+	      /* NB: we will not leak memory here if we exit without
+		 freeing the current block assigned to OLD.  At least
+		 the very first block is always allocated on the stack
+		 and this is the block assigned to OLD here.  */
 	      if (names == NULL)
-		break;
+		{
+		  assert (old == &init_names);
+		  break;
+		}
 	      cur = names->count;
 	      if (old == names_alloca)
 		names_alloca = names;
@@ -1306,8 +1313,15 @@
 		new_gl_pathv[pglob->gl_offs + pglob->gl_pathc++]
 		  = names->name[i];
 	      names = names->next;
+	      /* NB: we will not leak memory here if we exit without
+		 freeing the current block assigned to OLD.  At least
+		 the very first block is always allocated on the stack
+		 and this is the block assigned to OLD here.  */
 	      if (names == NULL)
-		break;
+		{
+		  assert (old == &init_names);
+		  break;
+		}
 	      cur = names->count;
 	      if (old == names_alloca)
 		names_alloca = names;
diff -Naur glibc-2.5/README libc/README
--- glibc-2.5/README	2006-09-29 11:42:12.000000000 -0700
+++ libc/README	2006-10-02 10:11:52.000000000 -0700
@@ -10,13 +10,6 @@
 implement the operating system behavior seen by user applications.
 In GNU/Hurd systems, it works with a microkernel and Hurd servers.
 
-Version 2.4 is the first release after a long period of development, and
-introduces changes to the API and a new ABI for all configurations.  It
-has been tested and deployed in new production systems, but should still
-be considered somewhat experimental.  The stable 2.3 release series
-continues to be maintained, and implements a widely-deployed ABI.
-Version 2.3.6 is available, and we will release 2.3.7 with more bug fixes.
-
 The GNU C Library implements much of the POSIX.1 functionality in the
 GNU/Hurd system, using configurations i[34567]86-*-gnu.
 
diff -Naur glibc-2.5/README.template libc/README.template
--- glibc-2.5/README.template	2006-03-06 02:59:31.000000000 -0800
+++ libc/README.template	2006-10-02 10:10:43.000000000 -0700
@@ -10,13 +10,6 @@
 implement the operating system behavior seen by user applications.
 In GNU/Hurd systems, it works with a microkernel and Hurd servers.
 
-Version 2.4 is the first release after a long period of development, and
-introduces changes to the API and a new ABI for all configurations.  It
-has been tested and deployed in new production systems, but should still
-be considered somewhat experimental.  The stable 2.3 release series
-continues to be maintained, and implements a widely-deployed ABI.
-Version 2.3.6 is available, and we will release 2.3.7 with more bug fixes.
-
 The GNU C Library implements much of the POSIX.1 functionality in the
 GNU/Hurd system, using configurations i[34567]86-*-gnu.
 
diff -Naur glibc-2.5/sysdeps/posix/getaddrinfo.c libc/sysdeps/posix/getaddrinfo.c
--- glibc-2.5/sysdeps/posix/getaddrinfo.c	2006-09-24 09:51:50.000000000 -0700
+++ libc/sysdeps/posix/getaddrinfo.c	2006-10-02 09:49:47.000000000 -0700
@@ -1291,8 +1291,8 @@
   for (idx = 0; ; ++idx)
     {
       unsigned int bits = list[idx].bits;
-      uint8_t *mask = list[idx].prefix.s6_addr;
-      uint8_t *val = in6->sin6_addr.s6_addr;
+      const uint8_t *mask = list[idx].prefix.s6_addr;
+      const uint8_t *val = in6->sin6_addr.s6_addr;
 
       while (bits >= 8)
 	{
diff -Naur glibc-2.5/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c libc/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c
--- glibc-2.5/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c	2006-08-14 22:27:23.000000000 -0700
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c	2006-10-02 11:40:39.000000000 -0700
@@ -1 +1,9 @@
+#include <errno.h>
+#include <signal.h>
+#include <unistd.h>
+#include <sysdep-cancel.h>
+
+#define __sigprocmask(how, set, oset) \
+  INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8)
+
 #include <sysdeps/posix/pause.c>
