[GRASS5] Re: [GRASSLIST:6232] Re: gisdbase error

Markus Neteler neteler at itc.it
Fri May 9 08:56:52 EDT 2003


On Fri, May 09, 2003 at 01:47:31PM +0100, Glynn Clements wrote:
> 
> Markus Neteler wrote:
> 
> > > Can you provide more details regarding the failures? You can get
> > > debugging information by using "sh -x ...", i.e.
> > 
> > Yes, find attached (log_wingrass.txt.gz).
> > 
> > Row 91 of the log is showing a problem.
> 
> The $GISRC file is broken or absent. Non-interactive startup only
> works once you have a valid $GISRC file, not for first-time use. This
> is also true on Linux.

Ahh! Thanks for the quick investigation. So we miss(ed) a test here.
 
> Non-interactive startup builds the $GISRC file using:
> 
>     	    sed -e "s|^GISDBASE:.*$|GISDBASE: $GISDBASE|; \
>     	    	s|^LOCATION_NAME:.*$|LOCATION_NAME: $LOCATION_NAME|; \
>     	    	s|^MAPSET:.*$|MAPSET: $MAPSET|" "$GISRC" > "$GISRC.$$"
> 
> This changes the existing $GISRC settings for GISDBASE, LOCATION_NAME
> and MAPSET, but it won't add those settings if they aren't present.
> 
> The first-time use code does this:
> 
>     #for convenience, define pwd as GISDBASE:
>     echo "GISDBASE: `pwd`" > "$GISRC"
> 
> The above sed command will then replace GISDBASE with the value from
> the command-line, but LOCATION_NAME and MAPSET will remain undefined.
> Hence the "LOCATION_NAME not set" error.
> 
> A simple fix is to change the first-time use code, e.g.:
> 
>     #for convenience, define pwd as GISDBASE:
>     echo "GISDBASE: `pwd`" > "$GISRC"
>     echo 'LOCATION_NAME: <UNKNOWN>' >> "$GISRC"
>     echo 'MAPSET: <UNKNOWN>' >> "$GISRC"
> 
> A more involved fix would be to check for the presence of all of the
> necessary settings, and add them if they aren't present (although this
> should never occur after the first use), e.g.
> 
> 	if ! grep LOCATION_NAME $GISRC >/dev/null 2>&1 ; then
> 		echo 'LOCATION_NAME: <UNKNOWN>' >> "$GISRC"
> 	fi
> 	if ! grep MAPSET $GISRC >/dev/null 2>&1 ; then
> 		echo 'MAPSET: <UNKNOWN>' >> "$GISRC"
> 	fi
> 
> 	sed -e ...

Well, I don't know - please add whatever you think is better (compared to
efforts).

Thanks again!

 Markus




More information about the grass-dev mailing list