Opened 4 years ago

Closed 3 years ago

#4603 closed defect (fixed)

Windows build failing in shp2pgsql: XError in psSHP->sHooks.FWrite()

Reported by: Algunenano Owned by: pramsey
Priority: high Milestone: PostGIS 3.1.0
Component: utils/loader-dumper Version: master
Keywords: Cc:

Description

From https://winnie.postgis.net:444/job/PostGIS_EDB_Regress_winnie/10146/

There are multiple similar issues:

../loader/Point ........ failed (dumper geog test: dumping loaded table: /projects/postgis/tmp/3.1.0dev_pg12_geos3.8.0_gdal2.4.3w64/dumper.err)
-----------------------------------------------------------------------------
Initializing... 
Done (postgis major version: 3).
Output shape: Point
Dumping: XError in psSHP->sHooks.FWrite() while writing object of 28 bytes to .shp file: No error
Error writing shape 0
-----------------------------------------------------------------------------
 ../loader/PointM ... failed ( wkt test: running shp2pgsql output: /projects/postgis/tmp/3.1.0dev_pg12_geos3.8.0_gdal2.4.3w64/loader.err)
-----------------------------------------------------------------------------

By looking at trunk builds, it seems it started failing at:

Changes
Update the shapelib copy to the latest. References #4591. Required two (detail)
	
Generic Cause

	Revision: e7c352608c6449ef59d0adad095289038ba27343
origin/master

Which makes sense since shp2pgsql and shapelib are related.

Change History (8)

comment:1 by robe, 4 years ago

Owner: changed from robe to pramsey

related to #4591

comment:2 by pramsey, 4 years ago

I'll roll it back out if necessary, I don't have a way to debug this, it's going to have to go into the debugger in windows land.

comment:3 by robe, 4 years ago

I'll try to debug this in coming weeks, so leave it alone for now. As long as you don't backport to 3.0 we'll figure it out before release time.

comment:4 by robe, 4 years ago

Okay as the error says "No Error". It is failing

Dumping: XError in psSHP->sHooks.FWrite() while writing object of 28 bytes to .shp file: No error
Error writing shape 0

The issue is in the shpopen.c file. If I swap with the older it works fine.

Also seems to work fine if I change this line

if ( psSHP->sHooks.FWrite( pabyRec, nRecordSize, 1, psSHP->fpSHP ) ) < 1

to

if ( psSHP->sHooks.FWrite( pabyRec, nRecordSize, 1, psSHP->fpSHP ) ) < 0

it's returning 0 so is being sent into that error loop

Last edited 4 years ago by robe (previous) (diff)

comment:5 by robe, 4 years ago

actually I may be mistaken. about it working with that since the regression tests still seem to be failing - though it is outputing to .shp file now. I'm going to compare between old and new outptu to see wha tis failing. I suspect its a maybe the bytes allocated for writing isn't enough.

comment:6 by Regina Obe <lr@…>, 4 years ago

In 03af80c/git:

Remark out additional guard causing mingw64 to fail. References #4603

comment:7 by robe, 4 years ago

Remarking out the extra guard condition

    if ( psSHP->sHooks.FTell( psSHP->fpSHP ) != nRecordOffset ) {

seems to have fixed mingw64 issue, but haven't investigated what that extra condition is doing to trigger the issue. — e.g. if it's preventing it from falling into the nested if or is causing something extra to be written to the shp. So I'll leave this open for now until I investigate further.

comment:8 by robe, 3 years ago

Resolution: fixed
Status: newclosed

The fix I did I think works. Why it works I have no clue but didn't seem to cause issues for anyone else.

Note: See TracTickets for help on using tickets.