From patchwork Tue Jan 6 00:08:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Oliva X-Patchwork-Id: 425455 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 CCB1C14007F for ; Tue, 6 Jan 2015 11:08:39 +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:references:date:in-reply-to :message-id:mime-version:content-type; q=dns; s=default; b=VUjS6 P/mM36kosZiKbjvjyROanfgWp0Ctf6Xh1GuuAgVJZOceh9BySWlJpzkj1GwhrVH4 ChxRj7AbbCC7D0E3w9bF9EpucjHsx6UhQ/H4Djr7berugT21Aj/LKxz9ofvNy+36 GBP+MmvQWUgoI+9qd9aZasuy3boVIf1Qcu80/c= 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:references:date:in-reply-to :message-id:mime-version:content-type; s=default; bh=1MYj7/NL8Jl RwKN2R9h4C5a5mj8=; b=CDBT0YwUKcgLQpGR18M7u8wU5v2+2ap7IJV3AJNBdbQ IbHnyz8TcsVuhlocKk8sy03SeaKlFiEWbKlNMIcltBObcVo9RQ/mzm/gjQa7E3zS S/aA/2boYZ7eA/yVq3k1irmhiFOIDF8hWx06PQzdSBsrLNRbzGb7/LiqYTxeVDIc = Received: (qmail 14330 invoked by alias); 6 Jan 2015 00:08:34 -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 14319 invoked by uid 89); 6 Jan 2015 00:08:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com From: Alexandre Oliva To: Roland McGrath Cc: libc-alpha@sourceware.org Subject: Re: search locale archive again after alias expansion References: <20130918220004.B23492C09F@topped-with-meat.com> Date: Mon, 05 Jan 2015 22:08:23 -0200 In-Reply-To: (Alexandre Oliva's message of "Tue, 09 Dec 2014 15:57:59 -0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 On Dec 9, 2014, Alexandre Oliva wrote: > On Sep 19, 2013, Alexandre Oliva wrote: >> BZ #15969: search locale archive again after alias expansion >> If a locale alias is defined in locale.alias but not in an archive, >> and the referenced locale is only present in the archive, setlocale >> will fail if given the alias name. This is unintuitive. This patch >> fixes it, arranging for the locale archive to be searched again after >> alias expansion. >> for ChangeLog >> [BZ #15969] >> * locale/findlocale.c (_nl_find_locale): Retry archive search >> after alias expansion. >> * NEWS: Updated. > Ping? > https://sourceware.org/ml/libc-alpha/2013-09/msg00566.html Ping? I enclose the entire patch below, for patchwork. (thanks, Joseph) for ChangeLog [BZ #15969] * locale/findlocale.c (_nl_find_locale): Retry archive search after alias expansion. * NEWS: Updated. --- locale/findlocale.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/locale/findlocale.c b/locale/findlocale.c index 22e8b53..dab155a 100644 --- a/locale/findlocale.c +++ b/locale/findlocale.c @@ -156,15 +156,26 @@ _nl_find_locale (const char *locale_path, size_t locale_path_len, if (__glibc_likely (data != NULL)) return data; + /* Nothing in the archive with the given name. Expanding it as + an alias and retry. */ + loc_name = (char *) _nl_expand_alias (*name); + if (loc_name != NULL) + { + data = _nl_load_locale_from_archive (category, &loc_name); + if (__builtin_expect (data != NULL, 1)) + return data; + } + /* Nothing in the archive. Set the default path to search below. */ locale_path = _nl_default_locale_path; locale_path_len = sizeof _nl_default_locale_path; } + else + /* We really have to load some data. First see whether the name is + an alias. Please note that this makes it impossible to have "C" + or "POSIX" as aliases. */ + loc_name = (char *) _nl_expand_alias (*name); - /* We really have to load some data. First see whether the name is - an alias. Please note that this makes it impossible to have "C" - or "POSIX" as aliases. */ - loc_name = (char *) _nl_expand_alias (*name); if (loc_name == NULL) /* It is no alias. */ loc_name = (char *) *name;