gdal icon indicating copy to clipboard operation
gdal copied to clipboard

Add VSIFErrorL() and VSIFClearErrL(), robustness fixes in VSICopyFile()

Open rouault opened this issue 1 year ago • 1 comments

Those rationale for this big set of changes is a robustnes fix in VSICopyFile() to detect an error when reading the source file. But it turns out that we have no clean way in the API to distinguish from end-of-file vs error when Read() returns less bytes than requested. Well, we could use Eof() not return true to potentially mean that an error occured, but a number of file systems (e.g /vsigzip/) actually set the Eof flag when an error occured. So to be in known territory, let's fully implement POSIX FILE* API, by adding a Error() and ClearErr() methods that map to POSIX ferror() and clearerr(), and fix implementations where needed. This is a somewhat risky change, and not easy to fully test. MIGRATION_GUIDE.TXT is updated to hint that testing for VSIFEofL() is no longer sufficient to exit a reading loop.

rouault avatar May 15 '24 23:05 rouault

Coverage Status

coverage: 69.131%. remained the same when pulling b1cc25f8b3efca0eb2853fed0324d9e89daa5c84 on rouault:vsiferrorl into 77031d722bb5ba5bde1e94c64b0da0bed9e7229c on OSGeo:master.

coveralls avatar May 16 '24 03:05 coveralls