[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r5719 - in /fsf/trunk/libc: ./ intl/ locale/ localedata/ po/ sysdeps/unix/



Author: eglibc
Date: Mon Mar 31 00:05:31 2008
New Revision: 5719

Log:
Import glibc-mainline for 2008-03-31

Added:
    fsf/trunk/libc/intl/tst-gettext6.c
    fsf/trunk/libc/intl/tst-gettext6.sh
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/intl/Makefile
    fsf/trunk/libc/intl/dcigettext.c
    fsf/trunk/libc/locale/duplocale.c
    fsf/trunk/libc/locale/freelocale.c
    fsf/trunk/libc/locale/newlocale.c
    fsf/trunk/libc/locale/setlocale.c
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/Makefile
    fsf/trunk/libc/po/nl.po
    fsf/trunk/libc/sysdeps/unix/opendir.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Mon Mar 31 00:05:31 2008
@@ -1,3 +1,29 @@
+2008-03-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5443]
+	* intl/dcigettext.c (__dcigettext): Get reader lock for locale data
+	before looking for translation.
+	* locale/duplocale.c: Transform __libc_setlocale_lock into rwlock.
+	* locale/freelocale.c: Likewise.
+	* locale/newlocale.c: Likewise.
+	* locale/setlocale.c: Likewise.
+	Based partially on a patch by ryo@xxxxxxxxxxxxxxxxxxx
+
+2008-03-30  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* intl/dcigettext.c (_nl_find_msg): Reread nconversions after
+	acquiring wrlock.  Do conv_tab allocation while holding lock.
+	* intl/Makefile: Add rules to build and run tst-gettext6.
+	* intl/tst-gettext6.c: New test.
+	* intl/tst-gettext6.sh: New file.
+
+2008-03-30  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* po/nl.po: Update from translation team.
+
+	* sysdeps/unix/opendir.c (__alloc_dir): If allocation fails for size
+	provided through st_blksize, try the default size before giving up.
+
 2008-03-29  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* stdio-common/vfprintf.c (vfprintf): Correct overflow test.

Modified: fsf/trunk/libc/intl/Makefile
==============================================================================
--- fsf/trunk/libc/intl/Makefile (original)
+++ fsf/trunk/libc/intl/Makefile Mon Mar 31 00:05:31 2008
@@ -1,4 +1,4 @@
-# Copyright (C) 1995-2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1995-2003, 2005, 2008 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
@@ -32,11 +32,11 @@
 	     tst-codeset.sh tstcodeset.po \
 	     tst-gettext3.sh \
 	     tst-gettext4.sh tst-gettext4-de.po tst-gettext4-fr.po \
-	     tst-gettext5.sh
+	     tst-gettext5.sh tst-gettext6.sh
 
 include ../Makeconfig
 
-multithread-test-srcs := tst-gettext4 tst-gettext5
+multithread-test-srcs := tst-gettext4 tst-gettext5 tst-gettext6
 test-srcs := tst-gettext tst-translit tst-gettext2 tst-codeset tst-gettext3
 ifeq ($(have-thread-library),yes)
 test-srcs += $(multithread-test-srcs)
@@ -67,7 +67,8 @@
 tests: $(objpfx)tst-translit.out $(objpfx)tst-gettext2.out \
        $(objpfx)tst-codeset.out $(objpfx)tst-gettext3.out
 ifeq ($(have-thread-library),yes)
-tests: $(objpfx)tst-gettext4.out $(objpfx)tst-gettext5.out
+tests: $(objpfx)tst-gettext4.out $(objpfx)tst-gettext5.out \
+       $(objpfx)tst-gettext6.out
 endif
 ifneq (no,$(PERL))
 tests: $(objpfx)mtrace-tst-gettext
@@ -90,6 +91,8 @@
 	$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
 $(objpfx)tst-gettext5.out: tst-gettext5.sh $(objpfx)tst-gettext5
 	$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
+$(objpfx)tst-gettext6.out: tst-gettext6.sh $(objpfx)tst-gettext6
+	$(SHELL) -e $< $(common-objpfx) '$(run-program-prefix)' $(common-objpfx)intl/
 endif
 endif
 
@@ -104,6 +107,7 @@
 CFLAGS-tst-gettext3.c = -DOBJPFX=\"$(objpfx)\"
 CFLAGS-tst-gettext4.c = -DOBJPFX=\"$(objpfx)\"
 CFLAGS-tst-gettext5.c = -DOBJPFX=\"$(objpfx)\"
+CFLAGS-tst-gettext6.c = -DOBJPFX=\"$(objpfx)\"
 
 ifeq ($(have-thread-library),yes)
 ifeq (yes,$(build-shared))
@@ -122,6 +126,7 @@
 $(objpfx)tst-gettext3.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext4.out: $(objpfx)tst-gettext.out
 $(objpfx)tst-gettext5.out: $(objpfx)tst-gettext.out
