From patchwork Sun Nov 26 11:32:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 24534 Received: (qmail 23245 invoked by alias); 26 Nov 2017 11:32:17 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 23235 invoked by uid 89); 26 Nov 2017 11:32:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KB_WAM_FROM_NAME_SINGLEWORD, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=letter X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] ldconfig: set LC_COLLATE to C Date: Sun, 26 Nov 2017 12:32:04 +0100 Message-Id: <20171126113204.21318-1-aurelien@aurel32.net> 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. Reviewed-by: Carlos O'Donell --- 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);