[GRASS-dev] gis.m in wingrass: using where clause in d.vect causes error :can't read "_data(.gronsole.gronsole, 9, donecmd)": no such element in array

Moritz Lennert mlennert at club.worldonline.be
Mon Oct 9 08:02:04 EDT 2006

Glynn Clements wrote:
> Moritz Lennert wrote:
>>>>>> Using a where clause in vector display in gis.m causes the following
>>>>>> error under WinGRASS. Any suggestions ?
>>>>>> (WinGRASS version 2006-09-17)
>>>>>> can't read "_data(.gronsole.gronsole,9,donecmd)": no such element in
>>>>>> array can't read "_data(.gronsole.gronsole,9,donecmd)": no such
>>>>>> element in array
>>>>>>      while executing
>>>>>> "set donecmd $_data($path,$ci,donecmd)"
>>>>> also seen on Linux, GRASS versions 6.3 and 6.2-rc1  IF you put the
>>>>> query in the "query cat values" box by mistake.
>>>> I am not near a windows box right now, but I am quite positive that this
>>>> is not the problem here. I entered the query in the where box, not the cat
>>>> box.
>>>> But I'll make sure tomorrow.
>>> Actually I just managed to test (Qemu over NX, quite an experience ;-) ),
>>> and I can confirm that the problem is with the sql query box. So it is not
>>> the same problem as the one described by Hamish.
>> Huidae or Glynn, any ideas on this ?
> 	# Actually run the program
> 	if { $mingw == "1" } {
> 		# shell scripts require sh.exe.
> 		set cmd [concat | sh -c '$cmd']
> 	} else {
> 		set cmd [concat | $cmd 2>@ stdout]
> 	}
> If you want to use "sh -c ...", you have to escape any shell
> metacharacters, otherwise commands which happen to contain shell
> metacharacters (e.g. "<" or ">" in a SQL "WHERE" clause) won't work.
> I've already explained this in the thread discussing these changes.


where you say

"The simplest solution to the issue of
metacharacters is to replace any occurrences of the single quote
character in arguments with "'\''" (quote, backslash, quote, quote)
and surround each argument with single quotes.

Even then, there might be issues due to the shell messing with the
environment, signal handling, process groups etc (as well as possible
Unix-compatibility "features"). Shells are very complex programs."

Not sure that I understand exactly what needs to be done and where.


More information about the grass-dev mailing list