From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.2 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by inbox.vuxu.org (OpenSMTPD) with SMTP id e5123a01 for ; Thu, 16 Jan 2020 14:17:52 +0000 (UTC) Received: (qmail 11524 invoked by uid 550); 16 Jan 2020 14:17:49 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 3713 invoked from network); 16 Jan 2020 13:54:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=xeJZS/atoM2ggEBInsVCYY4MRr9kzq0eMjzWYGUyDho=; b=inAgxGBs9g21l793Rccxtgkv8xyi+sR8KZ2e9136QZQ7YR0U2zln31C1AatqEYjFRS 8zPwocoqRq0AiQ0Fs4O+8YMG9amFPulpTxs18wDWo4ng7rqCHz3FIz/0xY2yFlBXVpFk MXuVDarDs3+nrp6rBpq8VQ0U51Wq6bJAthkIhK3S78N6mKpi0MWiDvOE65tKtO+Prnl1 AVPN+nQ0i4Drdc2DmM5N97Bpk/eo1ot8COpjsa9xKxQRnYwmeN3TZycw9WQGIYKWCPHM GrZTIlKX70W4kNUScPenRgDWUdXSvS8odA7QIziP3iWQYIQiuJTDMdoBCG/V2EiS/Zw9 Ts5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=xeJZS/atoM2ggEBInsVCYY4MRr9kzq0eMjzWYGUyDho=; b=L7t3XeNu4CK3trWaQJHF7Fgfly9ghkLlOApRz4msvcY7BWj6EcuB5rkG/a6HCjnXPW KexZMYSdJZ6ZdQMzTkUbw6z3e2tZtSCWg5MdILchMkQGJN93QQl1UdpByiWEIazk19LV IzTW7FJf+7ucgYFJI6X+u6PocD9ZswGLi9dk78H1jFOQrKmdl9ixyc12MY8ml6aCs1Mm U2shhYyVTNuURMLlsLaweKFuMx4u6QLiiDm/pSZG9chQ436MLKd/8gwW171An3AHmJ9a sSF/6N6sBl1kCxwAuf4H21mvXS7iOC49R5RngblTygBtG8F4H6w1rX19FeCnwVQKQHUj vrIA== X-Gm-Message-State: APjAAAUfeFXQX0AtyUQNps52DqelcJYtpe+7zzTx0E8cqJ8OqHKm/HLk MrT8ZderSLF+wVmZyFTf1EvuLN9zRzLHIusm6wFU3Cx79fqjPg== X-Google-Smtp-Source: APXvYqzFa5AShWaoioPFoNlsyN4060WJZBKlySlLbytoNpmHeDsAlZuULgE1lTEeE1QfaiTibTRbz0UqU+Ds2JWlY1Q= X-Received: by 2002:a92:b6d1:: with SMTP id m78mr3428037ill.245.1579182834861; Thu, 16 Jan 2020 05:53:54 -0800 (PST) MIME-Version: 1.0 From: Abdessattar Sassi Date: Thu, 16 Jan 2020 17:53:42 +0400 Message-ID: To: musl@lists.openwall.com Content-Type: multipart/alternative; boundary="000000000000e84b1e059c422702" Subject: [musl] Implementation of built-in locale only allows for 'C.UTF-8' and fails with just 'C' --000000000000e84b1e059c422702 Content-Type: text/plain; charset="UTF-8" Hi, I run into a problem compiling a C library into WASM using emscripten, which in turn uses libmusl. The library calls 'locale_t __newlocale(int mask, const char *name, locale_t loc)' with name being "C". the implementation in musl calls __get_locale() with val being "C": https://github.com/emscripten-core/emscripten/blob/2bca083cbbd5a4133db61fbd74d04f7feecfa907/system/lib/libc/musl/src/locale/locale_map.c#L44 -- extracted from locale_map.c: int builtin = (val[0]=='C' && !val[1]) > || !strcmp(val, "C.UTF-8") > || !strcmp(val, "POSIX"); > if (builtin) { > if (cat == LC_CTYPE && val[1]=='.') > return (void *)&__c_dot_utf8; > return 0; > } If I understand that code correctly, it will return 0 (fail) if the name is just "C" and not "C.UTF-8". Is this the intended behavior? (note that glibc and others do NOT require the .UTF-8, a simple 'C' works just fine and many existing code relies on that). Thank you. *Please Cc: me in reply.* --000000000000e84b1e059c422702 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I run into a problem compiling a C = library into WASM using emscripten, which in turn uses libmusl.=C2=A0
=

The library calls 'locale_t __n= ewlocale(int mask, = const char *name, locale_t loc)' with name being "C". <= /span>
the implementation in musl calls __get_locale() with val bein= g "C":

-- ext= racted from locale_map.c:

int builtin =3D (val[0]=3D=3D'C' && !val[1])
= =C2=A0 =C2=A0 =C2=A0 || !strcmp(val, "C.UTF-8")
=09 =C2=A0 =C2=A0 =C2=A0 || !strcmp(val, "POSIX");
if (builtin) {
=09 =C2=A0 =C2=A0 =C2=A0 if (cat =3D=3D LC_CTYPE && val[1]=3D=3D'.')
=09 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return (void *)&__c_dot_utf8;
=09 =C2=A0 =C2=A0 =C2=A0 return 0;
}

If I understand that code c= orrectly, it will return 0 (fail) if the name is just "C" and not= "C.UTF-8".

Is this the intended behavio= r? (note that glibc and others do NOT require the .UTF-8, a simple 'C&#= 39; works just fine and many existing code relies on that).=C2=A0

Thank you.

Please Cc: me in rep= ly.

--000000000000e84b1e059c422702--