Opened 12 years ago
Last modified 6 years ago
#1886 new defect
Error in input may result in r.proj overwriting exising layers
Reported by: | pvanbosgeo | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.6.2 |
Component: | Raster | Version: | svn-trunk |
Keywords: | Cc: | ||
CPU: | x86-64 | Platform: | Unspecified |
Description
Suppose I want to project the layer bio_2 to the current mapset from the location/mapset latlon/climate. I would use:
r.proj input=bio_2 location=latlon mapset=climate dbase=/home/paulo/Data/GRASSdb
The following (erroneous?) statement also works:
r.proj input=bio_2@climate location=latlon mapset=climate dbase=/home/paulo/Data/GRASSdb
There is one important difference. If the layer bio_2 already exist in the current mapset, the first statement will give an error message stating that the layer already exists. Using the second statement, the existing layer is overwritten without any further warning.
Yes, the user is suppose to only give the name of the layer (without the mapset name). But if somebody does make such a mistake (I evidently did), layers might get overwritten unintentionally.
It seems the function takes the whole name, including the '@mapset' when checking if a layer already exists, but then continues to only use the part before '@mapset' when creating the layer.
A more consistent behavior, i.m.h.o., would be if in both steps, the '@mapset' is ignored (which would eliminate the possibility of unwittingly overwriting layers). Alternatively, it should be impossible to use an input name which includes a '@mapset' part (doing so should give an error message).
Change History (7)
comment:1 by , 12 years ago
comment:2 by , 9 years ago
Milestone: | 7.0.0 → 7.0.5 |
---|
comment:5 by , 8 years ago
Milestone: | 7.0.5 → 7.0.6 |
---|
comment:6 by , 7 years ago
Milestone: | 7.0.6 → 7.0.7 |
---|
comment:7 by , 6 years ago
Milestone: | 7.0.7 → 7.6.2 |
---|
Replying to pvanbosgeo:
The most consistent behaviour would be to make the output= parameter non-optional. The parser will automatically generate an error if an "output" map exists and overwrite wasn't enabled.