[GRASS5] Re: [winGRASS] Re: Problem on install GRASS

Glynn Clements glynn.clements at virgin.net
Wed Aug 7 08:41:23 EDT 2002


Markus Neteler wrote:

> > > does anyone have a hint for Jennifer (please also cc to her)?
> > > 
> > > > I followed the instructions on your web site on how to install GRASS 5.0 on Win32 with Cygwin 1.x. My OS is Windows XP, the cygwin and XWindow (XFree86) can operate very well, but whenever I issue Grass command, the following messeage appears:
> > > > 
> > > > [: and: unknown operand
> > > > usage: /usr/local/grass5/etc/lock file pid
> > > > Unable to properly access /cygdrive/c/Documents and Settings/Jennifer/.gislock5
> > > > Please notify system personel.
> > 
> > GRASS cannot cope with spaces in filenames. You will need to create a
> > new home directory, and force the environment variable HOME to be set
> > to that instead. (Using "docume~1" instead of "Documents and Settings"
> > *might* work, but I haven't tested it).
> 
> What about adding a test for spaces in the path in Init.sh?
> If test successful, exit with error message, else continue.
> We just get too many of these Windows/Space questions :-)

The test shouldn't be too hard. The awkward part is: what should the
error message say?

If the short form (i.e. ".../docume~1/...") works, it would be better
to just change HOME accordingly.

While fixing GRASS to handle spaces in filenames generally would be
out of the question at this point (there are just too many places to
fix), the problem is mitigated by the fact that most of GRASS' file
handling is restricted to the database directory.

So long as the path to the database directory doesn't contain spaces
(if it does, you're stuffed), that leaves:

1. $HOME, and
2. any pathnames specified as arguments to import/export utilities.

For case 2, you can just "cd" to the appropriate directory and use a
pathnames.

For case 1, most of the issues relate to:

1. The startup sequence, and
2. $GISRC.

2 shouldn't be a problem so long as C code sticks to using the
provided functions (from src/libes/gis/env.c) and scripts use
g.gisenv.

Most of the problems with spaces relate to the shell; either:

1. Scripts which use variables like this:

	somecommand $filename

2. C code which uses system() like this:

	sprintf(cmd, "somecommand %s", filename);
	system(cmd);


For case 1, the fix is to use double quotes around the variable, i.e.:

	somecommand "$filename"

For case 2, the fix is to use single quotes around the conversion
specification as in:

	sprintf(cmd, "somecommand '%s'", filename);
	system(cmd);

For the time being, I believe that GRASS should just refuse to run
when $HOME contains spaces (unless we can fix $HOME at startup). It's
better to just fail at startup than to have unexpected behaviour later
on.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list