[GRASS5] Re: [GRASSLIST:6232] Re: gisdbase error
Glynn Clements
glynn.clements at virgin.net
Fri May 9 08:47:31 EDT 2003
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.
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 ...
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-dev
mailing list