[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
Paul Kelly
paul-grass at stjohnspoint.co.uk
Tue Nov 7 14:13:09 EST 2006
On Mon, 9 Oct 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 got this working by changing the above (in gronsole.tcl) to:
# Actually run the program
if { $mingw == "1" } {
set cmd [concat | $cmd |& cat]
} else {
set cmd [concat | $cmd 2>@ stdout]
}
A few Tcl help-related webpages recommend using "|& cat" to merge stdout
and stderr. Unfortunately that's using the cat command that was installed
with Msys, ideally we should get it working without Msys but all it needs
is a simple program that reads from stdin and copies to stdout? Then it
could be a cross-platform solution and we could get rid of the Mingw
checks - I like doing that :).
In a few places also needed to change
if {[info exists env(MSYSCON)]}
to
if {[info exists env(OS)] && $env(OS) == "Windows_NT"}
which is still ugly but at least not Msys-specific.
Will comment more on it later; just noting this to the list now as I have
a million other things going on in my head and might forget (this solves
the problem I reported with gis.m earlier today - it wasn't with gis.m at
all (sorry) but with the auto-generated Tcl/Tk dialog boxes for modules).
Paul
More information about the grass-dev
mailing list