+$(objpfx)tst-gettext6.out: $(objpfx)tst-gettext.out
 
 CPPFLAGS += -D'LOCALEDIR="$(msgcatdir)"' \
 	    -D'LOCALE_ALIAS_PATH="$(msgcatdir)"'

Modified: fsf/trunk/libc/intl/dcigettext.c
==============================================================================
--- fsf/trunk/libc/intl/dcigettext.c (original)
+++ fsf/trunk/libc/intl/dcigettext.c Mon Mar 31 00:05:31 2008
@@ -1,5 +1,6 @@
 /* Implementation of the internal dcigettext function.
-   Copyright (C) 1995-2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2006, 2007, 2008
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -449,6 +450,11 @@
 	    : n == 1 ? (char *) msgid1 : (char *) msgid2);
 #endif
 
+#ifdef _LIBC
+  __libc_rwlock_define (extern, __libc_setlocale_lock attribute_hidden)
+  __libc_rwlock_rdlock (__libc_setlocale_lock);
+#endif
+
   __libc_rwlock_rdlock (_nl_state_lock);
 
   /* If DOMAINNAME is NULL, we are interested in the default domain.  If
@@ -466,7 +472,7 @@
   search.category = category;
 # ifdef HAVE_PER_THREAD_LOCALE
 #  ifdef _LIBC
-  localename = __current_locale_name (category);
+  localename = strdupa (__current_locale_name (category));
 #  endif
   search.localename = localename;
 # endif
@@ -489,6 +495,9 @@
       else
 	retval = (char *) (*foundp)->translation;
 
+# ifdef _LIBC
+      __libc_rwlock_unlock (__libc_setlocale_lock);
+# endif
       __libc_rwlock_unlock (_nl_state_lock);
       return retval;
     }
@@ -548,6 +557,7 @@
 	  /* We cannot get the current working directory.  Don't signal an
 	     error but simply return the default string.  */
 	  FREE_BLOCKS (block_list);
