[GRASS-dev] Default removal type in g.remove

If I run g.remove with the onle the name of a non-existing
map, I get this:

  g.remove tmp
  Removing raster <tmp>
  WARNING: Raster map <tmp> not found
  WARNING: <tmp> nothing removed

This indicates that g.remove tries to remove a raster of
name "tmp" by default. I am not sure this is good behaviour.
What if the user meant a vector map and forgot to explicitely
type "vect=tmp". In such a case, the wrong map might gets
deleted, instead of just an error message being issued.

Also, the synopsis for g.remove does not indicate that there
is a default removal type.

I am not sure if this is a bug or intended behaviour.

Ben

------
Files attached to this email may be in ISO 26300 format (OASIS Open Document Format). If you have difficulty opening them, please visit http://iso26300.info for more information.

HI,

2011/1/14 Benjamin Ducke <benjamin.ducke@oxfordarch.co.uk>:

I am not sure if this is a bug or intended behaviour.

yes, it's know behaviour. I think it should be changed in GRASS 7.
Please report it on trac.

Martin

--
Martin Landa <landa.martin gmail.com> * http://geo.fsv.cvut.cz/~landa

Benjamin Ducke wrote:

If I run g.remove with the onle the name of a non-existing
map, I get this:

  g.remove tmp
  Removing raster <tmp>
  WARNING: Raster map <tmp> not found
  WARNING: <tmp> nothing removed

This indicates that g.remove tries to remove a raster of
name "tmp" by default. I am not sure this is good behaviour.
What if the user meant a vector map and forgot to explicitely
type "vect=tmp". In such a case, the wrong map might gets
deleted, instead of just an error message being issued.

Also, the synopsis for g.remove does not indicate that there
is a default removal type.

I am not sure if this is a bug or intended behaviour.

It's "default" behaviour. If the first argument doesn't contain an "="
character, it's assumed to be the value of the first registered
option.

This behaviour applies to all modules. Currently, there isn't any way
for individual commands to disable it without resorting to "hacks",
e.g. making the first option a dummy option (which would then show up
in the help output and manual page).

--
Glynn Clements <glynn@gclements.plus.com>