public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ldconfig: set LC_COLLATE to C
@ 2017-11-26 11:32 Aurelien Jarno
  2017-11-27  8:48 ` Rical Jasan
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Aurelien Jarno @ 2017-11-26 11:32 UTC (permalink / raw)
  To: libc-alpha; +Cc: Aurelien Jarno

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
ldconfig. Prefixing the files that have to be processed last with "z"
or "zz" (as it is often used) therefore doesn't work correctly as "z"
is not always the last letter. For example in the et_EE locale, it is
sorted after the "s".

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.
---
 elf/ldconfig.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 89042351f8..2c01ab567b 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -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);
 
-- 
2.15.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-11-27 20:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-26 11:32 [PATCH] ldconfig: set LC_COLLATE to C Aurelien Jarno
2017-11-27  8:48 ` Rical Jasan
2017-11-27  9:23   ` Aurelien Jarno
2017-11-27  9:45   ` Andreas Schwab
2017-11-27 16:21 ` Joseph Myers
2017-11-27 16:36 ` Carlos O'Donell
2017-11-27 17:02   ` Florian Weimer
2017-11-27 17:15     ` Carlos O'Donell
2017-11-27 17:16       ` Florian Weimer
2017-11-27 17:28         ` Carlos O'Donell
2017-11-27 20:35   ` Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).