+	  __libc_rwlock_unlock (__libc_setlocale_lock);
 	  __libc_rwlock_unlock (_nl_state_lock);
 	  __set_errno (saved_errno);
 	  return (plural == 0
@@ -614,6 +624,7 @@
 	{
 	no_translation:
 	  FREE_BLOCKS (block_list);
+	  __libc_rwlock_unlock (__libc_setlocale_lock);
 	  __libc_rwlock_unlock (_nl_state_lock);
 	  __set_errno (saved_errno);
 	  return (plural == 0
@@ -727,6 +738,7 @@
 	      if (plural)
 		retval = plural_lookup (domain, n, retval, retlen);
 
+	      __libc_rwlock_unlock (__libc_setlocale_lock);
 	      __libc_rwlock_unlock (_nl_state_lock);
 	      return retval;
 	    }
@@ -879,6 +891,7 @@
 	{
 	  /* We have to allocate a new conversions table.  */
 	  __libc_rwlock_wrlock (domain->conversions_lock);
+	  nconversions = domain->nconversions;
 
 	  /* Maybe in the meantime somebody added the translation.
 	     Recheck.  */
@@ -1033,6 +1046,7 @@
 # endif
 	  )
 	{
+	  __libc_lock_define_initialized (static, lock)
 	  /* We are supposed to do a conversion.  First allocate an
 	     appropriate table with the same structure as the table
 	     of translations in the file, where we can put the pointers
@@ -1042,13 +1056,21 @@
 	     handle this case by converting RESULTLEN bytes, including
 	     NULs.  */
 
-	  if (convd->conv_tab == NULL
-	      && ((convd->conv_tab =
-		    (char **) calloc (nstrings + domain->n_sysdep_strings,
-				      sizeof (char *)))
-		  == NULL))
-	    /* Mark that we didn't succeed allocating a table.  */
-	    convd->conv_tab = (char **) -1;
+	  if (__builtin_expect (convd->conv_tab == NULL, 0))
+	    {
+	      __libc_lock_lock (lock);
+	      if (convd->conv_tab == NULL)
+		{
+		  convd->conv_tab
+		    = calloc (nstrings + domain->n_sysdep_strings,
+			      sizeof (char *));
+		  if (convd->conv_tab != NULL)
+		    goto not_translated_yet;
+		  /* Mark that we didn't succeed allocating a table.  */
+		  convd->conv_tab = (char **) -1;
+		}
+	      __libc_lock_unlock (lock);
+	    }
 
 	  if (__builtin_expect (convd->conv_tab == (char **) -1, 0))
 	    /* Nothing we can do, no more memory.  We cannot use the
@@ -1057,12 +1079,14 @@
 
 	  if (convd->conv_tab[act] == NULL)
 	    {
+	      __libc_lock_lock (lock);
+	    not_translated_yet:;
+
 	      /* We haven't used this string so far, so it is not
 		 translated yet.  Do this now.  */
 	      /* We use a bit more efficient memory handling.
 		 We allocate always larger blocks which get used over
 		 time.  This is faster than many small allocations.   */
-	      __libc_lock_define_initialized (static, lock)
 # define INITIAL_BLOCK_SIZE	4080
 	      static unsigned char *freemem;
 	      static size_t freemem_size;
@@ -1073,8 +1097,6 @@
 # ifndef _LIBC
 	      transmem_block_t *transmem_list = NULL;
 # endif
-
-	      __libc_lock_lock (lock);
 
 	      inbuf = (const unsigned char *) result;
 	      outbuf = freemem + sizeof (size_t);

Added: fsf/trunk/libc/intl/tst-gettext6.c
==============================================================================
--- fsf/trunk/libc/intl/tst-gettext6.c (added)
+++ fsf/trunk/libc/intl/tst-gettext6.c Mon Mar 31 00:05:31 2008
@@ -1,0 +1,86 @@
+/* Test that gettext() in multithreaded applications works correctly.
+   Copyright (C) 2008 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2008.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <libintl.h>
+#include <locale.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <unistd.h>
+
+pthread_barrier_t b;
+
+static void *
+tf (void *arg)
+{
+  pthread_barrier_wait (&b);
+  return gettext ("Operation not permitted");
+}
+
+int
+test (void)
+{
+  pthread_t th[4];
+  unsetenv ("LANGUAGE");
+  unsetenv ("OUTPUT_CHARSET");
+  textdomain ("tstgettext6");
+  bindtextdomain ("tstgettext6", OBJPFX "domaindir");
+  setlocale (LC_ALL, "ja_JP.UTF-8");
+  pthread_barrier_init (&b, NULL, 4);
+  for (int i = 0; i < 4; i++)
+    if (pthread_create (&th[i], NULL, tf, NULL))
+      {
+	puts ("pthread_create failed");
+	return 1;
+      }
+  for (int i = 0; i < 4; i++)
+    pthread_join (th[i], NULL);
+  return 0;
+}
+
+int
+main (void)
+{
+  for (int i = 0; i < 300; i++)
+    {
+      pid_t p = fork ();
+      if (p == -1)
+	{
+	  printf ("fork failed: %m\n");
+	  return 1;
+	}
+      if (p == 0)
+	_exit (test ());
+      int status;
+      wait (&status);
+      if (WIFEXITED (status) && WEXITSTATUS (status) != 0)
+	{
+	  printf ("child exited with %d\n", WEXITSTATUS (status));
+	  return 1;
+	}
+      else if (WIFSIGNALED (status))
+	{
+	  printf ("child killed by signal %d\n", WTERMSIG (status));
+	  return 1;
+	}
+    }
+  return 0;
+}

Added: fsf/trunk/libc/intl/tst-gettext6.sh
==============================================================================
--- fsf/trunk/libc/intl/tst-gettext6.sh (added)
+++ fsf/trunk/libc/intl/tst-gettext6.sh Mon Mar 31 00:05:31 2008
@@ -1,0 +1,41 @@
+#! /bin/sh
+# Test that gettext() in multithreaded applications works correctly.
+# Copyright (C) 2008 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+#
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+# 02111-1307 USA.
+
+common_objpfx=$1
+run_program_prefix=$2
+objpfx=$3
+
+LC_ALL=C
+export LC_ALL
+
+# Create the domain directory.
+mkdir -p ${objpfx}domaindir/ja_JP/LC_MESSAGES
+# Populate it.
+msgfmt -o ${objpfx}domaindir/ja_JP/LC_MESSAGES/tstgettext6.mo ../po/ja.po
+
+GCONV_PATH=${common_objpfx}iconvdata
+export GCONV_PATH
+LOCPATH=${common_objpfx}localedata
+export LOCPATH
+
+${run_program_prefix} ${objpfx}tst-gettext6 > ${objpfx}tst-gettext6.out
+
+exit $?

Modified: fsf/trunk/libc/locale/duplocale.c
==============================================================================
--- fsf/trunk/libc/locale/duplocale.c (original)
+++ fsf/trunk/libc/locale/duplocale.c Mon Mar 31 00:05:31 2008
@@ -1,5 +1,5 @@
 /* Duplicate handle for selection of locales.
-   Copyright (C) 1997, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1997,2000,2001,2002,2005,2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1997.
 
@@ -27,7 +27,7 @@
 
 
 /* Lock for protecting global data.  */
-__libc_lock_define (extern , __libc_setlocale_lock attribute_hidden)
+__libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden)
 
 
 __locale_t
@@ -54,7 +54,7 @@
       char *namep = (char *) (result + 1);
 
       /* We modify global data (the usage counts).  */
-      __libc_lock_lock (__libc_setlocale_lock);
+      __libc_rwlock_wrlock (__libc_setlocale_lock);
 
       for (cnt = 0; cnt < __LC_LAST; ++cnt)
 	if (cnt != LC_ALL)
@@ -78,7 +78,7 @@
       result->__ctype_toupper = dataset->__ctype_toupper;
 
       /* It's done.  */
-      __libc_lock_unlock (__libc_setlocale_lock);
+      __libc_rwlock_unlock (__libc_setlocale_lock);
     }
 
   return result;

Modified: fsf/trunk/libc/locale/freelocale.c
==============================================================================
--- fsf/trunk/libc/locale/freelocale.c (original)
+++ fsf/trunk/libc/locale/freelocale.c Mon Mar 31 00:05:31 2008
@@ -1,5 +1,5 @@
 /* Free data allocated by a call to setlocale_r
-   Copyright (C) 1996, 1997, 2000, 2002, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1996,1997,2000,2002,2005,2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
 
@@ -26,7 +26,7 @@
 
 
 /* Lock for protecting global data.  */
-__libc_lock_define (extern , __libc_setlocale_lock attribute_hidden)
+__libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden)
 
 
 void
