Opened 13 years ago
Last modified 10 years ago
#1658 new defect
g.rename, g.copy do not ask for --overwrite, they just do it
Reported by: | hamish | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 6.5.0 |
Component: | Default | Version: | svn-develbranch6 |
Keywords: | g.rename, g.copy, overwrite | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description
Hi,
discovered in devbr6, but may happen in other branches too:
G65> r.mapcalc one=1 100% G65> r.mapcalc two=2 100% G65> g.rename one,two Rename raster <one> to <two> G65> r.info -r two min=1 max=1 G65> echo $GRASS_OVERWRITE G65> r.mapcalc three=3 100% G65> g.copy three,two Copy raster <three@user1> to current mapset as <two> G65> r.info -r two min=3 max=3
I just lost a map :-(
Hamish
Change History (3)
comment:1 by , 13 years ago
comment:3 by , 10 years ago
Please, have a look at a test for g.rename
in version 7 (trunk) and add cases which you think are missing:
Note:
See TracTickets
for help on using tickets.
Replying to hamish:
In 7.0 SVN:
In 6.5, g.copy etc have the same logic (checking module->overwrite), but it doesn't work correctly with 6.5's G_parser(), which needs
at the beginning of the check_overwrite() function.
The overwrite field of the GModule structure serves two purposes:
In 7.0, G_parser() explicitly sets it to zero if --help or similar aren't being used. 6.x doesn't do this, so setting it before calling G_parser() to indicate that --o is accepted will result in it always being set upon return from G_parser().