[GRASS5] Mac OS X Tcl fix and Startup Errors

Jeshua Lacock jeshua at openosx.com
Tue Apr 8 05:40:30 EDT 2003


Mac OS X allows the use of special/reserved characters in file names 
such as the exclamation mark ("!") and the space character (" ").

This was causing gis_set.tcl and other Tcl scripts to choke using the 
native Aqua Tcl/Tk interface when encountering a file with illegal unix 

It turns out the most elegant solution I could come up with was to 
create a wrapper for the "ls" command to escape the exclamation marks 
and to wrap the filename in quotes to compensate for spaces and other 
special characters.

The wrapper is a shell script using awk and sed, and then I simply 
changed occurrences of "ls -a" with "lsWrap -a" and so on. I can supply 
patches if anyone is interested.

Here's the wrapper:


     /bin/ls -1 $* | awk '{print "\"" $0 "\"" }' | sed s/\!/\\\\!/g

I suppose that it could be implemented inline, however I am not 
familiar enough with Tcl/Tk to make the attempt. It also seems that 
it's best to have it in one place.

I am also trying to fix these errors:
     Starting GRASS ...
     : command not foundtc/Init.sh:
     : command not foundtc/Init.sh:
     : command not foundtc/Init.sh:

These errors are being caused by:

     puts stdout "GISDBASE='$database'; export GISDBASE;"
     puts stdout "LOCATION_NAME='$location'; export LOCATION_NAME;"
     puts stdout "MAPSET='$mapset'; export MAPSET;"

If I change stdout to stderr, everything looks normal:

     set GISDBASE='/Users/jeshua'; export GISDBASE;

I don't get any errors when I remove the export part such as:
     puts stdout "GISDBASE='$database'"

If I include the semicolon, I get the error:
     : command not foundtc/Init.sh:

I suppose this is a bug with the Aqua port of Tcl/Tk 8.4.2.

What is the grass tcltk script trying to accomplish here? Just setting 
the environment variables and exporting them?

Also I am getting:

     ERROR: Invalid return code from gis_set.tcl.
     Please advise GRASS developers of this error.
     Welcome to GRASS 5.0.1 (January 2003)

The 'gis_set' result is 127. Everything seems to work fine, do you 
think the error is anything to be concerned about?

I am also trying to fix the "console 1 bug" OS X Aqua Tcl/Tk 8.4.x bug, 
and thought I should get rid of all the errors/warnings first.


Jeshua Lacock __________________________
Programmer/Owner            Phone:   760.935.4736
http://OpenOSX.com           Fax:        760.935.4845

More information about the grass-dev mailing list