[GRASS5] ticket 1175 - longer grassfile names

Glynn Clements glynn.clements at virgin.net
Wed Apr 23 01:13:42 EDT 2003


Helena wrote:

> there is a bug report #1175 about a problem with longer grass filenames.
>  I am not sure whether this has been addressed (I haven't found anything
> related)
> but I have observed some strange behavior of r.mapcalc related to this
> recently:
> 
> Case 1
> The command gives segmentation fault when it is trying to write into
> history file (the resulting map is correct but the history file is
> missing the expression)
> The exactly same expression runs fine in interactive mode
> 
> GRASS> r.mapcalc
> tdif98lidrtk.5m="(tlid98.5site-tlid98srtkdec02.5m)*mask.testrtk"
>  100%
> Segmentation fault

Markus reported a similar problem to me earlier today, which I'm
looking into.

> GRASS:> r.mapcalc
> Enter expressions, "end" when done.
> mapcalc> tdif98lidrtk.5m=(tlid98.5site-tlid98srtkdec02.5m)*mask.testrtk
> mapcalc> end
> 
>  100%

So it works if you enter the expression interactively instead of on
the command line?

> Case 2
> The expression with the same length runs OK or gives syntax error,
> depending
> on the length(?) of the name of the resulting reaster map
> 
> GRASS:~/lresults/lcoast/baldh > r.mapcalc
> tdiflid98=(tlid98srtkdec02.5m-lid98srtkdec02.5m)*mask.testrtk2
>  100%
> GRASS:~/lresults/lcoast/baldh > r.mapcalc
> tdif98lidrtk.5m=(tlid98.5site-tlid98srtkdec02.5m)*mask.testrtk
> bash: syntax error near unexpected token `('

This is a shell issue; parentheses are shell syntax, and should be
quoted:

bash 1.14.7:
	$ echo foo=(bar)
	bash: syntax error near unexpected token `foo=(b'

bash 2.03.8:
	$ echo foo=(bar)
	foo=(bar)

ash 0.2:
	$ echo foo=(bar)
	Syntax error: "(" unexpected

As a general rule, always enclose the the entire expression in single
quotes (unless you are writing a script and want to use shell
variables; in that case, use double quotes). The same applies to '*'.

> There were some other cases where r.mapcalc had problems and shortening
> the file name fixed them

In case 2, it may have something to do with the dot in the filename.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list