Opened 10 years ago

Closed 5 months ago

Last modified 5 months ago

#1465 closed defect (fixed)

Better error report when src and dst datasets are the same

Reported by: Mateusz Łoskot Owned by: warmerdam
Priority: normal Milestone:
Component: Utilities Version: 1.4.0
Severity: minor Keywords: ogr2ogr
Cc: warmerdam, Even Rouault

Description (last modified by Mateusz Łoskot)

Here is example of ogr2ogr use case in which a user specifies the same data set for both: source and destination:

ogr2ogr -s_srs EPSG:2180 -t_srs EPSG:2173 D:\OCK_region.shp D:\OCK_region.shp
ERROR 1: D:\OCK_region.shp is not a directory.
ESRI Shapefile driver failed to create D:\OCK_region.shp

The error message is unclear and user may be confused because it's hard to find out what is the actual reason of the problem.

Enhancement proposal is to make this error message more meaningful.

Change History (11)

comment:2 Changed 10 years ago by hobu

Component: defaultOGR_SF
Description: modified (diff)
Milestone: 1.5.0
Priority: highestnormal
Version: unspecified1.4.0

comment:3 Changed 10 years ago by Mateusz Łoskot

Description: modified (diff)
Status: newassigned

comment:4 Changed 10 years ago by Mateusz Łoskot

Keywords: Shapefile added

comment:5 Changed 9 years ago by warmerdam


comment:6 Changed 9 years ago by Even Rouault

Component: OGR_SFUtilities
Keywords: ogr2ogr added; Shapefile removed
Resolution: fixed
Status: assignedclosed

Fix commited in trunk in r13605

comment:7 Changed 9 years ago by warmerdam

Cc: warmerdam Even Rouault added
Resolution: fixed
Status: closedreopened
Type: enhancementdefect


I don't think the change applied is appropriate. It is perfectly reasonable, for instance, to do an ogr2ogr command from and to the same postgres database instance. I think the change needs to be backed out and some additional consideration given to cases where these is appropriate and not appropriate.

For one thing, the source and destination should only be allowed to be the same when we are operating in -update mode (updating an existing datasource instead of opening a new one).

I'm tempted to suggest that if the source and destination are the same we ought to only open one datasource for both roles, but in fact some datasources may not operate well in that situation (reading from one layer at the same time we are writing to another layer) so I hesitate to push that idea.

comment:8 Changed 9 years ago by Even Rouault

Hum, I didn't think that it could be that complex. Change reverted in r13606.

comment:9 Changed 7 years ago by warmerdam

Milestone: 1.6.4
Owner: changed from Mateusz Łoskot to warmerdam
Status: reopenednew

I'll take this back to account for it being effectively unassigned. I don't think the issue is pressing, so no milestone.

comment:10 Changed 5 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 37087:

ogr2ogr: prevent 'ogr2ogr same.shp same.shp' (fixes #1465)

comment:11 Changed 5 months ago by Mateusz Łoskot

Cheers Even!

comment:12 Changed 5 months ago by Even Rouault

In 37088:

GeoJSON: fix regression in update mode introduced in previous commit (refs #1465)

Note: See TracTickets for help on using tickets.