[GRASS-dev] GISDBASE directory name with spaces

Moritz Lennert mlennert at club.worldonline.be
Wed Oct 18 09:55:11 EDT 2006


Glynn Clements wrote:
> Moritz Lennert wrote:
> 
>> Trying to help some colleagues working with wingrass, I noticed that if 
>> the GISDBASE variable in .grassrc6 containes spaces (ex: GISDBASE: 
>> /home/mlennert/GRASS/TEST DATA), the gui startup screen does not 
>> recognize the directory and gives a warning: "Invalid database. Finding 
>> first valid directory in parent tree". However, I can manually navigate 
>> to the directory and GRASS starts normally.
>>
>> As many MS Windows users have spaces in their directory names, I 
>> personally think that the startup screen code should be fixed to allow 
>> spaces in the GISDBASE variable.
> 
> Agreed. AFAIK, it's generally accepted that failure to handle spaces
> in file/directory names is considered a bug rather than an accepted
> limitation.
> 
>> I imagine it probably is a "simple" 
>> issue of quoting in line 64 of lib/init/gis_set.tcl:
>>
>> 63: if { [scan $thisline "GISDBASE: %s" env_database] } {
>> 64:       set database $env_database
> 
> No, it isn't quoting; it's the way that the %s conversion works:
> 
>        s         The input field consists of all the characters up to the next
>                  white-space character; the characters are copied to the vari-
>                  able.
> 
> The above should be changed to use "regexp" instead, e.g. (untested):
> 
> 	if { [regexp -- {^GISDBASE: *(.*)$} $thisline dummy env_database] } {
> 		set database $env_database
> 
> This will treat everything from the first non-whitespace character to
> the end of the line as the pathname.


Yes, this works. Thanks.

Should this also be applied to location names ? mapsets ?

I do get the following in the terminal window (with GISDBASE = TEST DATA):

bash: test: /home/mlennert/GRASS/TEST: binary operator expected
bash: test: /home/mlennert/GRASS/TEST: binary operator expected
bash: test: /home/mlennert/GRASS/TEST: binary operator expected

Moritz




More information about the grass-dev mailing list