This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

search locale archive again after alias expansion


If a locale.alias is set up to use some locale definition present only
in the locale archive, it won't work.  This patch fixes it, arranging
for the locale archive to be searched again after alias expansion.

I suppose one could rebuild the locale archive so as to encompass the
alias too, but I guess this isn't always a desirable requirement, and it
sure is confusing to me that the location of the locale definition makes
a difference as to alias processing.

Ok to install?

From: Alexandre Oliva <aoliva@redhat.com>

for  ChangeLog

	* locale/findlocale.c (_nl_find_locale): Retry archive search
	after alias expansion.
---
 locale/findlocale.c |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/locale/findlocale.c b/locale/findlocale.c
index 3c04aa8..845e260 100644
--- a/locale/findlocale.c
+++ b/locale/findlocale.c
@@ -108,15 +108,26 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len,
       if (__builtin_expect (data != NULL, 1))
 	return data;
 
+      /* Nothing in the archive with the given name.  Expanding it as
+	 an alias and retry.  */
+      loc_name = (char *) _nl_expand_alias (*name);
+      if (loc_name != NULL)
+	{
+	  data = _nl_load_locale_from_archive (category, &loc_name);
+	  if (__builtin_expect (data != NULL, 1))
+	    return data;
+	}
+
       /* Nothing in the archive.  Set the default path to search below.  */
       locale_path = _nl_default_locale_path;
       locale_path_len = sizeof _nl_default_locale_path;
     }
+  else
+    /* We really have to load some data.  First see whether the name is
+       an alias.  Please note that this makes it impossible to have "C"
+       or "POSIX" as aliases.  */
+    loc_name = (char *) _nl_expand_alias (*name);
 
-  /* We really have to load some data.  First see whether the name is
-     an alias.  Please note that this makes it impossible to have "C"
-     or "POSIX" as aliases.  */
-  loc_name = (char *) _nl_expand_alias (*name);
   if (loc_name == NULL)
     /* It is no alias.  */
     loc_name = (char *) *name;


-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]