Opened 16 years ago

Closed 6 years ago

Last modified 6 years 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 by hobu, 16 years ago

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

comment:3 by Mateusz Łoskot, 16 years ago

Description: modified (diff)
Status: newassigned

comment:4 by Mateusz Łoskot, 15 years ago

Keywords: Shapefile added

comment:5 by warmerdam, 15 years ago


comment:6 by Even Rouault, 15 years ago

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

Fix commited in trunk in r13605

comment:7 by warmerdam, 15 years ago

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 by Even Rouault, 15 years ago

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

comment:9 by warmerdam, 13 years ago

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 by Even Rouault, 6 years ago

Resolution: fixed
Status: newclosed

In 37087:

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

comment:11 by Mateusz Łoskot, 6 years ago

Cheers Even!

comment:12 by Even Rouault, 6 years ago

In 37088:

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

Note: See TracTickets for help on using tickets.