Opened 12 years ago

Closed 12 years ago

#4583 closed defect (fixed)

VSI Position Error

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 1.9.1
Component: default Version: unspecified
Severity: normal Keywords: VSIL
Cc:

Description

On a file of 200 bytes, this sequence:

VSIFReadL(buf, 500, 1, fp );
VSIFSeekL(fp,0,SEEK_SET);
VSIFReadL(buf2, 1, 500, fp );

does not read anything the second time. The reason is that the file offset in cpl_Vsil_unix_stdio64 does not get updated when the first read fails to read a complete object even though the underlying file pointer has been updated to be at "200". The seek is short circuited and the second read starts at eof.

Presumably the VSI functions need to be more careful to keep the VSI*L offset up to date with that of the underlying implementation.

Change History (2)

comment:1 by warmerdam, 12 years ago

Note: in trunk you can trigger this issue by changing:

VSIFReadL( achHeader, 1, sizeof(achHeader)-1, fp );

to:

VSIFReadL( achHeader, sizeof(achHeader)-1, 1, fp );

in ogrvrtdatasource.cpp and then trying to read autotest/ogr/data/poly_vrt.vrt with ogrinfo.

comment:2 by Even Rouault, 12 years ago

Milestone: 1.9.1
Resolution: fixed
Status: newclosed

Fixed in trunk (r24270) and branches/1.9 (r24271)

Note: See TracTickets for help on using tickets.