Opened 9 years ago

Closed 5 months ago

Last modified 5 months ago

#2253 closed defect (fixed)

Better i/o error reporting for ogr utilities when lacking read permissions.

Reported by: springmeyer Owned by: warmerdam
Priority: lowest Milestone: 2.2.0
Component: default Version: 1.5.0
Severity: minor Keywords: Error reporting, Permissions, Read access
Cc:

Description

Improved error reporting when ogr cannot open a file for read access would improve overall user experience.

For example a rare case where this would be useful is when using ogrinfo to query a file where the user does not have read permissions.

If the user does not have read permissions on a dataset ogrinfo currently only returns:

FAILURE: Unable to open datasource '/path/to/fn.shp' with the following drivers
...

If the problem is read permission a more explicit error would be useful.

This is a potential use case for PostGIS users when running as the postgres user to load data into a postgres database. If they attempt to call ogrinfo on a file and their postgres user does not have read permissions a more explicit error would remind them of the problem.

This is a very minor issue but would improve the ogr utility.

Change History (7)

comment:1 Changed 9 years ago by springmeyer

I also noticed, just now using the new KML driver, that when ogr2ogr tries to write to a filename that already exists as a folder, it will simply return:

ERROR 4: Failed to create KML file ecoregions.kml.

It makes sense that the ogr2ogr drive cannot overwrite a folder with a file, but it would be great to make this error message more explicit.

comment:2 Changed 9 years ago by warmerdam

Milestone: 1.6.0

comment:3 Changed 5 months ago by Even Rouault

In 37089:

Win32 Open(): set VSISetError() if bSetError (refs #2253)

comment:4 Changed 5 months ago by Even Rouault

In 37090:

ZIP creation: use VSIFOpenExL() to set VSISetError() (refs #2253)

comment:5 Changed 5 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 37091:

DXF, GeoJSON, GML, KML, LIBKML, ODS, Shape, XLSX: report operating system error if file creation fails (fixes #2253)

comment:6 Changed 5 months ago by Even Rouault

Milestone: 2.2.0

comment:7 Changed 5 months ago by Even Rouault

In 37093:

Update expected error for mingw (refs #2253)

Note: See TracTickets for help on using tickets.