Opened 4 years ago
Closed 4 years ago
#4872 closed defect (fixed)
Failure on windows - wkt_input
Reported by: | robe | Owned by: | pramsey |
---|---|---|---|
Priority: | blocker | Milestone: | PostGIS 3.2.0 |
Component: | postgis | Version: | master |
Keywords: | Cc: |
Description
I vaguely remember this failing beofre and Raul did something:
-------------- Dependencies -------------- GEOS config: /projects/geos/rel-3.9w64gcc81/bin/geos-config GEOS version: 3.9.2dev GDAL config: /projects/gdal/rel-3.2.1w64gcc81/bin/gdal-config GDAL version: 3.2.1 SFCGAL config: /projects/CGAL/rel-sfcgal-1.3.9w64gcc81/bin/sfcgal-config SFCGAL version: 1.3.8 PostgreSQL config: /projects/postgresql/rel/pg11w64gcc81/bin/pg_config PostgreSQL version: PostgreSQL 11.2 PROJ4 version: 71 Libxml2 config: /projects/libxml/rel-libxml2-2.9.9w64gcc81/bin/xml2-config Libxml2 version: 2.9.9 JSON-C support: yes protobuf support: yes protobuf-c version: 1002001 PCRE support: yes Perl: /usr/bin/perl --------------- Extensions ---------------
Suite: wkt_input Test: test_wkt_in_point ...FAILED 1. cu_in_wkt.c:108 - CU_ASSERT_STRING_EQUAL(r,s)
I'm not sure how long this has been broken because build has been broken because of GEOS 3.10 issue I am having compiling so I flipped to 3.9dev.
Change History (5)
comment:1 by , 4 years ago
comment:2 by , 4 years ago
So, for "reasons" the dtof() function is converting "nan" to 0? Seems like? I guess you could start confirming that by adding a little test up front, make sure what we're seeing is just a straight-up oddness in windows?
s = "nan"; CU_ASSERT(isnan(atof(s))); s = "point(nan 10)"; r = cu_wkt_in(s, WKT_ISO); cu_strtolower(r); CU_ASSERT_STRING_EQUAL(r,s); lwfree(r);
comment:3 by , 4 years ago
Test: test_wkt_in_point ...FAILED 1. cu_in_wkt.c:106 - isnan(atof(s)) 2. cu_in_wkt.c:110 - CU_ASSERT_STRING_EQUAL(r,s) 3. cu_in_wkt.c:116 - CU_ASSERT_STRING_EQUAL(r,s)
comment:4 by , 4 years ago
Here's a patch which should fix your installation and doesn't seem to break mine
diff --git a/liblwgeom/lwin_wkt_lex.l b/liblwgeom/lwin_wkt_lex.l index 273a97966..d301a2259 100644 --- a/liblwgeom/lwin_wkt_lex.l +++ b/liblwgeom/lwin_wkt_lex.l @@ -34,6 +34,17 @@ static void wkt_lexer_unknown() LWDEBUGF(5,"lex: %s", wkt_yytext); \ } while (0); +/* +* Ensure we have a definition of NAN to use when encountering +* NAN tokens. +*/ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <math.h> +#ifndef NAN +#define NAN 0.0/0.0 +#endif %} @@ -57,7 +68,7 @@ static void wkt_lexer_unknown() ([Nn][Aa][Nn])[ \,\)\t\n\r] { LWDEBUG(5,"DOUBLE NAN"); - wkt_yylval.doublevalue = atof(wkt_yytext); + wkt_yylval.doublevalue = NAN; yyless(wkt_yyleng-1); return DOUBLE_TOK; }
Note:
See TracTickets
for help on using tickets.
I added a printf to see the difference and this is what I get
What to do?