<div dir="ltr">Hi all,
<div><br></div><div>I ran into trouble with readlink as can be seen in <a href="http://trac.osgeo.org/gdal/ticket/5340">http://trac.osgeo.org/gdal/ticket/5340</a>. I'm working with a system where the run directory is all symbolic links. So if I have nonsquare.vrt refering to "./small.raw", readlink of nonsquare.vrt will end up being in a totally different directory than the small.raw file.</div>
<div><br></div><div>So... That begs the question of the purpose of dereferencing symbolic links using readlink (e.g. <a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/vrt/vrtdataset.cpp#L687">http://trac.osgeo.org/gdal/browser/trunk/gdal/frmts/vrt/vrtdataset.cpp#L687</a>). Is this done just for performance on filesystems where symbolic links might be a performance hit (e.g. nfs file systems over slow networks and an OS that does not do a good job caching)? Or is there something else important that I'm missing?</div>
<div><br></div><div>I see 4 places where readlink is used:</div><div><br></div><div><div>./ogr/ogrsf_frmts/generic/ogrsfdriverregistrar.cpp: int nBytes = readlink(pszName, szPointerFilename, sizeof(szPointerFilename));</div>
<div>./gcore/gdalopeninfo.cpp: int nBytes = readlink(pszFilename, szPointerFilename, sizeof(szPointerFilename));</div><div>./port/cpl_getexecpath.cpp: nResultLen = readlink( osExeLink, pszPathBuf, nMaxLength );</div>
<div>./frmts/vrt/vrtdataset.cpp: int bufferSize = readlink(currentVrtFilename, filenameBuffer, sizeof(filenameBuffer));</div><div><br></div></div><div>ogrsfdriverregistar.cpp looks like a possible issue.</div><div>
<br></div><div><a href="http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/generic/ogrsfdriverregistrar.cpp#L250">http://trac.osgeo.org/gdal/browser/trunk/gdal/ogr/ogrsf_frmts/generic/ogrsfdriverregistrar.cpp#L250</a><br>
</div><div><br></div><div>I see that sort of works...</div><div><br></div><div><div>ogrinfo my_remote_poly.shp </div><div>ERROR 4: Unable to open /vsicurl/<a href="http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.shp">http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.shp</a> or /vsicurl/<a href="http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.SHP">http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.SHP</a>.</div>
<div>Had to open data source read-only.</div><div>INFO: Open of `my_remote_poly.shp'</div><div> using driver `ESRI Shapefile' successful.</div><div>INFO: Internal data source name `/vsicurl/<a href="http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.shp">http://svn.osgeo.org/gdal/trunk/autotest/ogr/data/poly.shp</a>'</div>
<div> different from user name `my_remote_poly.shp'.</div><div>1: poly (3D Polygon)</div></div><div><br></div><div>I'm thinking that I should just disable readlink entirely. Alternatively, hhould there be a flag that controls readlink just for working with vrt's or a runtime ConfigSetting that could turn on/off readlink?</div>
<div><br></div><div>Any thoughts would be appreciated!</div><div><br></div><div>Thanks,</div><div>-kurt</div></div>