From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/12134 Path: news.gmane.org!.POSTED!not-for-mail From: "A. Wilcox" Newsgroups: gmane.linux.lib.musl.general Subject: wcscoll does not collate properly, even en_US Date: Sun, 26 Nov 2017 15:33:00 -0600 Organization: =?UTF-8?Q?Ad=c3=a9lie_Linux?= Message-ID: <5A1B330C.80107@adelielinux.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5PigkNrNMKDmFc8E9BjTBA1bremkfX5P2" X-Trace: blaine.gmane.org 1511732012 967 195.159.176.226 (26 Nov 2017 21:33:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 26 Nov 2017 21:33:32 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 To: musl@lists.openwall.com Original-X-From: musl-return-12150-gllmg-musl=m.gmane.org@lists.openwall.com Sun Nov 26 22:33:26 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1eJ4YA-0007jw-Ca for gllmg-musl@m.gmane.org; Sun, 26 Nov 2017 22:33:18 +0100 Original-Received: (qmail 32093 invoked by uid 550); 26 Nov 2017 21:33:22 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 32059 invoked from network); 26 Nov 2017 21:33:21 -0000 X-Enigmail-Draft-Status: N1110 Xref: news.gmane.org gmane.linux.lib.musl.general:12134 Archived-At: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --5PigkNrNMKDmFc8E9BjTBA1bremkfX5P2 Content-Type: multipart/mixed; boundary="------------070306020801050707080601" This is a multi-part message in MIME format. --------------070306020801050707080601 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi. My understanding is that musl does not want to support collation in non-English languages (at least, not yet), but collation is supported in American English. glib's test suite is failing on musl now because the locale code is just functional enough to make glib not skip the tests entirely (1.1.16 failed the 'setlocale is giving us the locale we set back' test), yet collation doesn't work. wcscoll is giving the same result as wcscmp. This is wrong; a simple test case is attached. Run on a glibc machine, a FreeBSD machine, and a Solaris machine, it will output: Amy bug cat Gaz Tom On musl it (incorrectly) currently outputs: Amy Gaz Tom bug cat Does this mean my understanding was wrong and musl does not even support AmE collation? This is going to affect everything from `ls` to GUI file managers like Dolphin or Nautilus to email software sorting by sender or subject. Regards, --arw --=20 A. Wilcox (awilfox) Project Lead, Ad=C3=A9lie Linux http://adelielinux.org --------------070306020801050707080601 Content-Type: text/x-csrc; name="wcscoll-test.c" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="wcscoll-test.c" #include /* setlocale */ #include /* wprintf */ #include /* calloc, free, qsort, EXIT_* */ #include /* mbstowcs */ #include /* wcscoll */ static int my_collate(const void *p1, const void *p2) { return wcscoll(*(const wchar_t **)p1, *(const wchar_t **)p2); } int main(void) { char *loc; const char *stuff[5] =3D { "bug", "Amy", "Tom", "Gaz", "cat" }; wchar_t *strs[5]; setlocale(LC_ALL, "en_US.UTF-8"); loc =3D setlocale(LC_ALL, NULL); if(loc =3D=3D NULL || strcmp(loc, "en_US.UTF-8") !=3D 0) { perror("setlocale"); return EXIT_FAILURE; } for(int i =3D 0; i < 5; i++) { strs[i] =3D calloc(sizeof(wchar_t), 4); mbstowcs(strs[i], stuff[i], 3); } qsort(&strs, 5, sizeof(wchar_t *), my_collate); for(int i =3D 0; i < 5; i++) { wprintf(L"%ls\n", strs[i]); free(strs[i]); } return EXIT_SUCCESS; } --------------070306020801050707080601-- --5PigkNrNMKDmFc8E9BjTBA1bremkfX5P2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJaGzMRAAoJEMspy1GSK50UHQ0P/Rhl/kl237b7f5g4xJjYCQ5O GMwUxQnIWDPved13uuOw8Ym7mOF19bjyO3gh9ABY93TISdpeRAomF3ojI4PGAnfC 5rJSrtHxaOwM4mQZUk520lGQgo34zi+cicYl4cXcdfIBIqLv708RhP1Oj3uKibrD hoQ2TptZPIVKagFjJih+U1zd6L8sfZMcPJRLtyXx2mPfYGhz9xQoKulTfimA0wqP ZJIW5BK2CoUylPW0XOt3njU5ap3NnCL2B6jRnZB5MGKeMACum3zCJNmb5rq7EbRp 4mwrTQtFLIHFm5GNdf4M5w4Wc6vZqhABmcUGTI10v6RX6Eew3izPPK7DRIpp41WW 33sMVeWpMmF0KYqDk/pPIwxOuEGark4K9UAXBHN7O+D8Fw60QfPFIpQxfmmLWDp2 cwbKZXIq6dqCIQlNbkH2Z0Ro0ExYSOhk2eVgFcROfRkcV9pFBxO8TP9GiraR1h3A MbRmOZ0y90hFlqSDUcLhStiPkrvR+1aQ1dtzDpyjrDVdgYoTvJS2hEoS2TGcxchZ 5GlYcpNJ0TaZ22Mw9tY7ocBkbb6u4vSPnKKUXMgIO+1aNDhVZiodg8oY4PaGSOnj S9gtQhGot0H4Hl/7M/+wNjp6cByU1q+xglz8JDcTxciEtnV6clPWK/vwwks8dD8D ghkx8fgNPcU8aZDvKzG/ =TduE -----END PGP SIGNATURE----- --5PigkNrNMKDmFc8E9BjTBA1bremkfX5P2--