00db10
commit 0d822a016b631aef409df5805f58962fe5bbcdc5
00db10
Author: Alexandre Oliva <aoliva@redhat.com>
00db10
Date:   Mon Nov 17 22:00:58 2014 -0200
00db10
00db10
    BZ #15969: search locale archive again after alias expansion
00db10
    
00db10
    If a locale alias is defined in locale.alias but not in an archive,
00db10
    and the referenced locale is only present in the archive, setlocale
00db10
    will fail if given the alias name.  This is unintuitive.  This patch
00db10
    fixes it, arranging for the locale archive to be searched again after
00db10
    alias expansion.
00db10
    
00db10
    for  ChangeLog
00db10
    
00db10
    	[BZ #15969]
00db10
    	* locale/findlocale.c (_nl_find_locale): Retry archive search
00db10
    	after alias expansion.
00db10
00db10
Index: b/locale/findlocale.c
00db10
===================================================================
00db10
--- a/locale/findlocale.c
00db10
+++ b/locale/findlocale.c
00db10
@@ -156,15 +156,26 @@ _nl_find_locale (const char *locale_path
00db10
       if (__builtin_expect (data != NULL, 1))
00db10
 	return data;
00db10
 
00db10
+      /* Nothing in the archive with the given name.  Expanding it as
00db10
+	 an alias and retry.  */
00db10
+      loc_name = (char *) _nl_expand_alias (*name);
00db10
+      if (loc_name != NULL)
00db10
+	{
00db10
+	  data = _nl_load_locale_from_archive (category, &loc_name);
00db10
+	  if (__builtin_expect (data != NULL, 1))
00db10
+	    return data;
00db10
+	}
00db10
+
00db10
       /* Nothing in the archive.  Set the default path to search below.  */
00db10
       locale_path = _nl_default_locale_path;
00db10
       locale_path_len = sizeof _nl_default_locale_path;
00db10
     }
00db10
+  else
00db10
+    /* We really have to load some data.  First see whether the name is
00db10
+       an alias.  Please note that this makes it impossible to have "C"
00db10
+       or "POSIX" as aliases.  */
00db10
+    loc_name = (char *) _nl_expand_alias (*name);
00db10
 
00db10
-  /* We really have to load some data.  First see whether the name is
00db10
-     an alias.  Please note that this makes it impossible to have "C"
00db10
-     or "POSIX" as aliases.  */
00db10
-  loc_name = (char *) _nl_expand_alias (*name);
00db10
   if (loc_name == NULL)
00db10
     /* It is no alias.  */
00db10
     loc_name = (char *) *name;