[GRASS-dev] fixes before 6.2.1 [was: ps.map: scale wrong and no output]

Hamish hamish_nospam at yahoo.com
Sat Nov 18 03:05:36 EST 2006

Michael Barton wrote:
> The only possible outstanding bug is the slightly misleading error
> message generated when the GUI fails to start up because gdal is not
> installed or incorrectly installed. However, in discussions with
> Hamish, it is looking like this would be better trapped before the GUI
> tries to launch.

I wrote [offlist]:
re gis.m failing on startup with "parts(n)" error if libgdal is missing-

I get it now, so by that point g.region is history and we are dealing
with the downstream effects of the failure. It's informative /where/ it
broke for debugging by us, but not /why/ for self-debugging by the user.
Optimally we want to pick up and regurgitate the "libgdal.so not found"
message somehow.

did you figure out how to get the return code from a C module in tcl?
(like "$?" in bash scripts) to test if the module exited with an error
or not? [=0 is success, =something else is failure]

like $GISBASE/etc/grass-run.sh tests.

[see end of http://wiki.tcl.tk/902 ]

or maybe test that the values of n,s,e,w are not empty directly after
the g.region call?

mapcanvas.tcl: line 1035

# Zoom to something loaded from a g.region command
proc MapCanvas::zoom_gregion {mon args} {
	global env

	if {![catch {open [concat "|g.region" "-ug" $args] r} input]} {
		while {[gets $input line] >= 0} {
			regexp -nocase {^([a-z]+)=(.*)$} $line trash key value
			set parts($key) $value
		catch {close $input}

		MapCanvas::zoom_new $mon $parts(n) $parts(s) $parts(e) \
			$parts(w) $parts(nsres) $parts(ewres)


I don't fully understand the catch- does it get stderr?:

or maybe the solution is to run a tiny do-nothing C program at start up
which depends on all the compiled-in libraries that were configured
during the build step?
a little program for Init.sh that needs the core rast,vect,proj libraries:

Init.sh before starting the GUI:
if [ $? -ne 0 ] ; then
   echo "library failure of some sort. please fix." >&2
   exit 1


More information about the grass-dev mailing list