[Bug locale/24478] New: Behavior of LOCPATH regarding archive and split-out locales is inconsistent

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[Bug locale/24478] New: Behavior of LOCPATH regarding archive and split-out locales is inconsistent

vries at gcc dot gnu.org
https://sourceware.org/bugzilla/show_bug.cgi?id=24478

            Bug ID: 24478
           Summary: Behavior of LOCPATH regarding archive and split-out
                    locales is inconsistent
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: minor
          Priority: P3
         Component: locale
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
  Target Milestone: ---
             Flags: security-

setlocale in locale/setlocale.c adds _nl_default_locale_path (the default
locale directories) to the default search path even if LOCPATH is set:

  locpath_var = getenv ("LOCPATH");
  if (locpath_var != NULL && locpath_var[0] != '\0')
    {
      if (__argz_create_sep (locpath_var, ':',
                             &locale_path, &locale_path_len) != 0
          || __argz_add_sep (&locale_path, &locale_path_len,
                             _nl_default_locale_path, ':') != 0)
        {
          __libc_rwlock_unlock (__libc_setlocale_lock);
          return NULL;
        }
    }

However, we do not use the locale archive in _nl_find_locale in
locale/findlocale.c if LOCPATH is set:

  /* We really have to load some data.  First we try the archive,
     but only if there was no LOCPATH environment variable specified.  */
  if (__glibc_likely (locale_path == NULL))
    {
      struct __locale_data *data
        = _nl_load_locale_from_archive (category, name);
      if (__glibc_likely (data != NULL))
        return data;

This introduces an inconsistency between the locale archive and broken-out
locales in the default location: If LOCPATH is set, the locale archive is not
used, but the default locale files are.

--
You are receiving this mail because:
You are on the CC list for the bug.