@@ -39,7 +39,7 @@
     return;
 
   /* We modify global data (the usage counts).  */
-  __libc_lock_lock (__libc_setlocale_lock);
+  __libc_rwlock_wrlock (__libc_setlocale_lock);
 
   for (cnt = 0; cnt < __LC_LAST; ++cnt)
     if (cnt != LC_ALL && dataset->__locales[cnt]->usage_count != UNDELETABLE)
@@ -47,7 +47,7 @@
       _nl_remove_locale (cnt, dataset->__locales[cnt]);
 
   /* It's done.  */
-  __libc_lock_unlock (__libc_setlocale_lock);
+  __libc_rwlock_unlock (__libc_setlocale_lock);
 
   /* Free the locale_t handle itself.  */
   free (dataset);

Modified: fsf/trunk/libc/locale/newlocale.c
==============================================================================
--- fsf/trunk/libc/locale/newlocale.c (original)
+++ fsf/trunk/libc/locale/newlocale.c Mon Mar 31 00:05:31 2008
@@ -1,5 +1,5 @@
 /* Return a reference to locale information record.
-   Copyright (C) 1996, 1997, 1999, 2000-2002, 2004, 2005, 2006
+   Copyright (C) 1996, 1997, 1999, 2000-2002, 2004, 2005, 2006, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1996.
@@ -30,7 +30,7 @@
 
 
 /* Lock for protecting global data.  */
-__libc_lock_define (extern , __libc_setlocale_lock attribute_hidden)
+__libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden)
 
 
 /* Use this when we come along an error.  */
@@ -162,7 +162,7 @@
     }
 
   /* Protect global data.  */
-  __libc_lock_lock (__libc_setlocale_lock);
+  __libc_rwlock_wrlock (__libc_setlocale_lock);
 
   /* Now process all categories we are interested in.  */
   names_len = 0;
@@ -183,7 +183,7 @@
 		  _nl_remove_locale (cnt, result.__locales[cnt]);
 
               /* Critical section left.  */
-              __libc_lock_unlock (__libc_setlocale_lock);
+              __libc_rwlock_unlock (__libc_setlocale_lock);
 	      return NULL;
 	    }
 
@@ -263,7 +263,7 @@
     }
 
   /* Critical section left.  */
-  __libc_lock_unlock (__libc_setlocale_lock);
+  __libc_rwlock_unlock (__libc_setlocale_lock);
 
   /* Update the special members.  */
  update:

Modified: fsf/trunk/libc/locale/setlocale.c
==============================================================================
--- fsf/trunk/libc/locale/setlocale.c (original)
+++ fsf/trunk/libc/locale/setlocale.c Mon Mar 31 00:05:31 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995-2000, 2002, 2003, 2004, 2006
+/* Copyright (C) 1991, 1992, 1995-2000, 2002, 2003, 2004, 2006, 2008
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -123,7 +123,7 @@
 
 
 /* Lock for protecting global data.  */
-__libc_lock_define_initialized (, __libc_setlocale_lock attribute_hidden)
+__libc_rwlock_define_initialized (, __libc_setlocale_lock attribute_hidden)
 
 /* Defined in loadmsgcat.c.  */
 extern int _nl_msg_cat_cntr;
@@ -314,7 +314,7 @@
 	}
 
       /* Protect global data.  */
-      __libc_lock_lock (__libc_setlocale_lock);
+      __libc_rwlock_wrlock (__libc_setlocale_lock);
 
       /* Load the new data for each category.  */
       while (category-- > 0)
@@ -381,7 +381,7 @@
 	    free ((char *) newnames[category]);
 
       /* Critical section left.  */
-      __libc_lock_unlock (__libc_setlocale_lock);
+      __libc_rwlock_unlock (__libc_setlocale_lock);
 
       /* Free the resources (the locale path variable).  */
       free (locale_path);
@@ -394,7 +394,7 @@
       const char *newname[1] = { locale };
 
       /* Protect global data.  */
