Opened 2 years ago

Closed 2 years ago

#6297 closed defect (worksforme)

CopyDataSource causes segmentation fault in python

Reported by: sourish Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 2.0.1
Severity: normal Keywords:
Cc:

Description (last modified by sourish)

Hello,

I'm trying to copy a shapefile data source into memory to add a field. However, it segfaults at the CopyDataSource step. Here's the code I'm using:

from osgeo import ogr, gdal
shapefile = 'TM_WORLD_BORDERS-0.3.shp'
orig_data_source = ogr.Open(shapefile)
driver = ogr.GetDriverByName("Memory")
source_ds = driver.CopyDataSource(orig_data_source, "temp_name")

The shapefile I'm using is from http://thematicmapping.org/downloads/TM_WORLD_BORDERS-0.3.zip and I've used it before for many other purposes. I've tried doing this with gdal 2.0.1 as well as gdal 1.11.2. I'm using python 2.7.6. What am I missing?

Thanks, Sourish

Change History (4)

comment:1 Changed 2 years ago by sourish

Description: modified (diff)

comment:2 Changed 2 years ago by Even Rouault

I've tried the above with latest GDAL 1.11 branch (post 1.11.3), 2.0 branch (post 2.0.1) and trunk, and this works fine for all. Valgrind happy as well.

Which OS ? Self-compiled GDAL or a pre-built binary ? Any stacktrace ?

comment:3 Changed 2 years ago by sourish

It was Ubuntu 14.04, self-compiled GDAL. The issue was that I used the intel compilers to compile GDAL (icc, icpc). I recompiled GDAL with (gcc, g++), and there are no more segfaults. I'm not sure why intel compilers would be a bad choice, but they were.

comment:4 Changed 2 years ago by sourish

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.