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