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: 841327 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-87532-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="blkPeLJQ"; 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 3yl77r2S85z9s4s for ; Sun, 26 Nov 2017 22:32:23 +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=L1YClUFH8AfeLJUQJ1kXrVMWPPOXXz1JwDi9w2hGfIL4DXQVb7vh+ FpQfR9+qCm8jJNTKykdyPcF2n4w8e8kwG59JnhgiZnTKLBW3xc1zW1OMsrW/P9m+ oZeWlk5f9geqmvUNwGoN49t/5DkfX3wjJ5MaKNqLLAhW+ocJZAEB8M= 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=npRq/4yQyR0ftPnrbpIBB8KWBk4=; b=blkPeLJQKEUz+N9/5C9+SRl7oAkf 8dKQMW6tguaOl7gfNvMGTiyEY0yj2Z/f0FzVhPEUTEuX8e3ofA76dPhZBk0ZU5Mj 5DGhHTTC3Ivec+bxqk71RUSLzTcu2c0KAaf5sjts2e9Hi0Dxfb9FsywU8dF5kvSG mS7Lvksrkl1TYt8= 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);