[GRASS-dev] Re: [GRASS GIS] #809: v.db.addtable consistently fails in winGrass

GRASS GIS trac at osgeo.org
Sun Jan 10 19:51:51 EST 2010


#809: v.db.addtable consistently fails in winGrass
------------------------------+---------------------------------------------
  Reporter:  JonBall          |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect           |      Status:  new                      
  Priority:  critical         |   Milestone:  6.4.0                    
 Component:  Vector           |     Version:  svn-releasebranch64      
Resolution:                   |    Keywords:  v.db.addtable, wingrass  
  Platform:  MSWindows Vista  |         Cpu:  x86-64                   
------------------------------+---------------------------------------------
Comment (by hamish):

 Replying to [comment:21 hamish]:
 {{{
    lib/db/dbmi_base/login.c
    dbmi_base/login.c:      ret = sscanf(buf, "%[^ ] %[^ ] %[^ ] %[^ ]",
 dr, db, usr, pwd);
 }}}
 >
 > This one will fail if the database path or passwd has spaces in
 > it. In grass 6 this file is ~/.grasslogin6. In grass 7 it is in
 > ~/.grass7/dblogin.
 >
 >  - What this means is that Postgre, MySQL, etc will currently
 > fail on WinGrass unless the databases are installed in a dir
 > without spaces in them-
 ...
 > Because it is a different file for grass 7 we don't have to worry about
 transitioning. So I've gone ahead and converted that to use
 > "|" as the sep already.
 >
 > GRASS 6 will have to worry about forward/backward compatibility,
 > so needs the full G_tokenize() treatment like vector/MAP/dbln got.


 It turns out that db.login doesn't actually need a backend DB running to
 work, so is a bit easier to test.


 AFAICT the only solution is to ditch the existing grass 6 file format for
 ~/.grasslogin6 and replace it with one which uses '|' as the field
 separator. There is simply no way to tell the database path, username, and
 passwd apart if either the db or pw has spaces in it because the name and
 pw are optional. e.g.: Does the path have a single space in it or was the
 password omitted? No way to tell.

 the ~/.grasslogin6 format is:
 {{{
 driver <space> database path [<space> username [<space> passwd]]
 }}}

 where both name and pw are optional.


 IMO the lesser of evils is to change the fs to '|' now, and write in the
 release notes that you will have to re-login.

 A way to do this is to write a new .grasslogin64 file which contains the
 new format and leave any existing .grasslogin6 files alone (and ignored).
 This is my preferred option and in the interest of keeping the release
 schedule on track I've provisionally committed it to 6.5svn for evaluation
 & comment (r40369). It is the same as what is in trunk now, except for the
 .file name.


 Hamish

 ps- I backported the G_tokenize() fix for dbln to the 6.4rb earlier today.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/809#comment:22>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list