#4500 closed defect (fixed)
ogr2ogr: Segmentation fault when using both: -select and -where
Reported by: | peifer | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | 1.8.0 |
Severity: | normal | Keywords: | |
Cc: |
Description
"-select SITECODE" and "-where fid=1" work as expected when used alone, but ogr2ogr segfaults when both options are used in combination. See below. This looks like a bug to me.
> ogrinfo -al -so my.shp INFO: Open of `my.shp' using driver `ESRI Shapefile' successful. Layer name: my Geometry: Polygon Feature Count: 10 Extent: (16.175822, 46.993819) - (17.063785, 47.999705) Layer SRS WKT: GEOGCS["GCS_WGS_1984", DATUM["WGS_1984", SPHEROID["WGS_84",6378137,298.257223563]], PRIMEM["Greenwich",0], UNIT["Degree",0.017453292519943295]] SITECODE: String (9.0) SITENAME: String (240.0) RELEASE_DA: Date (10.0) MS: String (2.0) SITETYPE: String (1.0) POINT_X: Real (19.11) POINT_Y: Real (19.11) Shape_Leng: Real (19.11) Shape_Area: Real (19.11) > ogr2ogr -f kml /dev/null my.shp -where fid=1 > ogr2ogr -f kml /dev/null my.shp -select SITECODE > ogr2ogr -f kml /dev/null my.shp -select SITECODE -where fid=1 Segmentation fault
Attachments (1)
Change History (7)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Could you attach the test my.shp ? I tried to reproduce with one of my shapefiles, but didn't observe anything wrong when running both -select and -where fid=1
(The -select FID,SITECODE is a completely unrelated topic. FID isn't a regular column, so -select cannot find it. FID is only recognized as a special column when using -sql or -where options)
comment:3 by , 12 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Hmm. The testfile my.shp is gone and I can't reproduce the segfault with other shapefiles that I have around. I will close the ticket now. I will re-open it should I manage to re-produce the error.
comment:4 by , 12 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
I managed to re-produce the segfault. Looks to me like some encoding issue.
$ ogr2ogr -f kml /dev/null my1.shp -select SITECODE -where fid=0 Shape: DBF Codepage = LDID/87 for my1.shp Shape: Treating as encoding 'ISO-8859-1'. OGR: OGROpen(my1.shp/0x213f0e0) succeeded as ESRI Shapefile. KML: Attempt to create: /dev/null OGRCT: Source: +proj=laea +lat_0=52 +lon_0=10 +x_0=4321000 +y_0=3210000 +ellps=GRS80 +units=m +no_defs OGRCT: Target: +proj=longlat +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +no_defs Segmentation fault
by , 12 years ago
comment:5 by , 12 years ago
Component: | Utilities → OGR_SF |
---|---|
Milestone: | → 1.8.2 |
Resolution: | → fixed |
Status: | reopened → closed |
Version: | svn-trunk → 1.8.0 |
r23939 /trunk/ (2 files in 2 dirs): Fix segfault when running 'ogr2ogr target src -select AFIELD -where FID=xxx' when the source layer has more than 5 fields (#4500)
r23940 /branches/1.9/gdal/ogr/ogrfeaturequery.cpp: Fix segfault when running 'ogr2ogr target src -select AFIELD -where FID=xxx' when the source layer has more than 5 fields (#4500)
r23941 /branches/1.8/gdal/ogr/ogrfeaturequery.cpp: Fix segfault when running 'ogr2ogr target src -select AFIELD -where FID=xxx' when the source layer has more than 5 fields (#4500)
I forgot to mention that
-select FID,SITECODE -where fid=1 -dialect ogrsql
doesn't help much, as I end up with:Field 'FID' not found in source layer.