-      __libc_lock_lock (__libc_setlocale_lock);
+      __libc_rwlock_wrlock (__libc_setlocale_lock);
 
       if (CATEGORY_USED (category))
 	{
@@ -446,7 +446,7 @@
 	}
 
       /* Critical section left.  */
-      __libc_lock_unlock (__libc_setlocale_lock);
+      __libc_rwlock_unlock (__libc_setlocale_lock);
 
       /* Free the resources (the locale path variable.  */
       free (locale_path);

Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Mon Mar 31 00:05:31 2008
@@ -1,3 +1,7 @@
+2008-03-30  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* Makefile (LOCALES): Add ja_JP.UTF-8.
+
 2008-03-23  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* locales/iso14651_t1_common: Add support for Devanagari script.

Modified: fsf/trunk/libc/localedata/Makefile
==============================================================================
--- fsf/trunk/libc/localedata/Makefile (original)
+++ fsf/trunk/libc/localedata/Makefile Mon Mar 31 00:05:31 2008
@@ -133,7 +133,8 @@
 	   en_US.ISO-8859-1 ja_JP.EUC-JP da_DK.ISO-8859-1 \
 	   hr_HR.ISO-8859-2 sv_SE.ISO-8859-1 ja_JP.SJIS fr_FR.ISO-8859-1 \
 	   vi_VN.TCVN5712-1 nb_NO.ISO-8859-1 nn_NO.ISO-8859-1 \
-	   tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8
+	   tr_TR.UTF-8 cs_CZ.UTF-8 zh_TW.EUC-TW fa_IR.UTF-8 fr_FR.UTF-8 \
+	   ja_JP.UTF-8
 LOCALE_SRCS := $(shell echo "$(LOCALES)"|sed 's/\([^ .]*\)[^ ]*/\1/g')
 CHARMAPS := $(shell echo "$(LOCALES)" | \
 		    sed -e 's/[^ .]*[.]\([^ ]*\)/\1/g' -e s/SJIS/SHIFT_JIS/g)

Modified: fsf/trunk/libc/po/nl.po
==============================================================================
--- fsf/trunk/libc/po/nl.po (original)
+++ fsf/trunk/libc/po/nl.po Mon Mar 31 00:05:31 2008
@@ -8,7 +8,7 @@
 "Project-Id-Version: libc-2.7\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2007-10-15 21:18-0700\n"
-"PO-Revision-Date: 2007-11-14 21:31+0100\n"
+"PO-Revision-Date: 2008-03-30 20:00+0200\n"
 "Last-Translator: Benno Schulenberg <benno@xxxxxxxxxxx>\n"
 "Language-Team: Dutch <vertaling@xxxxxxxxxxxxxxx>\n"
 "MIME-Version: 1.0\n"
@@ -1459,7 +1459,7 @@
 msgid "character map `%s' is not ASCII compatible, locale not ISO C compliant\n"
 msgstr ""
 "tekenskaart '%s' is niet ASCII-compatibel;\n"
-"de locale voldoet niet aan ISO C\n"
+"de taalregio voldoet niet aan ISO C\n"
 
 #: locale/programs/charmap.c:337
 #, c-format
@@ -2176,7 +2176,7 @@
 #: locale/programs/ld-ctype.c:3780
 #, c-format
 msgid "%s: transliteration data from locale `%s' not available"
-msgstr "%s: transliteratiegegevens van locale '%s' zijn niet beschikbaar"
+msgstr "%s: transliteratiegegevens van taalregio '%s' zijn niet beschikbaar"
 
 #: locale/programs/ld-ctype.c:3881
 #, c-format
@@ -2393,11 +2393,11 @@
 
 #: locale/programs/locale.c:76
 msgid "Write names of available locales"
-msgstr "namen van beschikbare locales tonen"
+msgstr "namen van de beschikbare taalregio's tonen"
 
 #: locale/programs/locale.c:78
 msgid "Write names of available charmaps"
-msgstr "namen van beschikbare tekenskaarten tonen"
+msgstr "namen van de beschikbare tekenskaarten tonen"
 
 #: locale/programs/locale.c:79
 msgid "Modify output format:"
@@ -2405,15 +2405,15 @@
 
 #: locale/programs/locale.c:80
 msgid "Write names of selected categories"
-msgstr "namen van geselecteerde categorieën tonen"
+msgstr "namen van de geselecteerde categorieën tonen"
 
 #: locale/programs/locale.c:81
 msgid "Write names of selected keywords"
-msgstr "namen van geselecteerde sleutelwoorden tonen"
+msgstr "namen van de geselecteerde sleutelwoorden tonen"
 
 #: locale/programs/locale.c:82
 msgid "Print more information"
-msgstr "breedsprakige uitvoer"
+msgstr "uitgebreide uitvoer produceren"
 
 #: locale/programs/locale.c:87
 msgid ""
