[GRASS5] Need testers for tcltkgrass update for 5.7

Glynn Clements glynn.clements at virgin.net
Tue Aug 17 19:23:04 EDT 2004


Michael Barton wrote:

> Some of the commands Glynn lists below can be run with his new execute
> procedure, which automates running a command modally. As he says, commands
> with arguments much be run the old way with "exec $cmd $arg &". This does
> include d.mon commands. If they are not run modally, you have no further
> access to the menu for anything.

I figured out the problem with the d.mon commands. Because stdout
wasn't redirected, exec tried to read from it until EOF to return that
data as its result. "d.mon start=..." forks the driver, so exec
doesn't get EOF until the driver dies (when a pipe is shared by
multiple processes, the reader won't receive EOF until *all* writers
have closed the write end). BTW, this shouldn't apply to stop/select,
only to start.

> There are several other commands, including a few not listed here, which
> still need to run in a separate xterm (r.digit, for example). I've also
> fixed these so that they run properly.

The attached version no longer directly uses exec for anything.
Instead, everything goes through one of four functions:

	execute: runs a command with no arguments in the background;
	this function is intended solely for cases which will end up
	in G_gui().

	spawn: runs a command with arguments in the background (so
	stdout/stderr go to tcltkgrass' stdout/stderr, i.e. the
	terminal from which it was started).

	run: runs a command with arguments in the foreground, with
	stdout/stderr explicitly redirected to tcltkgrass'
	stdout/stderr (to prevent cases such as "d.mon start=..." from
	hanging).

	term: runs a command with arguments on its own xterm, in the
	background.

Ultimately, "run" should probably be split further. Many commands
probably *shouldn't* have stdout/stderr redirected, but should return
this information via exec to be displayed by tcltkgrass (e.g. the
g.version option should display a dialog rather than dumping the data
on the terminal from which tcltkgrass was run). Obviously, we can't do
that for "d.mon start=...". Although maybe the ideal solution there is
to make the drivers behave more like daemons, i.e. close their
standard descriptors, start a new session (in the setsid() sense) and
disassociate from the controlling terminal.

Also, the xterm case isn't trivial to get right. If xterm is setuid
(as is the case on many systems, including mine), LD_LIBRARY_PATH is
reset (as a security measure), typically causing shared GRASS
libraries to become inaccessible. We really need a "grass-run" script
which will set LD_LIBRARY_PATH back to the proper value before running
the specified command.

> Additional changes include removing references to:
> 
> scripting, since it doesn't work anymore

It doesn't work currently; it isn't out of the question to get it
working in the future.

> saving configurations, since that doesn't work anymore (save d.m files
> instead)
> configuring netscape, also doesn't work

BTW, I know that this isn't a tcltkgrass issue, but the default
GRASS_HTML_BROWSER settings need some work. E.g. they typically don't
do the right thing if you already have the browser open.

> g3.setregion and g3.setwind don't work because these scripts are not yet
> g.parser() compliant. Unless there is a reason NOT to do this, I will go
> ahead and add the headers to make them autogenerate a GRASS 5.7 GUI dialog.

Sure. In the meantime, I changed these to use execute as well. Right
now, nothing will work, as they can't won't work without arguments. 
Once they've been g.parser-ised, execute is the right thing to use.

> Glynn: the new procedure set_menu_font doesn't work for some reason. It
> looks like it should, but when I call it from the config menu it says
> main_menu(font) not found or something to that nature. So I reverted to the
> previous way of doing this and it works again.

Duh; I forgot to put "global main_menu" in the procedure.

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: tcltkgrass_test.tar.gz
Type: application/octet-stream
Size: 10395 bytes
Desc: tcltkgrass update
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20040818/d7dc89b5/tcltkgrass_test.tar.obj


More information about the grass-dev mailing list