X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=v4oosMOwCQvI1tTwjSUAbSaR6hXDx0WN8PXXaOYtHzSd481h4h+SA XoX+cS3XXop3kJMMYADXtyzbmP6L6BdkEqVLFtFjbeTY4PQRFVu94AvzHZ90ujd3 NJswGLTLCxa/5xKjRUM4F9def0Yu/8y5rmhT0k+lHBI+hN8L55mZ4s= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=XhrskTHbx3fXWIuxh4t5Ht11kqw=; b=Y+iZI96IEmQPl1oHGMeFL5goaIvr Eei3Csh4qJ5HhW1xgU/6l4rgvulsxvnSXUDslWok+bP/grvhbPyy7u0/UP73qzCK +zwxqxPr0iaWDNWY4Iv0b8FFjRNli4GVBO2kODYNrVJCQpZ8rJAwQ3BJKinAyjpw iLszVyJa1zoPnpM= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-101.5 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Denis, 013, 0.13, H*f:sk:3C55C20 X-HELO: drew.franken.de Date: Wed, 24 Aug 2016 19:20:57 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.6.0-0.12 Message-ID: <20160824172057.GB9783@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <3C55C207-0928-4835-84EE-B0F34FAAD647 AT Denis-Excoffier DOT org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="neYutvxvOLaeuPCA" Content-Disposition: inline In-Reply-To: <3C55C207-0928-4835-84EE-B0F34FAAD647@Denis-Excoffier.org> User-Agent: Mutt/1.6.2 (2016-07-01) --neYutvxvOLaeuPCA Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Denis, On Aug 24 18:07, Denis Excoffier wrote: > > On 2016-08-23 18:56, Corinna Vinschen wrote: > >=20 > > I uploaded a new Cygwin test release 2.6.0-0.12. > >=20 > ... > > The 2.6.0 release is going to introducing the locale_t datatype, as well > > as all functions related to locale_t locales and per-thread locales per > > POSIX-1.2008. > >=20 > > So, rather than just providing a single, per-process locale, you can now > > create new locales ("newlocale") and set it as locale for the current > > thread ("uselocale") or use it directly with one of the new functions > > taking a locale_t as parameter (i.e. isalpha_l). > >=20 > > Since this is brand-new code, this code *will* have bugs. > >=20 > > It would be very helpful if interested developers and Cygwin package > > maintainers could give this new stuff some good testing. > >=20 >=20 > Hello, >=20 > I have exercised the new locale-related code and think i found a problem > in the strtod_l function (see small test case in gugu.c below). > [...] > % cat gugu.c > //#define _GNU_SOURCE 1 > #include > #include > #include >=20 > // > int main() { > // > locale_t locale =3D newlocale (LC_ALL_MASK, "C", (locale_t) 0); > if (!locale) return 1; > char const *nptr =3D "1.5"; > char **endptr; > double r1 =3D strtod (nptr, endptr); > fprintf (stderr, "r1=3D%f\n", r1); > double r2 =3D strtod_l (nptr, endptr, locale); > fprintf (stderr, "r2=3D%f\n", r2); > return 0; > }; Uhm... your testcase has two problems: - _GNU_SOURCE *must* be defined to get the declaration of strtod_l. You can't just omit it. The warning is serious. By missing out on the declaration the compiler assumes all arguments are of type int. - The usage of endptr is wrong. Here's how you do it: char *endptr; strtod (nptr, &endptr); strtod and friends expect endptr to be a pointer to a char * which it changes to point to the end of the converted string. By giving an uninitialized char ** to strtod, it will write the result into a random location. However, fixing that doesn't avoid the crash in Cygwin, of course. I see where the problem is. The structure used for the "C" locale is const. On the other hand, the struct also contains the lconv struct which gets overwritten by __localeconv_l. So for the "C" locale this tries to write into a R/O memory region. However, since the "C" locale is fixed *and* its lconv is already initialized, there's no reason at all for __localeconv_l to overwrite it. I'll apply a fix to __localeconv_l to just return its lconv without attempting to write its values when using the "C" locale structure and upload a -0.13 test release shortly. Thanks for the report and especially for providing a testcase! Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --neYutvxvOLaeuPCA Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXvdd5AAoJEPU2Bp2uRE+gmncP+wQJrqRPONGH5lBRhDS7uwLg fGgcRskqfMYW7Sqcg89AxzU1634KsnxFhUOfBkowA3CNC4vzOiE2cI3UJsCRJu/A lC5vXlmWp05cUN8AUV7KORcfpRtbtcX5s68jdRfxuU4uWIsmMT2kSzb6HElfv6jH NzMQ9LOe7vk9Z5gtw2iy/WvYqgMaWxe/GvwQFnOD/+V+XsL6tLcOiPqoHR9S+bKz BZ2K507f0507bibE3u41yGG0DfLF90FZamickru+cfagW1n+/AIt87AfAibv4IRI oI39PyhywtpUjjcJ9SmcB7aobaiJnBxHcFNTLB0csBGxw/W0Kwm+SEoar2S+Ky95 RRxDGG9LTRVcHgIfmgO8NFm1eZ6js6Jn7p9RnTPmfooP9if2IXkCZjn5U/IAv88h XDg49kCj2AEaVgp3XYNMKFpekaGzu0Tpjz1b5Tr5Ui8KLdN1QBC8xnKrZseBPLwG Cg9j6pt0b57qYOlupmFW6HUfWo4YYuYI8zGhhxt3pXoGphIJALd8czo9TkfGHYOI 4hf1yBbHOpBb/nooBZdVkZn37Mpxgm/w8PnLQVx02xD9oLQBqUsThVTXAMB5qVoS ZWLVvUijveqnPAThM2n/oHE+RpU0/L/u8+vBuzErjRPZVfKgrfX0fXlqsoYhVBbh HsoG65Vh7zMmFL3+Krlu =XDiB -----END PGP SIGNATURE----- --neYutvxvOLaeuPCA--