@@ -2421,7 +2421,7 @@
 "<http://www.gnu.org/software/libc/bugs.html>.\n"
 msgstr ""
 "  \n"
-"Informatie over locales weergeven.\vVoor het rapporteren van fouten, zie:\n"
+"Informatie over taalregio-instellingen weergeven.\vVoor het rapporteren van fouten, zie:\n"
 "  <http://www.gnu.org/software/libc/bugs.html>.\n"
 
 #: locale/programs/locale.c:92
@@ -2435,22 +2435,22 @@
 #: locale/programs/locale.c:193
 #, c-format
 msgid "Cannot set LC_CTYPE to default locale"
-msgstr "Kan LC_TYPE niet op de standaard-locale instellen"
+msgstr "Kan LC_TYPE niet op de standaard-taalregio instellen"
 
 #: locale/programs/locale.c:195
 #, c-format
 msgid "Cannot set LC_MESSAGES to default locale"
-msgstr "Kan LC_MESSAGES niet op de standaard-locale instellen"
+msgstr "Kan LC_MESSAGES niet op de standaard-taalregio instellen"
 
 #: locale/programs/locale.c:208
 #, c-format
 msgid "Cannot set LC_COLLATE to default locale"
-msgstr "Kan LC_COLLATE niet op de standaard-locale instellen"
+msgstr "Kan LC_COLLATE niet op de standaard-taalregio instellen"
 
 #: locale/programs/locale.c:224
 #, c-format
 msgid "Cannot set LC_ALL to default locale"
-msgstr "Kan LC_ALL niet op de standaard-locale instellen"
+msgstr "Kan LC_ALL niet op de standaard-taalregio instellen"
 
 #: locale/programs/locale.c:500
 #, c-format
@@ -2507,7 +2507,7 @@
 
 #: locale/programs/localedef.c:140
 msgid "Add locales named by parameters to archive"
-msgstr "genoemde locales aan archief toevoegen"
+msgstr "genoemde taalregio's aan archief toevoegen"
 
 #: locale/programs/localedef.c:141
 msgid "Replace existing archive content"
@@ -2515,7 +2515,7 @@
 
 #: locale/programs/localedef.c:143
 msgid "Remove locales named by parameters from archive"
-msgstr "genoemde locales uit archief verwijderen"
+msgstr "genoemde taalregio's uit archief verwijderen"
 
 #: locale/programs/localedef.c:144
 msgid "List content of archive"
@@ -2523,13 +2523,13 @@
 
 #: locale/programs/localedef.c:146
 msgid "locale.alias file to consult when making archive"
-msgstr "te raadplegen aliassenbestand"
+msgstr "te raadplegen aliassenbestand tijdens archivering"
 
 #: locale/programs/localedef.c:151
 msgid "Compile locale specification"
 msgstr ""
 "  \n"
-"Een locale-specificatie compileren."
+"De definitie van een taalregio compileren."
 
 #: locale/programs/localedef.c:154
 msgid ""
@@ -2555,7 +2555,7 @@
 #: locale/programs/localedef.c:599 locale/programs/localedef.c:619
 #, c-format
 msgid "cannot open locale definition file `%s'"
-msgstr "kan locale-definitiebestand '%s' niet openen"
+msgstr "kan taalregiodefinitiebestand '%s' niet openen"
 
 #: locale/programs/localedef.c:285
 #, c-format
@@ -2570,21 +2570,21 @@
 "                       locale path    : %s\n"
 "%s"
 msgstr ""
-"Systeemmap voor tekenskaarten      : %s\n"
-"                repertoire-kaarten : %s\n"
-"                locale-pad         : %s\n"
+"Systeemmap voor tekenskaarten: %s\n"
+"       voor repertoirekaarten: %s\n"
+"       en het taalregiopad is: %s\n"
 "\n"
 "%s"
 
 #: locale/programs/localedef.c:567
 #, c-format
 msgid "circular dependencies between locale definitions"
-msgstr "circulaire afhankelijkheid tussen locale-definities"
+msgstr "circulaire afhankelijkheid tussen taalregiodefinities"
 
 #: locale/programs/localedef.c:573
 #, c-format
 msgid "cannot add already read locale `%s' a second time"
-msgstr "kan de reeds gelezen locale '%s' niet nogmaals toevoegen"
+msgstr "kan de reeds gelezen taalregio '%s' niet nogmaals toevoegen"
 
 #: locale/programs/locarchive.c:88 locale/programs/locarchive.c:261
 #, c-format
@@ -2610,17 +2610,17 @@
 #: locale/programs/locarchive.c:156
 #, c-format
 msgid "failed to create new locale archive"
-msgstr "aanmaken van een nieuw locale-archief is mislukt"
+msgstr "aanmaken van een nieuw taalregio-archief is mislukt"
 
 #: locale/programs/locarchive.c:168
 #, c-format
 msgid "cannot change mode of new locale archive"
