Opened 6 years ago

Closed 6 years ago

#7150 closed defect (invalid)

'No such file or directory' error when creating a new /vsimem dataset

Reported by: sgillies Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: 2.2.2
Severity: normal Keywords: vsimem error
Cc:

Description (last modified by sgillies)

At https://github.com/mapbox/rio-mbtiles/pull/28/files/ccb61ea4d0052d99941e56851af8aa75d14b1091#diff-f83f374077372c087662900ba74d7cffR220 I am silencing an error-level 'No such file or directory' message on the GDAL error stack that arises when I create a new PNG in /vsimem. It looks like the error is this one: https://github.com/OSGeo/gdal/blob/a1f4cdf70f2c2221215c693be5fb71e864970853/gdal/port/cpl_vsi_mem.cpp#L528.

When I create a new vsimem file, does GDAL probe the virtual filesystem by trying to open file by filename in 'r' mode? If so, could the error level be reduced in normal circumstances to CE_Debug?

Change History (4)

comment:1 by sgillies, 6 years ago

Description: modified (diff)

comment:2 by Even Rouault, 6 years ago

I tried "gdal_translate byte.tif /vsimem/out.png -of PNG" and VSIMemFilesystemHandler::Open() is called at some point with pszAccess="rb" and bSetError=false, so VSIError(VSIE_FileError, "No such file or directory"); is not called. Can you identify the stack trace that leads to pszAccess="rb" and bSetError=true for you ?

comment:3 by sgillies, 6 years ago

I tracked the issue down. I have C code in Rasterio that calls

GDALOpenShared('/vsimem/foo', <GDALAccess>0)

In GDAL 2.2 GDALOpenShared in turn calls GDALOpenEx with the GDAL_OF_VERBOSE_ERROR flag and then VSIFOpenL is called with bSetError true. When there's no file (yet) at '/vsimem/foo', that function fails. I can't find any fault in that and will close this issue. Sorry about the noise.

comment:4 by Even Rouault, 6 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.