From patchwork Thu Nov 30 22:43:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 843206 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-87695-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="YNJQTxDa"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ynssC2lkdz9sBd for ; Fri, 1 Dec 2017 09:44:15 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=ePc/WO9sVzFS7SuQOiFz7sQqhKvVBP4uaObIEdMBsI8ybDmTBWljW b/Sqqao4sWHnqH8FbnDOImIuI1Gehatp4rtNjCgy10IlWj0Z8fyq/p1ew0+m2KSH z8NjJ60r8XhVJr7RPbsmcQhnbp4b3P9J5vS3fH3u2RmEPzIywIYQ3E= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=CuwfptNv8yBQfqoFHUNkgmgNtaQ=; b=YNJQTxDa+SnjuSlJc4cDT9MVBfNq KfCZusc7J4ez9T2QnJAH/G5pPyUGi3vkr4yUEHrOG6RSuiXhBDA24EVudxT5cSJR wFnglcFRw1L3y7csp0qvIt3On9ti2kp0wU8X6t2RIDXM4Gx6c5Eql86aHH9XRLu+ xk0A2uBKIRVifds= Received: (qmail 14365 invoked by alias); 30 Nov 2017 22:44:05 -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 14351 invoked by uid 89); 30 Nov 2017 22:44:04 -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, URIBL_RED autolearn=ham version=3.3.2 spammy=Hx-spam-relays-external:120, H*RU:120 X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH v2] ldconfig: set LC_COLLATE to C [BZ #22505] Date: Thu, 30 Nov 2017 23:43:58 +0100 Message-Id: <20171130224358.14578-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 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 | 5 +++++ NEWS | 4 ++++ elf/ldconfig.c | 4 ++++ 3 files changed, 13 insertions(+) It seems the discussion about doing the change in two steps hasn't really converged, so I have implemented the single step version. I also noted that it requires a packaging change doc entry on the Wiki. I'll copy the NEWS entry there once the commit has been applied to master. diff --git a/ChangeLog b/ChangeLog index 8c042b8be6..2899c77fda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-11-30 Aurelien Jarno + + [BZ #22505] + * elf/ldconfig.c (main): Call setlocale to force LC_COLLATE to C. + 2017-11-30 Joseph Myers * sysdeps/m68k/m680x0/fpu/s_llrint.c: Include diff --git a/NEWS b/NEWS index f3fdf9aec5..df699c6997 100644 --- a/NEWS +++ b/NEWS @@ -43,6 +43,10 @@ Major new features: * glibc now implements the memfd_create and mlock2 functions on Linux. +* The ldconfig utility now process `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 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);