-msgstr "kan modus van het nieuwe locale-archief niet wijzigen"
+msgstr "kan modus van het nieuwe taalregio-archief niet wijzigen"
 
 #: locale/programs/locarchive.c:255
 #, c-format
 msgid "cannot map locale archive file"
-msgstr "kan locale-archief niet in het geheugen plaatsen"
+msgstr "kan taalregio-archief niet in het geheugen plaatsen"
 
 #: locale/programs/locarchive.c:331
 #, c-format
@@ -2630,12 +2630,12 @@
 #: locale/programs/locarchive.c:396
 #, c-format
 msgid "cannot extend locale archive file"
-msgstr "kan locale-archiefbestand niet uitbreiden"
+msgstr "kan taalregio-archiefbestand niet uitbreiden"
 
 #: locale/programs/locarchive.c:405
 #, c-format
 msgid "cannot change mode of resized locale archive"
-msgstr "kan modus van aangepast locale-archief niet wijzigen"
+msgstr "kan modus van aangepast taalregio-archief niet wijzigen"
 
 #: locale/programs/locarchive.c:413
 #, c-format
@@ -2645,17 +2645,17 @@
 #: locale/programs/locarchive.c:466
 #, c-format
 msgid "cannot open locale archive \"%s\""
-msgstr "kan locale-archief '%s' niet openen"
+msgstr "kan taalregio-archief '%s' niet openen"
 
 #: locale/programs/locarchive.c:471
 #, c-format
 msgid "cannot stat locale archive \"%s\""
-msgstr "kan status van locale-archief '%s' niet opvragen"
+msgstr "kan status van taalregio-archief '%s' niet opvragen"
 
 #: locale/programs/locarchive.c:490
 #, c-format
 msgid "cannot lock locale archive \"%s\""
-msgstr "kan locale-archief '%s' niet vergrendelen"
+msgstr "kan taalregio-archief '%s' niet vergrendelen"
 
 #: locale/programs/locarchive.c:513
 #, c-format
@@ -2665,19 +2665,19 @@
 #: locale/programs/locarchive.c:573
 #, c-format
 msgid "locale '%s' already exists"
-msgstr "locale '%s' bestaat al"
+msgstr "taalregio '%s' bestaat al"
 
 #: locale/programs/locarchive.c:804 locale/programs/locarchive.c:819
 #: locale/programs/locarchive.c:831 locale/programs/locarchive.c:843
 #: locale/programs/locfile.c:344
 #, c-format
 msgid "cannot add to locale archive"
-msgstr "kan niet aan locale-archief toevoegen"
+msgstr "kan niet aan taalregio-archief toevoegen"
 
 #: locale/programs/locarchive.c:998
 #, c-format
 msgid "locale alias file `%s' not found"
-msgstr "kan locale-aliassenbestand '%s' niet vinden"
+msgstr "kan taalregio-aliassenbestand '%s' niet vinden"
 
 #: locale/programs/locarchive.c:1142
 #, c-format
@@ -2702,7 +2702,7 @@
 #: locale/programs/locarchive.c:1233
 #, c-format
 msgid "incomplete set of locale files in \"%s\""
-msgstr "onvolledige verzameling van locale-bestanden in '%s'"
+msgstr "onvolledige verzameling van taalregiobestanden in '%s'"
 
 #: locale/programs/locarchive.c:1297
 #, c-format
@@ -2712,7 +2712,7 @@
 #: locale/programs/locarchive.c:1367
 #, c-format
 msgid "locale \"%s\" not in archive"
-msgstr "locale '%s' zit niet in archief"
+msgstr "taalregio '%s' zit niet in het archief"
 
 #: locale/programs/locfile.c:132
 #, c-format
@@ -2721,7 +2721,7 @@
 
 #: locale/programs/locfile.c:252
 msgid "syntax error: not inside a locale definition section"
-msgstr "syntaxfout: niet binnen een locale-definitie-sectie"
+msgstr "syntaxfout: niet binnen een taalregiodefinitie-sectie"
 
 #: locale/programs/locfile.c:626
 #, c-format
@@ -2744,7 +2744,7 @@
 
 #: locale/programs/locfile.c:786
 msgid "locale name should consist only of portable characters"
-msgstr "een locale-naam mag alleen uit overdraagbare tekens bestaan"
+msgstr "een taalregionaam mag alleen uit overdraagbare tekens bestaan"
 
 #: locale/programs/locfile.c:805
 msgid "no other keyword shall be specified when `copy' is used"
@@ -4356,59 +4356,59 @@
 
 #: posix/getopt.c:571 posix/getopt.c:587
 #, c-format
-msgid "%s: option '%s' is ambiguous\n"
+msgid "%s: option `%s' is ambiguous\n"
 msgstr "%s: optie '%s' is niet eenduidig\n"
 
 #: posix/getopt.c:620 posix/getopt.c:624
 #, c-format
