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