Re: 8.0.0beta1: make check fails on solaris8 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: 8.0.0beta1: make check fails on solaris8
Date
Msg-id 4909.1092233563@sss.pgh.pa.us
Whole thread Raw
In response to 8.0.0beta1: make check fails on solaris8  (Martin Münstermann <mmuenstermann@betrusted.com>)
Responses Re: 8.0.0beta1: make check fails on solaris8  (Martin Münstermann <mmuenstermann@betrusted.com>)
List pgsql-bugs
>> My best guess about it is that strtod() is actively broken on your
>> platform, and is recognizing the "infinity" input but returning an
>> incorrect endptr.  I seem to recall that we've heard of such bugs
>> before.  Can you check for any updates from Sun that might affect
>> strtod()?

Hmm, take a look at this:
http://tcl.apache.org/sources/tcl/compat/fixstrtod.c.html

So at least the Tcl guys are aware of an issue.  It looks from this code
like they expect Solaris strtod to return an endptr one past the end of
the string.  Which would explain the apparently random behavior, because
that would be uninitialized memory --- if it happened to contain a zero
then we'd not register a complaint, but otherwise we would.

So forget my previous proposed patch and try this one:

    /* skip leading whitespace */
    while (*num != '\0' && isspace((unsigned char) *num))
        num++;

    errno = 0;
    val = strtod(num, &endptr);

+    if (endptr != num && endptr[-1] == 0)
+        endptr--;

    /* did we not see anything that looks like a double? */


            regards, tom lane

pgsql-bugs by date:

Previous
From: Fabien COELHO
Date:
Subject: broken contrib/dbsize in cvs head?
Next
From: Andreas Pflug
Date:
Subject: Re: broken contrib/dbsize in cvs head?