Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6438 closed defect (fixed)

Mistake in the configuration HAVE_SETLOCALE

Reported by: alaindelplanque Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc: Bas Couwenberg

Description

gdal configure doesn't set properly HAVE_SETLOCALE.

In configure.in :

AC_CHECK_FUNC(setlocale)

should be replace by :

AC_CHECK_FUNCS(setlocale)

And in gdal/port/cpl_config.h.in, missing :

/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE

This causes a bug in internal libjson. Without HAVE_SETLOCALE, locale isn't set properly, and geojson coordinates are truncated to int values.

This bug was first reported in qgis: https://hub.qgis.org/issues/14578

Change History (4)

comment:1 by Bas Couwenberg, 7 years ago

Cc: Bas Couwenberg added

comment:2 by Even Rouault, 7 years ago

Resolution: fixed
Status: newclosed

This issue only affects GDAL < 2 (with internal libjson). In GDAL 2, the internal libjson has been patched so that json_parse_double() uses GDAL CPLStrtod() that ignores the locale, and we want to avoid playing with setlocale() because it is not thread-safe.

However this ticket called 2 commits :

  • trunk r33877 "configure: remove useless AC_CHECK_FUNC(setlocale) (#6438)"
  • trunk r33878 "GeoJSON: use CPLThreadLocaleC with external libjson (#6438)"

comment:3 by Even Rouault, 7 years ago

trunk r33880 "Revert r33878: external libjson already does setlocale() stuff (#6438)"

comment:4 by alaindelplanque, 7 years ago

Thank. I have just built gdal dev (internal libjson) + qgis, it work fine.

Note: See TracTickets for help on using tickets.