[GRASS-dev] trying to test error trapping for invalid gisdbase, location, and mapset

William Kyngesburye woklist at kyngchaos.com
Tue May 29 13:16:06 EDT 2007


On May 29, 2007, at 11:17 AM, Michael Barton wrote:

> William,
>
> I’m trying to test error trapping code for the GRASS startup that  
> will gracefully deal with invalid .grassrc6 settings for gisdbase,  
> location, or mapset.
>
> When I try to test this (i.e., with a bad setting), I get a shell  
> error before I even hit the gis_set.tcl file.
>
> ERROR: LOCATION << /Users/Shared/grassdata/nothing >> not available
> /Users/Shared/grassdata/nothing/PERMANENT/.gislock: No such file or  
> directory
> ERROR: /Applications/Grass/GRASS-6.3.app/Contents/Resources/etc/lock:
> cmbarton is currently running GRASS in selected mapset (file /Users/ 
> Shared/grassdata/nothing/PERMANENT/.gislock found). Concurrent use  
> not allowed.
> logout
>
> I can find this the code for this in init.sh and am wondering if it  
> is in the script that launches the Mac app? I need to disable it to  
> test the TclTk (and wxPython) code. If not Mac specific, can  
> someone tell me where this code is?
>
lib/gis/location.c/G_location_path(void)

called from a couple places in libgis and g.mapsets, but I don't know  
how it fits into init.sh.

> Rather than simply raising an error, which would be meaningless to  
> someone who doesn’t know what a .grassrc6 file is, it would be  
> better if an invalid setting branched the GRASS startup to the  
> prompt that comes up when gisdbase, location, or mapset is not set— 
> allowing a user to choose a valid value.
>
I'm not sure how it's broken.  For me, an invalid mapset works as it  
should - it shows an error and brings up the select mapset (GUI or  
text) dialog.  I tried it for when the whole database path is  
invalid, when the location is invalid, and when just the mapset is  
invalid.  The only errors I get are "LOCATION << ... >> not  
available" or "MAPSET ... not found".

The only things that are run in the OSX startup (and for the .app  
startup only, not with a basic unix build) are a couple scripts to  
build the addon help index and menu files, and they don't need a  
GRASS session or run any GRASS commands.


-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"History is an illusion caused by the passage of time, and time is an  
illusion caused by the passage of history."

- Hitchhiker's Guide to the Galaxy






More information about the grass-dev mailing list