From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91970 invoked by alias); 8 Feb 2016 12:37:44 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 91952 invoked by uid 89); 8 Feb 2016 12:37:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-94.7 required=5.0 tests=BAYES_20,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=cook, Cook, H*R:D*cygwin.com, setlocale X-HELO: calimero.vinschen.de Received: from ipbcc0d020.dynamic.kabel-deutschland.de (HELO calimero.vinschen.de) (188.192.208.32) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 08 Feb 2016 12:37:42 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id BFF34A80559; Mon, 8 Feb 2016 13:37:39 +0100 (CET) Date: Mon, 08 Feb 2016 12:37:00 -0000 From: Corinna Vinschen To: cygwin@cygwin.com Subject: Re: cygwin 2.4.1: broken ps_AF and ps_AF.utf8 locales Message-ID: <20160208123739.GA12975@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: cygwin@cygwin.com References: <20160202043247.GP31193@mars.tony.develop-help.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="J/dobhs11T7y2rNN" Content-Disposition: inline In-Reply-To: <20160202043247.GP31193@mars.tony.develop-help.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-02/txt/msg00068.txt.bz2 --J/dobhs11T7y2rNN Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1229 On Feb 2 15:32, Tony Cook wrote: > Hi list, >=20 > Simplified to a C program below, calls to sprintf() under the ps_AF > and ps_AF.utf8 locales are returning a value that doesn't match the > length of the formatted string: >=20 > tony@phobos ~ > $ cat ps_AF.c > #include > #include > #include >=20 > int main(int argc, char **argv) { > char buf[100]; > char *loc =3D argc > 1 ? argv[1] : "ps_AF"; > const char *real_loc; > if (!(real_loc =3D setlocale(LC_NUMERIC, loc))) { > perror("setlocale"); > return 1; > } > printf("locale %s\n", real_loc); > size_t len =3D sprintf(buf, "%g", 2.34); > printf("len %zu\n", len); > printf("strlen %zu\n", strlen(buf)); >=20 > return 0; > } Thanks for the testcase. > (and the decimal point under ps_AF on Linux is multi-byte, character > 0x66b or ARABIC DECIMAL SEPARATOR.) As on Cygwin. The problem was that Newlib's printf function didn't take multibyte decimal points into account when computing the field size for the output. I fixed that in the git repo. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --J/dobhs11T7y2rNN Content-Type: application/pgp-signature; name="signature.asc" Content-length: 819 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWuIwTAAoJEPU2Bp2uRE+gan4QAJe0WQAOJDCwTlINsliZqE8q fJsqC8FbJqKzQFTWlJ6fYKzl08h8F6sWVNlbNvUoqtq7aE8ZVaq2TnR1yK+bQuPu jDpfPM8+2Gd/aFewIkb5bRq20FtlFVwnuGsXGwFNhfoRmlsu28G6MBmqALmaLIAE AgnVlc6Bf3o7ezEEwIDSHWT8zSHIrwLyMt4MrbEcdO0TLPFWiqcYGYuCQBkTh+UM MSbN4/Y0KpoYJQnqh8iwHmPtVpRnKn4LzynbQ8UWr8ni37iw/n2TKs6rb8GS7z3W ZJIIZ6hLBlmRLzC12nhYBwu5E6O/Nl4auertrjxFdyM/kceQIrG1/1GVmY29TdUs 1H3c05dhBu32aOagiefclceajkAvEB6TO4D6Gd43R1aSUHpEWer2E4v0diPOHXQu CFuDyGOtK3AS3BdD0CbVe9amxuLJBgk26GPtvgSd1U378SguzedaufnpWnScgq8g FsBTq8INGBLGJ5zee6JXiKR7p4Qht6Vvfe/qTlQIrb+u6wEGr8Fahpts9W4N6162 g8CqL7iCvcPtJhpP+MEE9ALG5xWy38li2kmc9EL8IGnHL+dvH1PMfk1oBxu5xVwz 1EfOmZN+cxD6KdQRHiKGMm84FirDjAjTMlcf8EIOV//AHww4l6iOkw25L5dUtX6P rTZ+fVJe8KvXzS94NbM9 =1ISG -----END PGP SIGNATURE----- --J/dobhs11T7y2rNN--