Opened 15 years ago
Last modified 9 years ago
#767 new enhancement
g.copy only issues warning when destination exists
Reported by: | ferrouswheel | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 6.4.6 |
Component: | Default | Version: | svn-develbranch6 |
Keywords: | g.copy, g.rename | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
g.copy rast=src,dst
When dst already exists, g.copy only issues a "WARNING" message and returns 0 without copying src to dst. This behaviour is erroneous, is should give an "ERROR" message and return non-zero (unless an overwrite flag is enabled).
Change History (8)
follow-up: 4 comment:1 by , 13 years ago
comment:3 by , 13 years ago
Keywords: | g.copy g.rename added |
---|---|
Milestone: | 6.4.0 → 6.4.2 |
Priority: | normal → major |
follow-up: 5 comment:4 by , 13 years ago
Replying to neteler:
What is the reason that there is only G_warning()?
I don't know, but it seems to have been like that since forever.
G_fatal_error() seems like the right thing to do AFAICT.
Hamish
comment:5 by , 13 years ago
Replying to hamish:
G_fatal_error() seems like the right thing to do AFAICT.
One issue is that, with multiple map names, it will abort at the first case where the destination exists. Maps prior to that will be copied, maps after that won't be.
The existing behaviour is more consistent: maps which can be copied are copied; errors only affect the specific copy operation to which they apply.
The existing behaviour differs from modules which use ->gisprompt="new,..." (which g.copy can't do because of its interface; see #178). With those, the parser checks either that --overwrite was used or that none of the "new" maps exist. If the check fails, it fails in G_parser(), before the module starts to do any work.
If we want the "usual" behaviour from g.copy and g.rename, they will need to loop over the inputs twice: the first time to check for errors, the second time to actually perform the copy/rename operations.
comment:6 by , 12 years ago
Milestone: | 6.4.2 → 6.4.4 |
---|---|
Type: | defect → enhancement |
comment:8 by , 9 years ago
Milestone: | 6.4.4 → 6.4.6 |
---|
Confirmed.
What is the reason that there is only G_warning()?
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/general/manage/cmd/copy.c#L84