Eric G. Miller wrote:
> > since we get the tcltkgrass/wish questions too often,
> > I suggest a change to tcltkgrass startup:
> >
> > mv $GISBASE/bin/tcltkgrass $GISBASE/etc/tcltkgrass.start
> >
> > new file $GISBASE/bin/tcltkgrass with contents:
> > #!/bin/sh
> > # the next line restarts using wish \
> > if [ "`type -p $GRASS_WISH`" = "" ] ; then
> > echo "wish not found. Install tcl and tk libraries."
> > exit
> > else
> > exec $GISBASE/etc/tcltkgrass.start
> > fi
> >
> > Are there any objections (certainly above message may be modified)?
>
> I doubt that this will achieve anything, other than a different error
> message following the "I get the following error" messages.
>
> Even people who have installed Tcl/Tk will still get errors if wish is
> installed as e.g. "wish8.3".
It is a bug though currently.
#!/bin/sh
# the next line restarts using wish \
exec $GRASS_WISH "$0" "$@"
If $GRASS_WISH is not defined, the script goes into an endless loop.
etc/Init.sh has this at the top level:
if [ ! "$GRASS_WISH" ] ; then
GRASS_WISH=wish
export GRASS_WISH
fi
It should be impossible for GRASS_WISH to be unset within GRASS
(unless the user explicitly unsets it, in which case they deserve what
they get).
In any case, $GRASS_WISH should be quoted, i.e.
exec "$GRASS_WISH" "$0" "$@"
At least this will fail immediately (albeit with a cryptic error
message), rather than looping.
As a general principle, shell variables should almost always be
quoted.
I would guess that, if you examined all occurrences of unquoted
variables within GRASS' shell scripts, 1% of them would be unquoted
for a valid reason, and 99% because the programmer simply forgot.
--
Glynn Clements <glynn.clements@virgin.net>