[GRASS-dev] [grass-code I][394] scripts using g.message fail if message contains "="

grass-codei at wald.intevation.org grass-codei at wald.intevation.org
Wed May 9 01:43:27 EDT 2007


code I item #394, was opened at 2007-05-09 17:43
Status: Open
Priority: 5
Submitted By: Hamish Bowman (hamish)
Assigned to: Nobody (None)
Summary: scripts using g.message fail if message contains "=" 
Issue type: module bad feature
Issue status: None
GRASS version: CVS HEAD
GRASS component: None
Operating system: None
Operating system version: 
GRASS CVS checkout date, if applies (YYMMDD): 


Initial Comment:
Hi,

this may be "user error", but g.message will fail if the message contains a "=" char and message= was not given. With message= the parser understands it ok.

This is causing an error in a number of scripts. (I found it in wms.request)



G63 > g.message "foo="
Sorry, <foo> is not a valid parameter

ERROR: Required parameter <message> not set:
    (Text of the message to be printed).

Description:
 Prints message, warning or fatal error the GRASS way. This module should be used in scripts for messages served to user.

Keywords:
 general

Usage:
 g.message [-wed] message=string [--verbose] [--quiet]

Flags:
  -w   Print message as GRASS warning
  -e   Print message as GRASS fatal error
  -d   Print message as GRASS debug message (level 1)
 --v   Verbose module output
 --q   Quiet module output

Parameters:
  message   Text of the message to be printed

G63> g.message message="foo="
foo=


scripts to check:
$ grep -rI g.message * | grep '='

d.out.png/d.out.png:g.message -d message="width = $curr_width  height = $curr_height"

^^^ correct AFAICT.

d.vect.thematic/d.vect.thematic:        g.message "Mapped by standard deviation units of $sd (mean =$mean)"
d.vect.thematic/d.vect.thematic:        g.message "Mapped by standard deviation units of $sd (mean =$mean)"
d.vect.thematic/d.vect.thematic:        g.message "Mapped by quartiles (median =$q2)"
i.fusion.brovey/i.fusion.brovey:g.message "g.region -p rast=$GIS_OPT_OUTPUTPREFIX.red ; d.erase"
i.fusion.brovey/i.fusion.brovey:g.message "d.rgb r=$GIS_OPT_OUTPUTPREFIX.red g=$GIS_OPT_OUTPUTPREFIX.green b=$GIS_OPT_OUTPUTPREFIX.blue"
i.in.spotvgt/i.in.spotvgt:  g.message "Note: A snow map can be extracted by category 252 (d.rast $NAME.sm cat=252)"
i.in.spotvgt/.#i.in.spotvgt.1.13:  g.message "Note: A snow map can be extracted by category 252 (d.rast $NAME.sm cat=252)"
m.proj/m.proj:g.message "input parameters=[$IN_PROJ]"
m.proj/m.proj:g.message "output parameters=[$OUT_PROJ]"
m.proj/m.proj:    g.message "input file=[$infile]"
m.proj/m.proj:    g.message "output file=[$outfile]" 
r.blend/r.blend:g.message "d.rgb r=${GIS_OPT_OUTPUT}.r g=${GIS_OPT_OUTPUT}.g b=${GIS_OPT_OUTPUT}.b"
r.in.wms/wms.request:  g.message "r.tileset -g sourceproj=\$PROJ4_SRS\ sourcescale=\$SRS_SCALE\ overlap=2 maxcols=${MAXCOLS} maxrows=${MAXROWS} $TILE
SET_OPTIONS"
r.mapcalculator/r.mapcalculator:    g.message "r.mapcalc \$GIS_OPT_OUTFILE\ = \$command\ "
r.out.gdal/r.out.gdal.sh:  g.message -e "(Raster map type is `r.info -t $INPUT | cut -d'=' -f2`)"
r.plane/r.plane:g.message "with dip=$dip degrees and aspect=$az degrees ccw from north"
r3.mapcalculator/r3.mapcalculator:g.message "r3.mapcalc \$GIS_OPT_OUTFILE\ = \$command\" # Show the resulting commandline
v.db.reconnect.all/v.db.reconnect.all:        g.message "SCHEMA = $SCHEMA TABLE = $TABLE NEW_SCHEMA_TABLE=$NEW_SCHEMA_TABLE"
v.in.garmin/v.in.garmin:        g.message "output=$NAME"
v.in.garmin/v.in.garmin:        g.message "port=$GIS_OPT_PORT"
v.in.gpsbabel/v.in.gpsbabel:    g.message "output=$NAME" 
v.in.gpsbabel/v.in.gpsbabel:    g.message "file=$GIS_OPT_INPUT"


Hamish


----------------------------------------------------------------------

You can respond by visiting: 
http://wald.intevation.org/tracker/?func=detail&atid=204&aid=394&group_id=21




More information about the grass-dev mailing list