]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
ldconfig: set LC_COLLATE to C [BZ #22505]
authorAurelien Jarno <aurelien@aurel32.net>
Sat, 16 Dec 2017 11:25:41 +0000 (12:25 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Sat, 16 Dec 2017 11:25:41 +0000 (12:25 +0100)
ldconfig supports `include' directives and use the glob function to
process them. The glob function sort entries according to the LC_COLLATE
category. When using a standard "include /etc/ld.so.conf.d/*.conf" entry
in /etc/ld.so.conf, the order therefore depends on the locale used to
run ldconfig. A few examples of locale specific order that might be
disturbing in that context compared to the C locale:
- The cs_CZ and sk_SK locales sort the digits after the letters.
- The et_EE locale sorts the 'z' between 's' and 't'.

This patch fixes that by setting LC_COLLATE to C in order to process
files in deterministic order, independently of the locale used to launch
ldconfig.

NOTE: This should NOT be backported to older release branches.

Changelog:
[BZ #22505]
* elf/ldconfig.c (main): Call setlocale to force LC_COLLATE to C.

ChangeLog
NEWS
elf/ldconfig.c

index 67d11c9f9a80584b55436852441495277febcc0c..815e73571d6192dff1e14853afb03c1bf666fb1c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-12-16  Aurelien Jarno  <aurelien@aurel32.net>
+
+       [BZ #22505]
+       * elf/ldconfig.c (main): Call setlocale to force LC_COLLATE to C.
+
 2017-12-16  Rajalakshmi Srinivasaraghavan  <raji@linux.vnet.ibm.com>
 
        * sysdeps/s390/fpu/libm-test-ulps: Update.
diff --git a/NEWS b/NEWS
index 61fed654d89ec6929fc6156b9aac43587326e3e9..0670585b4cb0571d99ed495b79e4b9e1b2776bec 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -63,6 +63,10 @@ Major new features:
 
 * Optimized memcpy, mempcpy, memmove, and memset for sparc M7.
 
+* The ldconfig utility now processes `include' directives using the C/POSIX
+  collation ordering.  Previous glibc versions used locale-specific
+  ordering, the change might break systems that relied on that.
+
 Deprecated and removed features, and other changes affecting compatibility:
 
 * On GNU/Linux, the obsolete Linux constant PTRACE_SEIZE_DEVEL is no longer
index 89042351f88a27ea68a3dff2aa9afea87c30bbdf..2c01ab567bf88161f2bd0493d1dcace4b4c97e61 100644 (file)
@@ -1259,6 +1259,10 @@ main (int argc, char **argv)
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
 
+  /* But keep the C collation.  That way `include' directives using
+     globbing patterns are processed in a locale-independent order.  */
+  setlocale (LC_COLLATE, "C");
+
   /* Set the text message domain.  */
   textdomain (_libc_intl_domainname);