<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>yes, GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR is the trick to both
disable directory listing and preventing individual file probing.</p>
<p>Javier, do you have GDAL_DISABLE_READDIR_ON_OPEN=YES also set?
Otherwise if GDAL_DISABLE_READDIR_ON_OPEN is not set, GDAL will
normally issue a S3 directory listing call, which should prevent
later individual file probing (if we have the list of files in the
directory, we just need to check the list, and don't need to do
individual open()/GET attempts). But that director listing is
sometimes still undesirable if doing it in a folder with a large
number of files hence GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR. Or
maybe you don't have directory listing permission in that
folder/bucket?</p>
<p>Related to that, Howard filed
<a class="moz-txt-link-freetext" href="https://github.com/OSGeo/gdal/issues/9443">https://github.com/OSGeo/gdal/issues/9443</a> recently. but it is not
that simple to find a different default behavior that doesn't
result in functional regressions.</p>
<p>I was wondering if a solution, restricted to COG, couldn't be to
put a hint in the so-called "header ghost area"
(<a class="moz-txt-link-freetext" href="https://gdal.org/drivers/raster/cog.html#header-ghost-area">https://gdal.org/drivers/raster/cog.html#header-ghost-area</a>), like
SIDECAR_FILES=NO, that could be used by the GTiff driver. Not sure
if it is the right way to address the issue however (and would
work only for new files of course, and probably only on explicit
user choice at file creation, because there could be scenarios
where a user would want to provide side car files)<br>
</p>
<div class="moz-cite-prefix">Le 27/04/2024 à 13:12, Michael Smith
via gdal-dev a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:09D60B3C-3CEA-430D-AB8A-B1F82E7F0735@gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="Generator"
content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;
mso-ligatures:none;}div.WordSection1
{page:WordSection1;}</style>
<div class="WordSection1">
<p class="MsoNormal">Javier,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">You can control with the
GDAL_DISABLE_READDIR_ON_OPEN configuration parameter (<a
href="https://gdal.org/user/configoptions.html"
moz-do-not-send="true" class="moz-txt-link-freetext">https://gdal.org/user/configoptions.html</a>).
Typically, I set GDAL_DISABLE_READDIR_ON_OPEN=EMPTY_DIR which
will disable this.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Mike<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">-- <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Michael Smith<o:p></o:p></p>
<p class="MsoNormal">Remote Sensing/GIS Center<o:p></o:p></p>
<p class="MsoNormal">US Army Corps of Engineers<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div
style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:12.0pt;color:black">From: </span></b><span
style="font-size:12.0pt;color:black">gdal-dev
<a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev-bounces@lists.osgeo.org"><gdal-dev-bounces@lists.osgeo.org></a> on behalf of
Javier Jimenez Shaw via gdal-dev
<a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev@lists.osgeo.org"><gdal-dev@lists.osgeo.org></a><br>
<b>Reply-To: </b>Javier Jimenez Shaw
<a class="moz-txt-link-rfc2396E" href="mailto:j1@jimenezshaw.com"><j1@jimenezshaw.com></a><br>
<b>Date: </b>Saturday, April 27, 2024 at 7:01 AM<br>
<b>To: </b>gdal dev <a class="moz-txt-link-rfc2396E" href="mailto:gdal-dev@lists.osgeo.org"><gdal-dev@lists.osgeo.org></a><br>
<b>Subject: </b>[gdal-dev] don't search side car files on
s3 with gdalinfo<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">Hi<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">I am accessing a big file in S3. All
works fine (when I learned how to set the authentication
environment variables), but gdalinfo is checking for a lot
of files that do not exist. I know there is only a GeoTIFF
- COG (no side car files)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">However gdalinfo is trying to find
several side car files, that are not there. S3 returns a
403. It takes its time to search for all those files.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Is there a way to tell to gdalinfo that
it should not check for those files?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Bonus: QGIS is also taking time to open
it (just using 'qgis' instead of 'gdalinfo' in the command
line). I think it is for the same reason. It there a hack
there as well?<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">$ AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=... AWS_SESSION_TOKEN=... gdalinfo
/vsis3/blah/folder/ortho.tiff<br>
Driver: GTiff/GeoTIFF<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.tiff.aux.xml"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.tiff.aux.xml</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.aux"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.aux</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.AUX"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.AUX</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.tiff.aux"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.tiff.aux</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.tiff.AUX"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.tiff.AUX</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.tiff.ovr"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.tiff.ovr</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.tiff.OVR"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.tiff.OVR</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.tiff.msk"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.tiff.msk</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.tiff.MSK"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.tiff.MSK</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.XML"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.XML</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.xml"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.xml</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.IMD"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.IMD</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.imd"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.imd</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.RPB"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.RPB</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.rpb"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.rpb</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.PVL"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.PVL</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.pvl"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.pvl</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho_rpc.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho_rpc.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho_RPC.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho_RPC.TXT</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho_metadata.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho_metadata.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho_METADATA.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho_METADATA.TXT</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho_MTL.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho_MTL.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho_MTL.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho_MTL.TXT</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/METADATA.DIM"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/METADATA.DIM</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/metadata.dim"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/metadata.dim</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho_metadata.xml"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho_metadata.xml</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho_METADATA.XML"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho_METADATA.XML</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.TXT</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.RPC"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.RPC</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.rpc"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.rpc</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.pass"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.pass</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/ortho.PASS"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/ortho.PASS</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/summary.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/summary.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/SUMMARY.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/SUMMARY.TXT</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/HDRdisplay.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/HDRdisplay.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/HDRdisplay.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/HDRdisplay.TXT</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/HDRho_display.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/HDRho_display.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/HDRho_display.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/HDRho_display.TXT</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/RPCdisplay.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/RPCdisplay.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/RPCdisplay.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/RPCdisplay.TXT</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/RPCho_display.txt"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/RPCho_display.txt</a>:
403<br>
Warning 1: HTTP response code on <a
href="https://blah.s3.amazonaws.com/folder/RPCho_display.TXT"
moz-do-not-send="true" class="moz-txt-link-freetext">https://blah.s3.amazonaws.com/folder/RPCho_display.TXT</a>:
403<br>
Files: /vsis3/blah/folder/ortho.tiff<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">...<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal">.___ ._ ..._ .. . ._. .___ ..
__ . _. . __.. ... .... ._ .__<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
<p class="MsoNormal">_______________________________________________
gdal-dev mailing list <a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a> <o:p></o:p></p>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="https://lists.osgeo.org/mailman/listinfo/gdal-dev">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
<a class="moz-txt-link-freetext" href="http://www.spatialys.com">http://www.spatialys.com</a>
My software is free, but my time generally not.</pre>
</body>
</html>