From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 2AB6D38582AC for ; Tue, 12 Dec 2023 09:08:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2AB6D38582AC Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 2AB6D38582AC Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702372092; cv=none; b=N6WQsprCzez+XFKRp5W2zteRyFNBl9XAtGyw+XPnacKxbJMD2QV2fhKhk/d6DNOvjBk5v7RUoV4razjTad9MubCAquNVj9mQP996TTvpFK+wOxs8y2xohtWncjs1iUqWLQFfF8V0FmmWxGFLDqj/tGY1AlgrDfFbPo2C2mAe54E= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702372092; c=relaxed/simple; bh=a/L+3lWxymPhBM9KLBXaZ/7F25bWvE0+h9FnorGgOKg=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=igPFiEPrEL+0sXdrquEh9BpCTe0ZhhtzxBUz7McVF+fBUCaOQEhnpWQ9h7h5p+E8BmFb4gRQDMj25v3zNuWrhS8icUYKwHnziOUKl34QhfcfLTzrXDSSntdBQiikMszeuuPlPbCUq0cqq8uJTNDtVxCHYD91p5So4XuGLN+KO0g= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702372088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=zxU2noY4udahKP1BAcbXMvbASWVKJOxnmWuu5YncgEI=; b=Jkv55N1t4YMDfdamSYae3I8lWKg/dOJCtshtJGuz+kcgFa1Z4pSfM9bLTrIm2E+G7nDJM0 MkrcCQtKQ1kcPdZykJQTD71Bm2kZhqO0l2gEKaieIzm1m9z5077UtBPrptZc/NLjk//aTC K7V5jvEkBsAP/G5f0biggZHRSi1WnGY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-496-FtgbCDTPObi9BHOH6KTrdw-1; Tue, 12 Dec 2023 04:08:06 -0500 X-MC-Unique: FtgbCDTPObi9BHOH6KTrdw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0B6FA830F2F; Tue, 12 Dec 2023 09:08:06 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.100]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 48408492BE6; Tue, 12 Dec 2023 09:08:05 +0000 (UTC) From: Florian Weimer To: Bruno Haible Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] intl: Treat C.UTF-8 locale like C locale, part 2 (BZ# 16621) References: <20230910191739.1083016-1-bruno@clisp.org> Date: Tue, 12 Dec 2023 10:08:03 +0100 In-Reply-To: <20230910191739.1083016-1-bruno@clisp.org> (Bruno Haible's message of "Sun, 10 Sep 2023 21:17:39 +0200") Message-ID: <87bkavn5zg.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: * Bruno Haible: > The previous commit was incomplete: gettext() still returns a translation > if the file /usr/share/locale/C/LC_MESSAGES/.mo exists. This patch > prohibits the translation also in this case. > > * gettext-runtime/intl/dcigettext.c (DCIGETTEXT): Treat C. locale > like the C locale. > --- > intl/dcigettext.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/intl/dcigettext.c b/intl/dcigettext.c > index 27063886d2..fb69bbf94b 100644 > --- a/intl/dcigettext.c > +++ b/intl/dcigettext.c > @@ -691,9 +691,10 @@ DCIGETTEXT (const char *domainname, const char *msgid1, const char *msgid2, > continue; > } > > - /* If the current locale value is C (or POSIX) we don't load a > - domain. Return the MSGID. */ > - if (strcmp (single_locale, "C") == 0 > + /* If the current locale value is "C" or "C." or "POSIX", > + we don't load a domain. Return the MSGID. */ > + if ((single_locale[0] == 'C' > + && (single_locale[1] == '\0' || single_locale[1] == '.')) > || strcmp (single_locale, "POSIX") == 0) > break; These arguments: > * The wiki page https://sourceware.org/glibc/wiki/Proposals/C.UTF-8 states > "It shall be the C locale but with UTF-8 encodings." > and > "These will be the same as C... LC_MESSAGES" > > The C locale has the property that gettext() returns the msgid in all cases, > regardless of what files are on disk and regardless of the values of any > environment variables. > > If the C.UTF-8 has the property that gettext() returns msgid only if there > is no translation catalog at /usr/share/locale/C/LC_MESSAGES/.mo, > it is *not* the same as "the C locale but with UTF-8 encodings". > > * We have this rule, that gettext() returns the msgid when the locale is the > "C" locale, because > - the POSIX standard specifies the precise output of some programs (e.g. > 'diff') in the C locale, and > - we wanted, from the beginning in 1995, that gettext() can be used in > the source code of these programs, without an explicit check for the > locale. > It is possible that, in the long run, POSIX adopts the C.UTF-8 locale, > since several platforms already have it: glibc, musl libc, FreeBSD, NetBSD, > OpenBSD, Cygwin, Android. > When this happens, we want that the maintainers of 'diff' etc. can continue > to use gettext(), without introducing an explicit check for the locale. convined me, so: Reviewed-by: Florian Weimer I'll push it for you. Thanks, Florian