Ticket #4307 (closed defect: fixed)
gdal 1.7.3 fails to build with -Werror=format-security
| Reported by: | SpamapS | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | ConfigBuild | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
This was found while preparing v1.7.3 for the latest Ubuntu dev release, precise pangolin:
https://bugs.launchpad.net/ubuntu/+source/gdal/+bug/881064
:Open(GDALOpenInfo*)': dodsdataset2.cpp:1078:58: error: format not a string literal and no format arguments [-Werror=format-security] dodsdataset2.cpp: In member function 'virtual CPLErr DODSRasterBand::IReadBlock(int, int, void*)': dodsdataset2.cpp:1643:76: error: format not a string literal and no format arguments [-Werror=format-security] cc1plus: some warnings being treated as errors
make[3]: *** ../o/dodsdataset2.lo Error 1 make[3]: Leaving directory `/«PKGBUILDDIR»/frmts/dods' make[2]: *** [dods-install-obj] Error 2 make[2]: Leaving directory `/«PKGBUILDDIR»/frmts'
and
ogrdodsdatasource.cpp: In member function 'int OGRDODSDataSource::Open(const char*)': ogrdodsdatasource.cpp:159:48: error: format not a string literal and no format arguments [-Werror=format-security] cc1plus: some warnings being treated as errors
make[4]: *** ../o/ogrdodsdatasource.lo Error 1 make[4]: Leaving directory `/build/gdal-LRI9SY/gdal-1.7.3/ogr/ogrsf_frmts/dods' make[3]: *** [dods-target] Error 2 make[3]: Leaving directory `/build/gdal-LRI9SY/gdal-1.7.3/ogr/ogrsf_frmts' make[2]: *** [sublibs] Error 2 make[2]: Leaving directory `/build/gdal-LRI9SY/gdal-1.7.3/ogr'
also in the ruby/swig bindings
gdal_wrap.cpp: In function 'void Debug(const char*, const char*)': gdal_wrap.cpp:1666:34: error: format not a string literal and no format arguments [-Werror=format-security] gdal_wrap.cpp: In function 'void Error(CPLErr, int, const char*)': gdal_wrap.cpp:1669:40: error: format not a string literal and no format arguments [-Werror=format-security] gdal_wrap.cpp: In function 'VALUE _wrap_Driver_create(int, VALUE*, VALUE)':
Minor patches to pass errors as args rather than format strings resolves the issues. Forcing the rebuild of swig/ruby/gdal_wrap.cpp was all that was needed to squelch the error there.

