[GRASS5] [bug #1561] (grass) tcl command error in tcltkgrass startup

this bug's URL: http://intevation.de/rt/webrt?serial_num=1561
-------------------------------------------------------------------------

Subject: tcl command error in tcltkgrass startup

Platform: GNU/Linux/i386
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: 5.0.2-cvs 20030131

Attempting to start Tcltkgrass:

GRASS:/arc/ddgray/cvs/main/grass > tcltkgrass&
[1] 16133
GRASS:/arc/ddgray/cvs/main/grass > bad switch "-dictionary": must be -ascii, -integer, -real, -increasing -decreasing, or -command
    while executing
"lsort -dictionary [split [read $fd] \n]"
    invoked from within
"foreach line [lsort -dictionary [split [read $fd] \n]]..."
    (procedure "set_list" line 25)
    invoked from within
"set_list etc ellipse.table 1 "\ \t""
    invoked from within
"set spheroids [set_list etc ellipse.table 1 "\ \t"]..."
    (file "/opt/grass5/tcltkgrass/main/gui.tcl" line 1776)
    invoked from within
"source $env(TCLTKGRASSBASE)/main/gui.tcl"
    invoked from within
"if [catch {source $env(TCLTKGRASSBASE)/main/gui.tcl}] {
    set env(TCLTKGRASSBASE) $env(GISBASE)/tcltkgrass
    source $env(TCLTKGRASSBASE)/main/gui. ..."
    (file "/opt/grass5/bin/tcltkgrass" line 26)

+++++++++++++++++++++++++++++++++++++++++++++++++

All home directory rc files had been cleared.

Problem occurred with 3 separate Tcl/Tk installations, most recent 8.3.3
(Mandrake 9.0)

I can't think of anything local that might be causing this. But I'm not
a Tcl expert.

DD Gray

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=1561
-------------------------------------------------------------------------

Subject: tcl command error in tcltkgrass startup

Platform: GNU/Linux/i386
grass obtained from: CVS
grass binary for platform: Compiled from Sources
GRASS Version: 5.0.2-cvs 20030131

Attempting to start Tcltkgrass:

GRASS:/arc/ddgray/cvs/main/grass > tcltkgrass&
[1] 16133
GRASS:/arc/ddgray/cvs/main/grass > bad switch "-dictionary": must be -ascii, -integer, -real, -increasing -decreasing, or -command
    while executing
"lsort -dictionary [split [read $fd] \n]"
    invoked from within
"foreach line [lsort -dictionary [split [read $fd] \n]]..."
    (procedure "set_list" line 25)
    invoked from within
"set_list etc ellipse.table 1 "\ \t""
    invoked from within
"set spheroids [set_list etc ellipse.table 1 "\ \t"]..."
    (file "/opt/grass5/tcltkgrass/main/gui.tcl" line 1776)
    invoked from within
"source $env(TCLTKGRASSBASE)/main/gui.tcl"
    invoked from within
"if [catch {source $env(TCLTKGRASSBASE)/main/gui.tcl}] {
    set env(TCLTKGRASSBASE) $env(GISBASE)/tcltkgrass
    source $env(TCLTKGRASSBASE)/main/gui. ..."
    (file "/opt/grass5/bin/tcltkgrass" line 26)

+++++++++++++++++++++++++++++++++++++++++++++++++

All home directory rc files had been cleared.

Problem occurred with 3 separate Tcl/Tk installations, most recent 8.3.3
(Mandrake 9.0)

I can't think of anything local that might be causing this. But I'm not
a Tcl expert.

It appears that the -dictionary switch was added in Tcl 8.0. It is a
case-insensitive version of -ascii.

For your immediate problem, I suggest changing -dictionary to -ascii
in /opt/grass5/tcltkgrass/main/gui.tcl (around line 1649).

For the developers: do we just change -dictionary to -ascii, or should
we try to use -dictionary if it is available (e.g. using "catch" to
fall-back to -ascii)?

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

Glynn Clements wrote:

[...]
Attempting to start Tcltkgrass:

GRASS:/arc/ddgray/cvs/main/grass > tcltkgrass&
[1] 16133
GRASS:/arc/ddgray/cvs/main/grass > bad switch "-dictionary": must be -ascii, -integer, -real, -increasing -decreasing, or -command
   while executing
"lsort -dictionary [split [read $fd] \n]"
   invoked from within
"foreach line [lsort -dictionary [split [read $fd] \n]]..."
   (procedure "set_list" line 25)
   invoked from within
"set_list etc ellipse.table 1 "\ \t""
   invoked from within
"set spheroids [set_list etc ellipse.table 1 "\ \t"]..."
   (file "/opt/grass5/tcltkgrass/main/gui.tcl" line 1776)
   invoked from within
"source $env(TCLTKGRASSBASE)/main/gui.tcl"
   invoked from within
"if [catch {source $env(TCLTKGRASSBASE)/main/gui.tcl}] {
   set env(TCLTKGRASSBASE) $env(GISBASE)/tcltkgrass
   source $env(TCLTKGRASSBASE)/main/gui. ..."
   (file "/opt/grass5/bin/tcltkgrass" line 26)

+++++++++++++++++++++++++++++++++++++++++++++++++

All home directory rc files had been cleared.

Problem occurred with 3 separate Tcl/Tk installations, most recent 8.3.3
(Mandrake 9.0)

I can't think of anything local that might be causing this. But I'm not
a Tcl expert.

It appears that the -dictionary switch was added in Tcl 8.0. It is a
case-insensitive version of -ascii.

That helps to clarify the difficulty. It indicates that the problem is version skew between the version that is used at compile-time, and the Tcl/Tk binaries picked up at runtime. In fact I found that at startup the script was attempting to run a version 7.6/4.2 installation.

[...]
For the developers: do we just change -dictionary to -ascii, or should
we try to use -dictionary if it is available (e.g. using "catch" to
fall-back to -ascii)?

If the -dictionary switch was added with version 8.0, then it is probably worth retaining, for as I understand, tcltkgrass requires version 8.0+, and there are probably other issues apart from this switch, so not much point attempting to support previous versions.

But, is it generally Ok to put some environment variables in Init.sh or the tcltkgrass startup that uses the Tcl/Tk base set at compile time? Then the correct paths for wish and the libs could be set. I found that setting these manually got round the problem by putting the following in Init.sh:

# Tcl/Tk base

export TCLTKBASE=/usr # Configure should set this. Does it already?
export TCLTKLIB=$TCLTKBASE/lib # But maybe wish calls the right libs anyway?
export GRASS_TCLSH=$TCLTKBASE/bin/tclsh
export GRASS_WISH=$TCLTKBASE/bin/wish

if [ ! "$LD_LIBRARY_PATH" ] ; then
   LD_LIBRARY_PATH=$TCLTKLIB
else
   LD_LIBRARY_PATH=$TCLTKLIB:$LD_LIBRARY_PATH # export later; searching /usr first might cause problems for some?
fi

David

David D Gray wrote:

> It appears that the -dictionary switch was added in Tcl 8.0. It is a
> case-insensitive version of -ascii.

That helps to clarify the difficulty. It indicates that the problem is
version skew between the version that is used at compile-time, and the
Tcl/Tk binaries picked up at runtime. In fact I found that at startup
the script was attempting to run a version 7.6/4.2 installation.

OK.

However, for tcltkgrass, there isn't any "compile time". The Tcl/Tk
configure checks are solely for NVIZ (which uses a custom binary built
against the Tcl/Tk libraries); tcltkgrass is just a set of Tcl/Tk
scripts.

> [...]
> For the developers: do we just change -dictionary to -ascii, or should
> we try to use -dictionary if it is available (e.g. using "catch" to
> fall-back to -ascii)?
>

If the -dictionary switch was added with version 8.0, then it is
probably worth retaining, for as I understand, tcltkgrass requires
version 8.0+, and there are probably other issues apart from this
switch, so not much point attempting to support previous versions.

But, is it generally Ok to put some environment variables in Init.sh or
the tcltkgrass startup that uses the Tcl/Tk base set at compile time?
Then the correct paths for wish and the libs could be set. I found that
setting these manually got round the problem by putting the following in
Init.sh:

# Tcl/Tk base

export TCLTKBASE=/usr # Configure should set this. Does it already?

No.

export TCLTKLIB=$TCLTKBASE/lib # But maybe wish calls the right libs
anyway?

Probably; most distributions include the version in the library name
(e.g. libtcl8.3.so etc); in that case, it would be impossible for wish
to use the wrong library.

export GRASS_TCLSH=$TCLTKBASE/bin/tclsh
export GRASS_WISH=$TCLTKBASE/bin/wish

If you have multiple versions of Tcl/Tk, then this may be necessary.
Although, I'm not sure whether anything actually uses $GRASS_TCLSH.

if [ ! "$LD_LIBRARY_PATH" ] ; then
   LD_LIBRARY_PATH=$TCLTKLIB
else
   LD_LIBRARY_PATH=$TCLTKLIB:$LD_LIBRARY_PATH # export later; searching
/usr first might cause problems for some?
fi

This shouldn't be necessary.

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