delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/08/24/12:07:42

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:content-type:mime-version:subject:from
:in-reply-to:date:content-transfer-encoding:message-id
:references:to; q=dns; s=default; b=Ldl/cI/o9f9ubDKAqhOB61FXlRz6
ZNQ6A7QBGcN1GedE0tutFE5tPGdmSlQMGX2wjvTUF+LdlUYjMvnj/VbZS+a4fTjn
kTXOMkznQ3c1AzWiYD9SS2FZxeyLZqAQSXkTmtZAn0DUi7uFwFfUblaCLCXr654e
A1p+TxBC7HoROP4=
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:content-type:mime-version:subject:from
:in-reply-to:date:content-transfer-encoding:message-id
:references:to; s=default; bh=ySik2mr42ySaFGzZRE0aFVCIfek=; b=V8
4T0MrLYJq7AzVzBA1n3FjrzPlFYH5cjLQ0/85HdvoXJCBoScxVol2o55h0U9E/Pv
EbT9Vg1G2xlIMfVsnfR4YaZrOnMBxNoM9Pjrc2sXTj+KafQECxna7j3Nccejz1gU
YoAVsPmxwuiQNUlE/J2OWQ46wVvggOUh0MS1dQIC4=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=0.3 required=5.0 tests=AWL,BAYES_40,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=UD:cygwin1.dll, cygwin1.dll, cygwin1dll, 00000001
X-HELO: smtp5-g21.free.fr
Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\))
Subject: Re: [ANNOUNCEMENT] TEST RELEASE: Cygwin 2.6.0-0.12
From: Denis Excoffier <cygwin AT Denis-Excoffier DOT org>
In-Reply-To: <announce.20160823165646.GB2261@calimero.vinschen.de>
Date: Wed, 24 Aug 2016 18:07:09 +0200
Message-Id: <3C55C207-0928-4835-84EE-B0F34FAAD647@Denis-Excoffier.org>
References: <announce DOT 20160823165646 DOT GB2261 AT calimero DOT vinschen DOT de>
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id u7OG7ci5018953

> On 2016-08-23 18:56, Corinna Vinschen <corinna-cygwin AT cygwin DOT com> wrote:
> 
> I uploaded a new Cygwin test release 2.6.0-0.12.
> 
...
> 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.
> 
> 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).
> 
> Since this is brand-new code, this code *will* have bugs.
> 
> It would be very helpful if interested developers and Cygwin package
> maintainers could give this new stuff some good testing.
> 

Hello,

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).

I use 2.6.0-0.12 under CYGWIN_NT-6.1-WOW.

Remarks:
- the value given in nptr (1.5) has no impact, even an integer value fails
- uncomment the first line in order to silence the warning at compile time
- the problem was originally found in coreutils-8.25: "seq -w 1 10" produces
the same segmentation fault. In order to reproduce this, you must have
coreutils compiled under a recent cygwin1.dll otherwise the strtod_l
part of the coreutils code is not selected.

Regards,

Denis Excoffier.

% cat gugu.c
//#define _GNU_SOURCE 1
#include <stdio.h>
#include <locale.h>
#include <stdlib.h>

//
int main() {
//
  locale_t locale = newlocale (LC_ALL_MASK, "C", (locale_t) 0);
  if (!locale) return 1;
  char const *nptr = "1.5";
  char **endptr;
  double r1 = strtod (nptr, endptr);
  fprintf (stderr, "r1=%f\n", r1);
  double r2 = strtod_l (nptr, endptr, locale);
  fprintf (stderr, "r2=%f\n", r2);
  return 0;
};
% gcc -O -o gugu gugu.c
gugu.c: In function 'main':
gugu.c:15:15: warning: implicit declaration of function 'strtod_l' [-Wimplicit-function-declaration]
   double r2 = strtod_l (nptr, endptr, locale);
               ^~~~~~~~
% ./gugu
r1=1.500000
Segmentation fault (core dumped)
% cat gugu.exe.stackdump
Exception: STATUS_ACCESS_VIOLATION at eip=6114F2E8
eax=61213530 ebx=6121B0C0 ecx=6121B0D0 edx=6121B040 esi=00000000 edi=61213440
ebp=0028CC88 esp=0028CB68 program=D:\Users\dexcoff1\dexcoff1\cygscf\gugu.exe, pid 61032, thread main
cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
Stack trace:
Frame     Function  Args
0028CC88  6114F2E8 (00000001, 0028CCAC, 80010108, 61007B0A)
0028CD28  61007B6F (00000000, 0028CD84, 61006BA0, 00000000)
End of stack trace
% objdump -d /usr/bin/cygwin1.dll
...
6114f2d0 <___localeconv_l>:
6114f2d0: 53                    push   %ebx
6114f2d1: 8b 44 24 08           mov    0x8(%esp),%eax
6114f2d5: 8b 88 48 01 00 00     mov    0x148(%eax),%ecx
6114f2db: 8b 90 40 01 00 00     mov    0x140(%eax),%edx
6114f2e1: 05 f0 00 00 00        add    $0xf0,%eax
6114f2e6: 8b 19                 mov    (%ecx),%ebx
6114f2e8: 89 18                 mov    %ebx,(%eax)
6114f2ea: 8b 59 04              mov    0x4(%ecx),%ebx
6114f2ed: 8b 49 08              mov    0x8(%ecx),%ecx
6114f2f0: 89 58 04              mov    %ebx,0x4(%eax)
6114f2f3: 89 48 08              mov    %ecx,0x8(%eax)
...
%


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019