[GRASS-dev] Re: [GRASS-windows] GRASS 6.4.0svn updated in OSGeo4W

Glynn Clements glynn at gclements.plus.com
Wed Apr 1 00:49:21 EDT 2009


Maxim Dubinin wrote:

> Hi, great news on 6.4svn.
> 
> i18n is working!
> 
> Running Help\About system gives me this:
> 
> couldn't execute "C:OSGeo4Winwish.exe": no such file or directory
> couldn't execute "C:OSGeo4Winwish.exe": no such file or directory
>     while executing
> "exec C:\OSGeo4W\bin\wish.exe C:/OSGeo4W/apps/grass/grass-6.4.0svn/etc/gm/tksys.tcl --tcltk & "
>     (menu invoke)

The \b is being interpreted as ^H (backspace), and the other
backslashes are getting dropped.

This is due to the use of "subst" in the definition of descmenu in
gmmenu.tcl. This replaces all variable substitutions with their
values.

So, the command:

	{ exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }

gets expanded to:

	{ exec C:\OSGeo4W\bin\wish.exe C:/OSGeo4W/apps/grass/grass-6.4.0svn/etc/gm/tksys.tcl --tcltk & }

The backslashes in the first argument (the wish path) are treated as
escape characters. \b is treated as ^H while \O and \w are treated as
O and w respectively.

Specifying GRASS_WISH using forward slashes will solve this problem,
but will cause problems if GRASS_WISH is used inside a Windows batch
file.

The path can be converted in Tcl with:

	set env(GRASS_WISH) [file normalize $env(GRASS_WISH)]

But if the value is passed to the Windows command interpreter, it will
need to be converted back with "file nativename ...".

Alternatively, the variable expansion can be quoted, e.g.:

	{ exec {$env(GRASS_WISH)} $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }

There may be other cases where this is necessary. But this won't work
if the variable's value contains unmatched braces or ends in a
backslash.

The ideal solution would be to eliminate the "subst", but that would
mean:

1. Calling "subst" elsewhere, so that $tmenu and $keyctrl get
expanded.

2. Adding "global" statements for tmenu and keyctrl at those points.

3. Adding "global" statements within the commands for $env, $mon, and
$devnull.

Alternatively, descmenu could be constructed by using [list ...] 
rather than braces. This will expand variables as the list is
constructed, and (unlike subst) will add braces and/or backslashes
where necessary.

Actually, using:

	{[list exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk &]}

while keeping the "subst" should work, and doesn't have problems when
the variable contains unmatched braces or a trailing backslash.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list