-msgid "%s: option '--%s' doesn't allow an argument\n"
+msgid "%s: option `--%s' doesn't allow an argument\n"
 msgstr "%s: optie '--%s' staat geen argument toe\n"
 
 #: posix/getopt.c:633 posix/getopt.c:638
 #, c-format
-msgid "%s: option '%c%s' doesn't allow an argument\n"
+msgid "%s: option `%c%s' doesn't allow an argument\n"
 msgstr "%s: optie '%c%s' staat geen argument toe\n"
 
 #: posix/getopt.c:681 posix/getopt.c:700 posix/getopt.c:1016
 #: posix/getopt.c:1035
 #, c-format
-msgid "%s: option '%s' requires an argument\n"
+msgid "%s: option `%s' requires an argument\n"
 msgstr "%s: optie '%s' vereist een argument\n"
 
 #: posix/getopt.c:738 posix/getopt.c:741
 #, c-format
-msgid "%s: unrecognized option '--%s'\n"
+msgid "%s: unrecognized option `--%s'\n"
 msgstr "%s: onbekende optie '--%s'\n"
 
 #: posix/getopt.c:749 posix/getopt.c:752
 #, c-format
-msgid "%s: unrecognized option '%c%s'\n"
+msgid "%s: unrecognized option `%c%s'\n"
 msgstr "%s: onbekende optie '%c%s'\n"
 
 #: posix/getopt.c:804 posix/getopt.c:807
 #, c-format
-msgid "%s: illegal option -- '%c'\n"
+msgid "%s: illegal option -- %c\n"
 msgstr "%s: ongeldige optie -- %c\n"
 
 #: posix/getopt.c:813 posix/getopt.c:816
 #, c-format
-msgid "%s: invalid option -- '%c'\n"
+msgid "%s: invalid option -- %c\n"
 msgstr "%s: ongeldige optie -- %c\n"
 
 #: posix/getopt.c:868 posix/getopt.c:884 posix/getopt.c:1088
 #: posix/getopt.c:1106
 #, c-format
-msgid "%s: option requires an argument -- '%c'\n"
+msgid "%s: option requires an argument -- %c\n"
 msgstr "%s: optie vereist een argument -- %c\n"
 
 #: posix/getopt.c:937 posix/getopt.c:953
 #, c-format
-msgid "%s: option '-W %s' is ambiguous\n"
+msgid "%s: option `-W %s' is ambiguous\n"
 msgstr "%s: optie '-W %s' is niet eenduidig\n"
 
 #: posix/getopt.c:977 posix/getopt.c:995
 #, c-format
-msgid "%s: option '-W %s' doesn't allow an argument\n"
+msgid "%s: option `-W %s' doesn't allow an argument\n"
 msgstr "%s: optie '-W %s' staat geen argument toe\n"
 
 #: posix/regcomp.c:135
@@ -5345,7 +5345,7 @@
 #. TRANS A file that isn't a directory was specified when a directory is required.
 #: sysdeps/gnu/errlist.c:229
 msgid "Not a directory"
-msgstr "Niet een map"
+msgstr "Is geen map"
 
 #. TRANS File is a directory; you cannot open a directory for writing,
 #. TRANS or create or remove hard links to it.

Modified: fsf/trunk/libc/sysdeps/unix/opendir.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/opendir.c (original)
+++ fsf/trunk/libc/sysdeps/unix/opendir.c Mon Mar 31 00:05:31 2008
@@ -171,6 +171,8 @@
 	goto lose;
     }
 
+  const size_t default_allocation = (BUFSIZ < sizeof (struct dirent64)
+				     ? sizeof (struct dirent64) : BUFSIZ);
   size_t allocation;
 #ifdef _STATBUF_ST_BLKSIZE
   if (__builtin_expect ((size_t) statp->st_blksize >= sizeof (struct dirent64),
@@ -178,20 +180,30 @@
     allocation = statp->st_blksize;
   else
 #endif
-    allocation = (BUFSIZ < sizeof (struct dirent64)
-		  ? sizeof (struct dirent64) : BUFSIZ);
+    allocation = default_allocation;
 
   DIR *dirp = (DIR *) malloc (sizeof (DIR) + allocation);
   if (dirp == NULL)
-  lose:
-    {
-      if (close_fd)
-	{
-	  int save_errno = errno;
-	  close_not_cancel_no_status (fd);
-	  __set_errno (save_errno);
+    {
+#ifdef _STATBUF_ST_BLKSIZE
+      if (allocation == statp->st_blksize
+	  && allocation != default_allocation)
+	{
+	  allocation = default_allocation;
+	  dirp = (DIR *) malloc (sizeof (DIR) + allocation);
 	}
-      return NULL;
+      if (dirp == NULL)
+#endif
+      lose:
+	{
+	  if (close_fd)
+	    {
+	      int save_errno = errno;
+	      close_not_cancel_no_status (fd);
+	      __set_errno (save_errno);
+	    }
+	  return NULL;
+	}
     }
 
   dirp->fd = fd;