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: grass-dev@…
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)

in reply to:  description comment:1 by glynn, 12 years ago

Replying to pvanbosgeo:

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).

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.

comment:2 by martinl, 9 years ago

Milestone: 7.0.07.0.5

comment:3 by martinl, 8 years ago

Still an issue?

comment:4 by pvanbosgeo, 8 years ago

It seems so, yes (I am running grass 7.3svn r69136 now)

comment:5 by neteler, 8 years ago

Milestone: 7.0.57.0.6

comment:6 by neteler, 7 years ago

Milestone: 7.0.67.0.7

comment:7 by martinl, 6 years ago

Milestone: 7.0.77.6.2
Note: See TracTickets for help on using tickets.