Would you ask SGI to fix the bug?

+               /* The IRIX strtod() accepts "infinity" or
+                * "-infinity", but it leaves endptr pointing at
+                * "inity" and seems to ignore the negative sign. */


---------------------------------------------------------------------------

John Jorgensen wrote:
> 
> The following bug has been logged online:
> 
> Bug reference:      2192
> Logged by:          John Jorgensen
> Email address:      [EMAIL PROTECTED]
> PostgreSQL version: 8.1.1
> Operating system:   IRIX 6.5.22f
> Description:        misbehaving IRIX strtod() subverts parsing of "infinity"
> Details: 
> 
> When I ran "gmake check", the float4 and float8 tests failed because syntax
> errors were reported for "infinity" and "-infinity". I was able to make the
> test pass by applying the appended patch, made on the model of the existing
> patch for Solaris's strtod() (I understand that IRIX is probably becoming
> rare enough that you might not want to clutter your source tree with the
> patch).
> 
> 
> diff -ur /nobackup/src/postgresql-8.1.1/./src/backend/utils/adt/float.c
> ./src/backend/utils/adt/float.c
> --- /nobackup/src/postgresql-8.1.1/./src/backend/utils/adt/float.c     
> 2005-10-14 20:49:28.000000000 -0600
> +++ ./src/backend/utils/adt/float.c     2006-01-20 10:44:25.000000000 -0600
> @@ -326,6 +326,32 @@
>                 if (endptr != num && endptr[-1] == '\0')
>                         endptr--;
>         }
> +#else
> +#ifdef HAVE_BUGGY_IRIX_STRTOD
> +       else
> +       {
> +               /* The IRIX strtod() accepts "infinity" or
> +                * "-infinity", but it leaves endptr pointing at
> +                * "inity" and seems to ignore the negative sign. */
> +               if (isinf(val))
> +               {
> +                       if (endptr == (num + 3)
> +                           && (! strncasecmp(endptr, "inity",
> sizeof("inity") - 1)))
> +                       {
> +                               endptr += sizeof("inity") - 1;
> +                       }
> +                       if (endptr == (num + 4) && *num == '-'
> +                           && (! strncasecmp(endptr, "inity",
> sizeof("inity") - 1)))
> +                       {
> +                               if (is_infinite(val) == 1)
> +                               {
> +                                       val = -val;
> +                               }
> +                               endptr += sizeof("inity") - 1;
> +                       }
> +               }
> +       }
> +#endif   /* HAVE_BUGGY_IRIX_STRTOD */
>  #endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
>   
>         /* skip trailing whitespace */
> @@ -493,6 +519,32 @@
>                 if (endptr != num && endptr[-1] == '\0')
>                         endptr--;
>         }
> +#else
> +#ifdef HAVE_BUGGY_IRIX_STRTOD
> +       else
> +       {
> +               /* The IRIX strtod() accepts "infinity" or
> +                * "-infinity", but it leaves endptr pointing at
> +                * "inity" and seems to ignore the negative sign. */
> +               if (isinf(val))
> +               {
> +                       if (endptr == (num + 3)
> +                           && (! strncasecmp(endptr, "inity",
> sizeof("inity") - 1)))
> +                       {
> +                               endptr += sizeof("inity") - 1;
> +                       }
> +                       if (endptr == (num + 4) && *num == '-'
> +                           && (! strncasecmp(endptr, "inity",
> sizeof("inity") - 1)))
> +                       {
> +                               if (is_infinite(val) == 1)
> +                               {
> +                                       val = -val;
> +                               }
> +                               endptr += sizeof("inity") - 1;
> +                       }
> +               }
> +       }
> +#endif   /* HAVE_BUGGY_IRIX_STRTOD */
>  #endif   /* HAVE_BUGGY_SOLARIS_STRTOD */
>   
>         /* skip trailing whitespace */
> diff -ur /nobackup/src/postgresql-8.1.1/./src/include/port/irix.h
> ./src/include/port/irix.h
> --- /nobackup/src/postgresql-8.1.1/./src/include/port/irix.h    2006-01-19
> 14:10:38.000000000 -0600
> +++ ./src/include/port/irix.h   2006-01-19 17:10:44.000000000 -0600
> @@ -1 +1,5 @@
> -
> +/*
> + * IRIX 6.5.26f and 6.5.22f (at least) have a strtod() that accepts
> + * "infinity", but leaves endptr pointing to "inity".
> + */
> +#define HAVE_BUGGY_IRIX_STRTOD
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to