[GRASS5] tcltkgrass and wish error

Hi,

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)?

Markus

Markus Neteler 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".

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

On Tue, Aug 27, 2002 at 12:43:31AM +0100, Glynn Clements wrote:

Markus Neteler 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.

#! /bin/sh
# Wish upon a star \
if test -n "$GRASS_WISH"; then \
  exec $GRASS_WISH "$0" "$@"; \
else \
  echo "TCLTKGRASS must be run from the GRASS shell"; \
  exit 1; \
fi

...

Seems to work... The "\" continuations seem to be necessary for
wish.

--
Eric G. Miller <egm2@jps.net>

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>

On Tue, Aug 27, 2002 at 03:17:10AM +0100, Glynn Clements wrote:

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).

Your forgetting users trying to execute tcltkgrass from outside a
GRASS session.

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.

Well, shell scripting is something of a black art -- with quoting
rules being near the top of the list of confusing things.

--
Eric G. Miller <egm2@jps.net>