[GRASS-dev] [GRASS GIS] #2510: v.db.addcolumn, bad parser syntax in script causes error, cascades to other modules

#2510: v.db.addcolumn, bad parser syntax in script causes error, cascades to other
modules
-------------------------------------------+--------------------------------
Reporter: isaacullah | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: parser, syntax, error, script | Platform: Linux
      Cpu: x86-64 |
-------------------------------------------+--------------------------------
Hi all,

     In latest version of 7 from GRASS stable Ubuntu PPA archive,
v.db.addcolumn is broken because of a change to the parser code in the
script. The error is:

{{{
ERROR: Sorry, <map> is not a valid parameter
ERROR: Required parameter <output> not set:
         (Name for output vector map)
}}}

But this is because the only options are "output", and "map" and "layer"
don't show up. Looking at the script, I see that the relevant parser code
in the header is this:

{{{
#%module
#% description: Adds one or more columns to the attribute table connected
to a given vector map.
#% keywords: vector
#% keywords: attribute table
#% keywords: database
#%end

#%option G_OPT_V_MAP
#%end

#%option G_OPT_V_FIELD
#% label: Layer number where to add column(s)
#%end

#%option
#% key: columns
#% type: string
#% label: Name and type of the new column(s) ('name type [,name type,
...]')
#% description: Data types depend on database backend, but all support
VARCHAR(), INT, DOUBLE PRECISION and DATE
#% required: yes
#%end
}}}

It's obvious that it's the "G_OPT_V_MAP" and "G_OPT_V_FIELD" that are
causing the error. I've not ever used that syntax in my own scripts (I
wasn't aware that one *cold* do that, actually), but th error is fixed by
changing to the "normal" parser syntax:

{{{
#%module
#% description: Adds one or more columns to the attribute table connected
to a given vector map.
#% keywords: vector
#% keywords: attribute table
#% keywords: database
#%end

#%option
#% key: map
#% type: string
#% gisprompt: old,vector,vector
#% label: Name of map to add columns to the database
#% required: yes
#%end

#%option
#% key: layer
#% type: integer
#% label: Layer number where to add column(s)
#% answer: 1
#% required: yes
#%end

#%option
#% key: columns
#% type: string
#% label: Name and type of the new column(s) ('name type [,name type,
...]')
#% description: Data types depend on database backend, but all support
VARCHAR(), INT, DOUBLE PRECISION and DATE
#% required: yes
#%end
}}}

Not sure if the v.db.addcolumn code was always like that, and the error is
caused by some other change, or if this is due to a recent change to the
script itself, but it seems like an easy fix. This is a serious bug
because it breaks a lot of the other vector tools.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2510&gt;
GRASS GIS <http://grass.osgeo.org>

#2510: v.db.addcolumn, bad parser syntax in script causes error, cascades to other
modules
------------------------------------+---------------------------------------
Reporter: isaacullah | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Keywords: parser, v.db.addcolumn | Platform: Linux
      Cpu: x86-64 |
------------------------------------+---------------------------------------
Changes (by neteler):

  * keywords: parser, syntax, error, script => parser, v.db.addcolumn

Comment:

Replying to [ticket:2510 isaacullah]:
> Hi all,
>
> In latest version of 7 from GRASS stable Ubuntu PPA archive,
v.db.addcolumn is broken because of a change to the parser code in the
script. The error is:
>
> {{{
> ERROR: Sorry, <map> is not a valid parameter
> ERROR: Required parameter <output> not set:
> (Name for output vector map)
> }}}

Is it really the latest you are using there? We have made a major code
cleanup, perhaps
the package was created in the "transition days"?

I just tried, works fine with the really current version:

{{{
GRASS 7.0.0svn (nc_spm_08_grass7):~ > v.db.addcolumn random column="el102
double precision"
GRASS 7.0.0svn (nc_spm_08_grass7):~ > g.version -g
version=7.0.0svn
date=2014
revision=63285M
build_date=2014-12-03
build_platform=x86_64-unknown-linux-gnu
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/2510#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#2510: v.db.addcolumn, bad parser syntax in script causes error, cascades to other
modules
-------------------------+------------------------------------
  Reporter: isaacullah | Owner: grass-dev@…
      Type: defect | Status: new
  Priority: major | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Resolution: | Keywords: parser, v.db.addcolumn
       CPU: x86-64 | Platform: Linux
-------------------------+------------------------------------

Comment (by mlennert):

Can we close this ? I also get the map parameter as expected.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2510#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#2510: v.db.addcolumn, bad parser syntax in script causes error, cascades to other
modules
-------------------------+------------------------------------
  Reporter: isaacullah | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: major | Milestone: 7.0.0
Component: Vector | Version: svn-releasebranch70
Resolution: fixed | Keywords: parser, v.db.addcolumn
       CPU: x86-64 | Platform: Linux
-------------------------+------------------------------------
Changes (by neteler):

* status: new => closed
* resolution: => fixed

Comment:

Closing, reopen if needed.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/2510#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>