Submitted By: Robert Connolly (ashes) Date: 2006-12-03 Initial Package Version: 2.5 Upstream Status: From Upstream Origin: 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.orig/ChangeLog glibc-2.5/ChangeLog --- glibc-2.5.orig/ChangeLog 2006-09-29 18:45:39.000000000 +0000 +++ glibc-2.5/ChangeLog 2006-10-06 15:39:29.000000000 +0000 @@ -1,5 +1,62 @@ +2006-10-06 Andreas Jaeger + + * include/features.h (__GLIBC_MINOR__): It's glibc 2.5 now. + +2006-10-06 Ulrich Drepper + + * po/pl.po: Update from translation team. + + * nscd/nscd.c (main): Fix typo in message. + Patch by Jakub Bogsz . + +2006-10-02 Jakub Jelinek + + [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 + + * elf/rtld.c (dl_main): Don't use prelinking if LD_DYNAMIC_WEAK is + used. + +2006-10-02 Jakub Jelinek + + * 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 + + * 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 + + * posix/glob.c (glob_in_dir): Add some comments and asserts to + explain why there are no leaks. + 2006-09-29 Ulrich Drepper + * libio/wmemstream.c: Include . + * 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.orig/README glibc-2.5/README --- glibc-2.5.orig/README 2006-09-29 18:42:12.000000000 +0000 +++ glibc-2.5/README 2006-10-02 17:11:52.000000000 +0000 @@ -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.orig/README.template glibc-2.5/README.template --- glibc-2.5.orig/README.template 2006-03-06 10:59:31.000000000 +0000 +++ glibc-2.5/README.template 2006-10-02 17:10:43.000000000 +0000 @@ -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.orig/elf/rtld.c glibc-2.5/elf/rtld.c --- glibc-2.5.orig/elf/rtld.c 2006-09-29 16:56:15.000000000 +0000 +++ glibc-2.5/elf/rtld.c 2006-10-02 18:24:37.000000000 +0000 @@ -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.orig/include/features.h glibc-2.5/include/features.h --- glibc-2.5.orig/include/features.h 2006-04-25 20:34:32.000000000 +0000 +++ glibc-2.5/include/features.h 2006-10-06 15:38:14.000000000 +0000 @@ -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.orig/io/fts.c glibc-2.5/io/fts.c --- glibc-2.5.orig/io/fts.c 2006-04-08 19:33:17.000000000 +0000 +++ glibc-2.5/io/fts.c 2006-10-02 16:06:49.000000000 +0000 @@ -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.orig/libio/bug-wmemstream1.c glibc-2.5/libio/bug-wmemstream1.c --- glibc-2.5.orig/libio/bug-wmemstream1.c 2006-08-14 22:11:34.000000000 +0000 +++ glibc-2.5/libio/bug-wmemstream1.c 2006-09-30 00:06:33.000000000 +0000 @@ -1,5 +1,6 @@ #include #include +#include static int diff -Naur glibc-2.5.orig/libio/tst-wmemstream1.c glibc-2.5/libio/tst-wmemstream1.c --- glibc-2.5.orig/libio/tst-wmemstream1.c 2006-01-12 02:02:27.000000000 +0000 +++ glibc-2.5/libio/tst-wmemstream1.c 2006-09-30 00:06:33.000000000 +0000 @@ -1,3 +1,5 @@ +#include + #define CHAR_T wchar_t #define W(o) L##o #define OPEN_MEMSTREAM open_wmemstream diff -Naur glibc-2.5.orig/libio/tst-wmemstream2.c glibc-2.5/libio/tst-wmemstream2.c --- glibc-2.5.orig/libio/tst-wmemstream2.c 2006-01-12 02:02:27.000000000 +0000 +++ glibc-2.5/libio/tst-wmemstream2.c 2006-09-30 00:06:33.000000000 +0000 @@ -1,3 +1,5 @@ +#include + #define CHAR_T wchar_t #define W(o) L##o #define OPEN_MEMSTREAM open_wmemstream diff -Naur glibc-2.5.orig/libio/wmemstream.c glibc-2.5/libio/wmemstream.c --- glibc-2.5.orig/libio/wmemstream.c 2006-08-14 22:13:48.000000000 +0000 +++ glibc-2.5/libio/wmemstream.c 2006-09-30 00:06:33.000000000 +0000 @@ -20,6 +20,7 @@ #include "strfile.h" #include #include +#include struct _IO_FILE_wmemstream diff -Naur glibc-2.5.orig/localedata/ChangeLog glibc-2.5/localedata/ChangeLog --- glibc-2.5.orig/localedata/ChangeLog 2006-09-29 18:30:52.000000000 +0000 +++ glibc-2.5/localedata/ChangeLog 2006-10-06 15:36:50.000000000 +0000 @@ -1,3 +1,16 @@ +2006-10-05 Dmitry V. Levin + + * locales/tt_RU: Fix territory, title and descriptive comment. + +2006-10-05 Ulrich Drepper + + * locales/pa_IN (abday): Fix spelling of Sunday. + Patch by Mayank Jain . + +2006-10-01 Ulrich Drepper + + * locales/en_GB: Use more complete en_US data in LC_NAME. + 2006-09-29 Ulrich Drepper [BZ #39] diff -Naur glibc-2.5.orig/localedata/locales/en_GB glibc-2.5/localedata/locales/en_GB --- glibc-2.5.orig/localedata/locales/en_GB 2006-07-30 22:19:44.000000000 +0000 +++ glibc-2.5/localedata/locales/en_GB 2006-10-01 16:18:33.000000000 +0000 @@ -146,8 +146,7 @@ END LC_MEASUREMENT LC_NAME -name_fmt "/ -" +copy "en_US" END LC_NAME LC_ADDRESS diff -Naur glibc-2.5.orig/localedata/locales/pa_IN glibc-2.5/localedata/locales/pa_IN --- glibc-2.5.orig/localedata/locales/pa_IN 2006-08-13 05:47:24.000000000 +0000 +++ glibc-2.5/localedata/locales/pa_IN 2006-10-05 16:54:26.000000000 +0000 @@ -80,7 +80,7 @@ "";/ "";/ "";/ - "" + "" % % Full weekday names (%A) day "";/ diff -Naur glibc-2.5.orig/localedata/locales/tt_RU glibc-2.5/localedata/locales/tt_RU --- glibc-2.5.orig/localedata/locales/tt_RU 2006-07-30 22:19:43.000000000 +0000 +++ glibc-2.5/localedata/locales/tt_RU 2006-10-06 15:34:42.000000000 +0000 @@ -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: , @@ -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.orig/manual/message.texi glibc-2.5/manual/message.texi --- glibc-2.5.orig/manual/message.texi 2003-08-29 07:15:18.000000000 +0000 +++ glibc-2.5/manual/message.texi 2006-10-02 16:02:53.000000000 +0000 @@ -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.orig/manual/stdio.texi glibc-2.5/manual/stdio.texi --- glibc-2.5.orig/manual/stdio.texi 2006-02-04 07:12:54.000000000 +0000 +++ glibc-2.5/manual/stdio.texi 2006-10-06 15:33:02.000000000 +0000 @@ -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.orig/nscd/mem.c glibc-2.5/nscd/mem.c --- glibc-2.5.orig/nscd/mem.c 2005-12-07 05:47:27.000000000 +0000 +++ glibc-2.5/nscd/mem.c 2006-10-02 16:31:11.000000000 +0000 @@ -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 , 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.orig/nscd/nscd-client.h glibc-2.5/nscd/nscd-client.h --- glibc-2.5.orig/nscd/nscd-client.h 2006-04-25 23:48:55.000000000 +0000 +++ glibc-2.5/nscd/nscd-client.h 2006-10-02 16:32:27.000000000 +0000 @@ -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.orig/nscd/nscd.c glibc-2.5/nscd/nscd.c --- glibc-2.5.orig/nscd/nscd.c 2006-05-30 17:29:36.000000000 +0000 +++ glibc-2.5/nscd/nscd.c 2006-10-06 15:24:36.000000000 +0000 @@ -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.orig/nscd/nscd_helper.c glibc-2.5/nscd/nscd_helper.c --- glibc-2.5.orig/nscd/nscd_helper.c 2006-04-25 23:47:53.000000000 +0000 +++ glibc-2.5/nscd/nscd_helper.c 2006-10-02 16:33:51.000000000 +0000 @@ -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.orig/posix/glob.c glibc-2.5/posix/glob.c --- glibc-2.5.orig/posix/glob.c 2006-09-25 15:31:56.000000000 +0000 +++ glibc-2.5/posix/glob.c 2006-09-30 15:08:44.000000000 +0000 @@ -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.orig/sysdeps/posix/getaddrinfo.c glibc-2.5/sysdeps/posix/getaddrinfo.c --- glibc-2.5.orig/sysdeps/posix/getaddrinfo.c 2006-09-24 16:51:50.000000000 +0000 +++ glibc-2.5/sysdeps/posix/getaddrinfo.c 2006-10-02 16:49:47.000000000 +0000 @@ -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.orig/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c glibc-2.5/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c --- glibc-2.5.orig/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c 2006-08-15 05:27:23.000000000 +0000 +++ glibc-2.5/sysdeps/unix/sysv/linux/sparc/sparc64/pause.c 2006-10-02 18:40:39.000000000 +0000 @@ -1 +1,9 @@ +#include +#include +#include +#include + +#define __sigprocmask(how, set, oset) \ + INLINE_SYSCALL (rt_sigprocmask, 4, how, set, oset, _NSIG / 8) + #include