holans / ST-COS

Other
3 stars 0 forks source link

SIGSEGV, Segmentation fault in overlap_matrix() example with GDAL 3.10.0rc1 #2

Open rsbivand opened 4 weeks ago

rsbivand commented 4 weeks ago

With forthcoming GDAL 3.10.0 (rc1), a segfault occurs when overlap_matrix is called in CMD check: stcos.Rcheck.GDAL3100.zip. This does not occur for GDAL 3.9.3: stcos_0.3.1.GDAL393.zip


(gdb) bt
#0  0x00007fffe3778dc2 in OGRSpatialReference::GetSemiMajor(int*) const ()
   from /usr/local/lib64/libgdal.so.36
#1  0x00007fffe372c722 in GetGeodesicAreaOrLength(OGRLineString const*, OGRSpatialReference const*, double*, double*) () from /usr/local/lib64/libgdal.so.36
#2  0x00007fffe372cd99 in OGRLineString::get_GeodesicLength(OGRSpatialReference const*) const () from /usr/local/lib64/libgdal.so.36
#3  0x00007fffe374e4c4 in OGRCurvePolygon::get_GeodesicLength(OGRSpatialReference const*) const () from /usr/local/lib64/libgdal.so.36
#4  0x00007fffe3743c0f in OGRGeometryCollection::get_GeodesicLength(OGRSpatialReference const*) const () from /usr/local/lib64/libgdal.so.36
#5  0x00007fffe5f390f5 in CPL_area (sfc=...) at gdal_geom.cpp:20
#6  0x00007fffe5f1554b in _sf_CPL_area (sfcSEXP=0xd2f5050)
    at RcppExports.cpp:251

There is an indication that the CRS of data("acs_sf") needs attention:

> data("acs_sf")
> dom1 = acs5_2013[1:10,]
old-style crs object detected; please recreate object with a recent sf::st_crs()
old-style crs object detected; please recreate object with a recent sf::st_crs()
> dom2 = acs5_2016[1:10,]
old-style crs object detected; please recreate object with a recent sf::st_crs()
old-style crs object detected; please recreate object with a recent sf::st_crs()

The segfault remains after trying to correct the CRS. @edzer @andrewraim

rsbivand commented 4 weeks ago

My sf::sf_extSoftVersion() on GDAL 3.10.0rc1:

          GEOS           GDAL         proj.4 GDAL_with_GEOS     USE_PROJ_H 
      "3.13.0"       "3.10.0"        "9.5.0"         "true"         "true" 
          PROJ 
       "9.5.0" 

with all else the same (GEOS 3.13.0 and PROJ 9,5.0).

Error unchanged with GDAL 3.10.0rc2.

rsbivand commented 4 weeks ago

The fix in https://lists.osgeo.org/pipermail/gdal-dev/2024-October/059747.html works - https://github.com/r-spatial/sf/issues/2466#issuecomment-2450785843 - will close when sf has been patched.

andrewraim commented 3 weeks ago

@rsbivand

Thanks for the note about this issue. It sounds like the seg fault will be corrected when sf is patched, but that we should recreate the acs_sf data set in stcos. I did the latter in pull request #3; I'll merge this to master and consider a maintenance release to CRAN when the sf updates are ready.

rsbivand commented 3 weeks ago

@andrewraim Sounds sensible. In any case, GDAL 3.10 will propagate slowly to users and CRAN check platforms, but at least sf will be ready when 3.10 starts being used.