From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.133]) by sourceware.org (Postfix) with ESMTPS id A29D53858CDB for ; Thu, 23 Mar 2023 20:09:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A29D53858CDB Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=towo.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=towo.net Received: from [192.168.178.72] ([91.65.221.11]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mow4E-1qG6nL0RQ6-00qTDE for ; Thu, 23 Mar 2023 21:09:57 +0100 Message-ID: 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@cygwin.com References: From: Thomas Wolff In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 List-Id: 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 > #include > > 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.