delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/03/23/16:11:19

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0AC13870890
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1679602238;
bh=LaEdgNYgVu+e78ASwSUA4Zy6iriuzCAYzeERlm8/4H4=;
h=Date:Subject:To:References:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=tSUSU1KAb9QhCW3d2+zFMjmgCAQTFGn0uMKJu5Lmy2a6PAs3jPVURQGYSTasRibHz
sPdeTcXQPAT4Bw8YQXSRgK3yXBgMqukZpZAv0A22dE1fP/cULR1qeEOOrG72L0YwNv
QOpGnYwYtcPgBCOF9cmrkvtUKXfsppJCR9DJpFuA=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A29D53858CDB
Message-ID: <a016d60a-b661-7aca-681d-8f501d54308a@towo.net>
Date: Thu, 23 Mar 2023 21:09:57 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.9.0
Subject: Re: newlocale: Linux incompatibility
To: cygwin AT cygwin DOT com
References: <bd7ebebc-cf90-d509-ef15-11d702a6126c AT cornell DOT edu>
In-Reply-To: <bd7ebebc-cf90-d509-ef15-11d702a6126c@cornell.edu>
X-Provags-ID: V03:K1:n3fDzgWNVoY9F8qMO9TClypH5cw1cfKSwFft1iXsiHxxqlLbTaR
W8ue/2Cudd0gr347MO7//Uxry/rPRYq+fcEe4oQU7Q5WGNC2VfEYfHw+F5l2cqrJ+lAURHE
5cTzVypUxI9eZFquR8dFwAgNMk+SZQYIIiR29yl29K5FO+Xtyt8nDvzfUvIVYjDvBnTL1CQ
+POvBVw25RXS74sTXG2mg==
UI-OutboundReport: notjunk:1;M01:P0:EHQaQsVCAUo=;sfmHgCrjZHgF2tfhcnHXqHD/gHA
RvlN8fVwio0p4Lt9JTNtIA7XLM2FUm6I+8+i73x/zcSRRQagaIE6t8IZAxbRooRDhoVHirohd
BAYsgBOH3cgKtm/CoXSkhxQKpzxZnyiP4WPWpEBkhiyFMdVHyl8KMHEmSElvHeE2hyfsVUGPP
Ari4iOz6bRoCEDkmAeFZphUfWW1zp28z1ZZiypXWHVZKxvr2NwSfX2uBCRVjGQ+2l6iZRp3G0
N4ixezIPx4t3ikDHDx8HeukIXUyn+z4f0XHLgs7quiydre4kwVcA9n2NVHtsq6jq5ti2tOG+F
MD6bOwsUIl5Y59Mg8iy5ngbwapJrTWV+XRKYGqBF+y2Ww4piK9Si8ctO+HN1rUFSkTLS28nV6
w/IXLtS4LzGmAZQchqOk3ZIH2XxqN5iMIMHl46/ei1hQmQ82y7HBqJUwEv09XHjV6IMCRQ6Ej
BKFQz4X3PXTSk4CjfzNuozM7gizSVDu2J307TcJQFHK6mv+xvk/zd5VQY5Ec4JxrVRhBzJZNu
DnDUFORNaNgCSVFZybb2DNxmXFnUhvQl+H5AdATU2sXuykMOi2j5dRfEwp255D81lKHIl9bnW
ZpdXFsXVKl4RqEsZHqY+Y4uv/sied0WmYG4M9LZGAXyNUo2WxQdzSyFXR4r/f3l4ubURja7CP
a+HS802sjWhrxSVqSHovMbX2jnRu55Xc4PwesntEKg==
X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS,
KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL,
RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE,
TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Level: *
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Thomas Wolff via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Thomas Wolff <towo AT towo DOT net>
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 32NKB1eS006118

Am 23.03.2023 um 20:48 schrieb Ken Brown via Cygwin:
> I'm reporting this here rather than the newlib list because the 
> behavior is compatible with Posix but not Linux, so I think it's a 
> Cygwin issue.
>
> Consider the following test case:
>
> $ cat locale_test.c
> #include <stdio.h>
> #include <locale.h>
>
> int main ()
> {
>   const char *locale = "en_DE.UTF-8";
>   locale_t loc = newlocale (LC_COLLATE_MASK | LC_CTYPE_MASK, locale, 0);
>   if (!loc)
>     perror ("newlocale");
>   else
>     printf ("newlocale succeeded on invalid locale %s\n", locale);
> }
>
> $ gcc -o locale_test locale_test.c
>
> $ ./locale_test.exe
> newlocale succeeded on invalid locale en_DE.UTF-8
>
> On Linux, the newlocale call fails with ENOENT, as is documented on 
> the man page.  Posix doesn't say what should happen on an invalid 
> locale, so this is not, strictly speaking, a bug.
So the question is what is an invalid locale. In Linux, locales are only 
valid if explicitly listed somewhere.
This strict behaviour may be a problem. A much better approach is to 
allow any combination of known language_REGIOIN tags with encoding 
indications, to be much more flexible and dynamic.
So if such combinations are considered legal, as in cygwin, this is not 
a bug.

>
> Ken
>
> P.S. I noticed this because of a failing Emacs test.  No one else has 
> reported this test failure, so it seems that newlocale fails on an 
> invalid locale on all platforms supported by Emacs other than Cygwin.

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019