[GRASS-dev] [GRASS GIS] #1178: WinGrass: g.extension - problem with path to $GISBASE

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------
a self build WinGrass64svn-installer (svn-client included):

on the msys-commandline:

{{{
GRASS 6.4> g.extension extension=r.stream.order
Fetching <r.stream.order> from GRASS-Addons SVN (be patient)...
A r.stream.order\orders.png
A r.stream.order\main.c
A r.stream.order\description.html
A r.stream.order\global.h
A r.stream.order\io.c
A r.stream.order\order.c
A r.stream.order\Makefile
Checked out revision 43684.
Compiling <r.stream.order>...
Makefile:12: c:/Program: No such file or directory
Makefile:12: Files/GRASS-64-SVN/include/Make/Module.make: No such file or
directory
make: *** No rule to make target
`Files/GRASS-64-SVN/include/Make/Module.make'. Stop.
FEHLER: Compilation failed, sorry. Please check above error messages.
rm: cannot remove directory
`C:\\gisdata\\grassdata/wgs84gc/user1/.tmp/7992.0/r.stream.order':
Permission denied
GRASS 6.4>
}}}

there seems GISBASE=c:/Program Files/GRASS-64-SVN isn't recognized because
of a whitespace in the path?

and from the wxgui:

{{{
g.extension --verbose extension=r.stream.order
svnurl=https://svn.osgeo.org/grass/grass-addons/ prefix=$GISBASE
Tut mir leid, <Files/GRASS-64-SVN> ist keine gültige Option
Sorry, <Files/GRASS-64-SVN> is not a valid optiopn
[...]
}}}

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by neteler):

Please add " -x" (without quotes to the first line of g.extension and run
again to
understand how
{{{
cd "$TMPDIR/$MODULE"
g.message message="Compiling <${MODULE}>..."
make MODULE_TOPDIR="$GISBASE"
if [ $? -ne 0 ] ; then
...
}}}

is running.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hamish):

the problem is certainly on that line of the script:

{{{
   make MODULE_TOPDIR="$GISBASE"
}}}

but I don't know how to fix it. (maybe g.dirseps or `sed 's/ /\\ /g'` if
Windows is detected?)

Hamish

ps- while harmlessly used a lot in the script, ${curly} brackets do not
actually protect spaces in file or path names, just variable names from
following characters which would otherwise continue the variable name, or
for readability.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:1 neteler]:
> Please add " -x" (without quotes to the first line of g.extension and
run again to
> understand how
> {{{
> cd "$TMPDIR/$MODULE"
> g.message message="Compiling <${MODULE}>..."
> make MODULE_TOPDIR="$GISBASE"
> if [ $? -ne 0 ] ; then
> ...
> }}}
>
> is running.

with added -x in the first line:

{{{
Welcome to GRASS 6.4.1svn (2010)
GRASS homepage: http://grass.osgeo.org/
This version running thru: Bourne Shell (/bin/sh)
Help is available with the command: g.manual -i
See the licence terms with: g.version -c
If required, restart the GUI with: g.gui wxpython
When ready to quit enter: exit

GRASS 6.4> g.extension extension=r.stream.order
+ '[' -z '/C/Program Files/GRASS-64-SVN' ']'
+ '[' extension=r.stream.order '!=' @ARGS_PARSED@ ']'
+ exec g.parser '/C/Program Files/GRASS-64-SVN/scripts/g.extension'
extension=r .stream.order
Fetching <r.stream.order> from GRASS-Addons SVN (be patient)...
A r.stream.order\orders.png
A r.stream.order\main.c
A r.stream.order\description.html
A r.stream.order\global.h
A r.stream.order\io.c
A r.stream.order\order.c
A r.stream.order\Makefile
Checked out revision 43689.
Compiling <r.stream.order>...
Makefile:12: c:/Program: No such file or directory
Makefile:12: Files/GRASS-64-SVN/include/Make/Module.make: No such file or
direc tory
make: *** No rule to make target
`Files/GRASS-64-SVN/include/Make/Module.make'.
Stop.
FEHLER: Compilation failed, sorry. Please check above error messages.
rm: cannot remove directory
`C:\\gisdata\\grassdata/wgs84gc/user1/.tmp/3488.0/r
.stream.order': Permission denied
GRASS 6.4>
}}}

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:2 hamish]:
> the problem is certainly on that line of the script:
>
> {{{
> make MODULE_TOPDIR="$GISBASE"
> }}}
>
> but I don't know how to fix it. (maybe g.dirseps or `sed 's/ /\\ /g'` if
Windows is detected?)
>
>
> Hamish
>
> ps- while harmlessly used a lot in the script, ${curly} brackets do not
actually protect spaces in file or path names, just variable names from
following characters which would otherwise continue the variable name, or
for readability.

I've tried it now with Grass64svn living in
C:\OSGeo4W\apps\grass\grass-6.4.1svn:

{{{
GRASS 6.4> g.extension extension=r.stream.order
which: wget: unknown command
Fetching <r.stream.order> from GRASS-Addons SVN (be patient)...
A r.stream.order\orders.png
A r.stream.order\main.c
A r.stream.order\description.html
A r.stream.order\global.h
A r.stream.order\io.c
A r.stream.order\order.c
A r.stream.order\Makefile
Checked out revision 43689.
Compiling <r.stream.order>...
test -d OBJ.i686-pc-mingw32 || mkdir -p OBJ.i686-pc-mingw32
gcc -I/c/osgeo4w/usr/src/grass64svn/dist.i686-pc-mingw32/include
-I/c/OSGeo4W/a
pps/gdal-16/include -I/c/OSGeo4W/include -g -O2
-I/c/OSGeo4W/apps/gdal-16/incl
ude -I/c/OSGeo4W/include -I/c/OSGeo4W/include
-DPACKAGE=\""grassmods"\" -I
/c/osgeo4w/usr/src/grass64svn/dist.i686-pc-mingw32/include -o OBJ.i686-pc-
mingw
32/io.o -c io.c
io.c:1:27: grass/glocale.h: No such file or directory
In file included from io.c:2:
global.h:5:23: grass/gis.h: No such file or directory
global.h:6:24: grass/Vect.h: No such file or directory
global.h:7:24: grass/dbmi.h: No such file or directory
In file included from io.c:2:
global.h:80: error: syntax error before '*' token
global.h:81: error: syntax error before '*' token
global.h:93: error: syntax error before '*' token
global.h:93: warning: data definition has no type or storage class
global.h:94: error: syntax error before '*' token
global.h:94: warning: data definition has no type or storage class
io.c: In function `open_raster':
io.c:8: error: storage size of 'cellhd' isn't known
io.c:10: warning: assignment makes pointer from integer without a cast
io.c:16: error: `CELL_TYPE' undeclared (first use in this function)
io.c:16: error: (Each undeclared identifier is reported only once
io.c:16: error: for each function it appears in.)
io.c:26: error: invalid use of undefined type `struct Cell_head'
io.c:26: error: invalid use of undefined type `struct Cell_head'
io.c: In function `create_base_maps':
io.c:37: error: `CELL' undeclared (first use in this function)
io.c:37: error: `r_dirs' undeclared (first use in this function)
io.c:37: error: `r_streams' undeclared (first use in this function)
io.c:38: error: `DCELL' undeclared (first use in this function)
io.c:38: error: `r_accum' undeclared (first use in this function)
io.c:47: error: syntax error before ')' token
io.c:48: error: syntax error before ')' token
io.c:50: error: syntax error before ')' token
io.c:50: error: syntax error before ')' token
io.c:52: error: syntax error before ')' token
io.c:53: error: syntax error before ')' token
io.c:55: error: syntax error before ')' token
io.c:62: warning: assignment makes pointer from integer without a cast
io.c:63: warning: assignment makes pointer from integer without a cast
io.c:73: error: syntax error before ')' token
io.c: In function `stream_number':
io.c:120: error: `CELL' undeclared (first use in this function)
io.c:120: error: syntax error before "c_min"
io.c:121: error: storage size of 'stream_range' isn't known
io.c:124: warning: assignment makes pointer from integer without a cast
io.c:126: error: `c_min' undeclared (first use in this function)
io.c:126: error: `c_max' undeclared (first use in this function)
io.c: In function `write_maps':
io.c:136: error: `CELL' undeclared (first use in this function)
io.c:136: error: `strahler_buf' undeclared (first use in this function)
io.c:136: error: `shreeve_buf' undeclared (first use in this function)
io.c:136: error: `hack_buf' undeclared (first use in this function)
io.c:136: error: `horton_buf' undeclared (first use in this function)
io.c:136: error: `topo_buf' undeclared (first use in this function)
io.c:138: error: storage size of 'history' isn't known
io.c:142: error: `CELL_TYPE' undeclared (first use in this function)
io.c: In function `create_table':
io.c:285: error: `dbConnection' undeclared (first use in this function)
io.c:285: error: syntax error before "conn"
io.c:286: error: `dbDriver' undeclared (first use in this function)
io.c:286: error: `driver' undeclared (first use in this function)
io.c:287: error: `dbHandle' undeclared (first use in this function)
io.c:287: error: syntax error before "handle"
io.c:288: error: `dbString' undeclared (first use in this function)
io.c:334: error: `db_sql' undeclared (first use in this function)
io.c:335: error: `val_string' undeclared (first use in this function)
io.c:336: error: `table_name' undeclared (first use in this function)
io.c:337: error: `handle' undeclared (first use in this function)
io.c:341: error: `conn' undeclared (first use in this function)
io.c:383: error: `DB_OK' undeclared (first use in this function)
io.c:393: error: `DB_PRIV_SELECT' undeclared (first use in this function)
io.c:393: error: `DB_GROUP' undeclared (first use in this function)
io.c:393: error: `DB_PUBLIC' undeclared (first use in this function)
make: *** [OBJ.i686-pc-mingw32/io.o] Error 1
FEHLER: Compilation failed, sorry. Please check above error messages.
rm: cannot remove directory
`C:\\gisdata\\grassdata/wgs84gc/user1/.tmp/3648.0/r
.stream.order': Permission denied

}}}

compiling is starting, but a lot of errors (maybe r.stream.order isn't for
Grass64?)

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:4 hellik]:
>
> compiling is starting, but a lot of errors (maybe r.stream.order isn't
for Grass64?)
>

and I've tried also the example from the manual

{{{
GRASS 6.4> g.extension extension=i.landsat.toar
which: wget: unknown command
Fetching <i.landsat.toar> from GRASS-Addons SVN (be patient)...
A i.landsat.toar\landsat_set.c
A i.landsat.toar\local_proto.h
A i.landsat.toar\main.c
A i.landsat.toar\description.html
A i.landsat.toar\landsat.c
A i.landsat.toar\earth_sun.c
A i.landsat.toar\landsat.h
A i.landsat.toar\landsat_met.c
A i.landsat.toar\Makefile
A i.landsat.toar\earth_sun.h
Checked out revision 43689.
Compiling <i.landsat.toar>...
test -d OBJ.i686-pc-mingw32 || mkdir -p OBJ.i686-pc-mingw32
gcc -I/c/osgeo4w/usr/src/grass64svn/dist.i686-pc-mingw32/include
-I/c/OSGeo4W/apps/gdal-16/include -I/c/OSGeo4W/include -g -O2
-I/c/OSGeo4W/apps/gdal-16/include -I/c/OSGeo4W/include
-DPACKAGE=\""grassmods"\" -I/c/osgeo4w/usr/src/grass64svn/dist.i686-pc-
mingw32/include -o OBJ.i686-pc-mingw32/earth_sun.o -c earth_sun.c
gcc -I/c/osgeo4w/usr/src/grass64svn/dist.i686-pc-mingw32/include
-I/c/OSGeo4W/apps/gdal-16/include -I/c/OSGeo4W/include -g -O2
-I/c/OSGeo4W/apps/gdal-16/include -I/c/OSGeo4W/include
-DPACKAGE=\""grassmods"\" -I/c/osgeo4w/usr/src/grass64svn/dist.i686-pc-
mingw32/include -o OBJ.i686-pc-mingw32/landsat.o -c landsat.c
landsat.c:4:23: grass/gis.h: No such file or directory
make: *** [OBJ.i686-pc-mingw32/landsat.o] Error 1
FEHLER: Compilation failed, sorry. Please check above error messages.
rm: cannot remove directory
`C:\\gisdata\\grassdata/wgs84gc/user1/.tmp/3116.0/i.landsat.toar':
Permission denied
GRASS 6.4>
}}}

ah, maybe it looks for the includes in

{{{
C:\OSGeo4W\usr\src\grass64svn\dist.i686-pc-mingw32\include
}}}

as instead in?

{{{
C:\OSGeo4W\apps\grass\grass-6.4.1svn\include
}}}

the first one doesn't exist after a make distclean.

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by glynn):

Replying to [comment:3 hellik]:

> with added -x in the first line:
>
{{{
Makefile:12: c:/Program: No such file or directory
Makefile:12: Files/GRASS-64-SVN/include/Make/Module.make: No such file or
directory
}}}

Makefiles can't handle spaces in filenames, and this is rather fundamental
to the way make works. Spaces separate tokens, and there isn't any
(documented) mechanism to quote spaces.

If the variables were only used in commands, you could quote them, but
that won't work elsewhere (e.g. "include" statements or dependencies).

The only workaround I know is to use 8.3 names (e.g. "/c/progra~1" rather
than "/c/Program Files"), but I don't know how to perform that conversion
from within a script (from C, you can use GetShortPathName()).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:6 glynn]:
> Replying to [comment:3 hellik]:
>
> > with added -x in the first line:
> >
> {{{
> Makefile:12: c:/Program: No such file or directory
> Makefile:12: Files/GRASS-64-SVN/include/Make/Module.make: No such file
or directory
> }}}
>
> Makefiles can't handle spaces in filenames, and this is rather
fundamental to the way make works. Spaces separate tokens, and there isn't
any (documented) mechanism to quote spaces.
>
> If the variables were only used in commands, you could quote them, but
that won't work elsewhere (e.g. "include" statements or dependencies).
>
> The only workaround I know is to use 8.3 names (e.g. "/c/progra~1"
rather than "/c/Program Files"), but I don't know how to perform that
conversion from within a script (from C, you can use GetShortPathName()).

would a little bat-script on the windows-command-line help?

{{{
%~1 - expands %1 removing any surrounding quotes (")
%~f1 - expands %1 to a fully qualified path name
%~d1 - expands %1 to a drive letter only
%~p1 - expands %1 to a path only
%~n1 - expands %1 to a file name only
%~x1 - expands %1 to a file extension only
%~s1 - expanded path contains short names only
%~a1 - expands %1 to file attributes
%~t1 - expands %1 to date/time of file
%~z1 - expands %1 to size of file
%~$PATH:1 - searches the directories listed in the PATH environment
variable and expands %1 to the fully qualified name of the first one
found. If the environment variable name is not defined or the file is not
found by the search, then this modifier expands to the empty string

The modifiers can be combined to get compound results:

%~dp1 - expands %1 to a drive letter and path only
%~nx1 - expands %1 to a file name and extension only
%~dp$PATH:1 - searches the directories listed in the PATH environment
variable for %1 and expands to the drive letter and path of the first one
found.
%~ftza1 - expands %1 to a DIR like output line
}}}

for example param.bat:

{{{
@echo off
echo %%~1 = %~1
echo %%~f1 = %~f1
echo %%~d1 = %~d1
echo %%~p1 = %~p1
echo %%~n1 = %~n1
echo %%~x1 = %~x1
echo %%~s1 = %~s1
echo %%~a1 = %~a1
echo %%~t1 = %~t1
echo %%~z1 = %~z1
echo %%~$PATHATH:1 = %~$PATHATH:1
echo %%~dp1 = %~dp1
echo %%~nx1 = %~nx1
echo %%~dp$PATH:1 = %~dp$PATH:1
echo %%~ftza1 = %~ftza1
}}}

a little test with following installation path "C:\Program
Files\GRASS-64-SVN\"

{{{
C:\wd>param.bat "C:\Program Files\GRASS-64-SVN\"
%~1 = C:\Program Files\GRASS-64-SVN\
%~f1 = C:\Program Files\GRASS-64-SVN\
%~d1 = C:
%~p1 = \Program Files\GRASS-64-SVN\
%~n1 =
%~x1 =
%~s1 = C:\PROGRA~1\GRASS-~2\
%~a1 = d----c---
%~t1 = 25.09.2010 16:56
%~z1 = 4096
%~$PATHATH:1 =
%~dp1 = C:\Program Files\GRASS-64-SVN\
%~nx1 =
%~dp$PATH:1 = C:\Program Files\GRASS-64-SVN\
%~ftza1 = d----c--- 25.09.2010 16:56 4096 C:\Program
Files\GRASS-64-SVN\
C:\wd>
}}}

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by glynn):

Replying to [comment:7 hellik]:

> would a little bat-script on the windows-command-line help?
>
{{{
%~1 - expands %1 removing any surrounding quotes (")
%~f1 - expands %1 to a fully qualified path name
...
}}}

This doesn't work for me (on XP Pro). Is this a !Vista/Win7 feature?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:8 glynn]:
> Replying to [comment:7 hellik]:
>
> > would a little bat-script on the windows-command-line help?
> >
> {{{
> %~1 - expands %1 removing any surrounding quotes (")
> %~f1 - expands %1 to a fully qualified path name
> ...
> }}}
>
> This doesn't work for me (on XP Pro). Is this a !Vista/Win7 feature?

I've get above from following websites:

http://stackoverflow.com/questions/659647/how-to-get-folder-path-from-
file-path-with-cmd

http://weblogs.asp.net/jgalloway/archive/2006/11/20/top-10-dos-batch-tips-
yes-dos-batch.aspx

I've only WinVista32, but I don't think it's only in WinVista/Win7.

you can get this information as part of the help information for: for /?
in the windows-command-line.

in one of the above mentioned websites:

{{{
Batch file parameters are read as %1, %2, etc. DOS Command Extensions -
available on Windows 2000 and up -
[...]
}}}

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:8 glynn]:
> Replying to [comment:7 hellik]:
>
> > would a little bat-script on the windows-command-line help?
> >
> {{{
> %~1 - expands %1 removing any surrounding quotes (")
> %~f1 - expands %1 to a fully qualified path name
> ...
> }}}
>
> This doesn't work for me (on XP Pro). Is this a !Vista/Win7 feature?

as mentioned in:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs
/en-us/for.mspx?mfr=true

it should also be working in WinXP

Helmut

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hamish):

Replying to [comment:6 glynn]:
> The only workaround I know is to use 8.3 names (e.g. "/c/progra~1"
> rather than "/c/Program Files"), but I don't know how to perform
> that conversion from within a script (from C, you can use
> GetShortPathName()).

maybe we could expose that function as a new -s flag of g.dirseps?

As Helmut noted, and IIRC the Windows installer scripts use somewhere,
there is a Windows XP batch file solution to shortening them as well. The
answer will be in our own archives from 6 months ago or so as I remember
testing it.

Hamish

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:11&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by glynn):

Replying to [comment:8 glynn]:

> This doesn't work for me (on XP Pro). Is this a !Vista/Win7 feature?

Correction: it doesn't work when "executing" the batch file directly from
the shell. It does work if you explicitly invoke it via cmd, e.g.:
{{{
~ $ cmd /c "foo.bat \"$APPDATA\""
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1178#comment:12&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hamish):

> The answer will be in our own archives from 6 months ago or so..

two batch file leads to get 8.3 shortened path names:

  dir /x
and
  %~sX

see #629 comment 3, and

http://old.nabble.com/make-target---dependency-names-with-spaces-
td22997327.html
http://sourceforge.net/tracker/index.php?func=detail&aid=1087569&group_id=2435&atid=202435

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1178#comment:13&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:13 hamish]:
> > The answer will be in our own archives from 6 months ago or so..
>
>
> two batch file leads to get 8.3 shortened path names:
>
> dir /x
> and
> %~sX
>
> see #629 comment 3, and
>
> http://old.nabble.com/make-target---dependency-names-with-spaces-
td22997327.html
>
http://sourceforge.net/tracker/index.php?func=detail&aid=1087569&group_id=2435&atid=202435
>
>
> Hamish

I've searched a little bit through the wingrass-nsis-code.

getting the short name of the installation path is already there:
(https://trac.osgeo.org/grass/browser/grass/branches/develbranch_6/mswindows
/GRASS-Installer.nsi#L804)

{{{
;Get the short form of the install path (to allow for paths with spaces)
VAR /GLOBAL INST_DIR_SHORT
GetFullPathName /SHORT $INST_DIR_SHORT $INSTALL_DIR
}}}

so maybe this can be used? where could this be included and as which
variable?

Helmut

p.s. noted that this is a statical approach, but at the moment it's a
chance to test g.extension in wingrass. later on - after testing
g.extension - it could be changed into a dynamically approach as described
in comment:7

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1178#comment:14&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:14 hellik]:
>
> {{{
> ;Get the short form of the install path (to allow for paths with spaces)
> VAR /GLOBAL INST_DIR_SHORT
> GetFullPathName /SHORT $INST_DIR_SHORT $INSTALL_DIR
> }}}
>

as information the reference from the nsis-manual
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9

{{{
4.9.3.9 GetFullPathName

[/SHORT] user_var(output) path_or_file

Assign to the user variable $x, the full path of the file specified. If
the path portion of the parameter is not found, the error flag will be set
and $x will be empty. If /SHORT is specified, the path is converted to the
short filename form. However, if /SHORT is not specified, the path isn't
converted to its long filename form. To get the long filename, call
GetLongPathName using the System plug-in. Note that GetLongPathName is
only available on Windows 98, Windows 2000 and above.

StrCpy $INSTDIR $PROGRAMFILES\NSIS
SetOutPath $INSTDIR
GetFullPathName $0 ..
DetailPrint $0 # will print C:\Program Files
GetFullPathName /SHORT $0 $INSTDIR
DetailPrint $0 # will print C:\Progra~1\NSIS

StrCpy $0 C:\Progra~1\NSIS
System::Call 'kernel32::GetLongPathName(t r0, t .r1, i ${NSIS_MAX_STRLEN})
i .r2'
StrCmp $2 error +2
StrCpy $0 $1
DetailPrint $0 # will print C:\Program Files\NSIS, where supported
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1178#comment:15&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hamish):

Replying to [comment:14 hellik]:
> p.s. noted that this is a statical approach, but at the moment
> it's a chance to test g.extension in wingrass. later on - after
> testing g.extension - it could be changed into a dynamically
> approach as described in comment:7

right, notice in the above comment:7 you get:
{{{
%~s1 = C:\PROGRA~1\GRASS-~2\
}}}

as you have more than 1 grass installed. Of course people will add and
remove different grasses after the initial install, so setting it to the
shortened version as it was at install time is not ideal. I can even
imagine someone downloading multiple versions of WinGrass and trying to
run both the installers at the same time, with interesting results if
GRASS-~1 suddenly becomes GRASS-~2 as far as the file system is concerned.

Hamish

ps- why not "C:\Program Files\GRASS-6.4.SVN" ? -64- looks a little weird
to me and could be confused with 64bit. does the .4 or .svn get mistaken
for a file type? On the other hand, final \GRASS-64 (or is it GRASS-640?)
fits into 8.3 already which avoids some of the shortname headaches. Same
for the names in the Start menu structure.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1178#comment:16&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:16 hamish]:
> Replying to [comment:14 hellik]:
> > p.s. noted that this is a statical approach, but at the moment
> > it's a chance to test g.extension in wingrass. later on - after
> > testing g.extension - it could be changed into a dynamically
> > approach as described in comment:7
>
> right, notice in the above comment:7 you get:
> {{{
> %~s1 = C:\PROGRA~1\GRASS-~2\
> }}}
>
> as you have more than 1 grass installed. Of course people will add and
remove different grasses after the initial install, so setting it to the
shortened version as it was at install time is not ideal.

but we are already there, see
(see
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/mswindows
/GRASS-Installer.nsi#L812)

{{{
;create the $INSTALL_DIR\msys\etc\fstab with the main grass dir mount info
ClearErrors
FileOpen $0 $INSTALL_DIR\msys\etc\fstab w
IfErrors done_create_fstab
FileWrite $0 '$INST_DIR_SHORT /grass$\r$\n'
FileClose $0
done_create_fstab:
}}}

which leads on my laptop after a lot install/deinstall from different
WinGrass64/65/70-versions to

{{{
C:\PROGRA~1\GRASS-~3 /grass
}}}

which is different of situation at installation time.

I have no idea at the moment if this (;create the
$INSTALL_DIR\msys\etc\fstab with the main grass dir mount info)affects a
WinGrass-installation?

> ps- why not "C:\Program Files\GRASS-6.4.SVN" ? -64- looks a little weird
to me and could be confused with 64bit. does the .4 or .svn get mistaken
for a file type? On the other hand, final \GRASS-64 (or is it GRASS-640?)
fits into 8.3 already which avoids some of the shortname headaches. Same
for the names in the Start menu structure.

I would vote for a rearrangement/renaming of the WinGrass-installation if
this could enhance the situation.

any hints for suitable naming convention for the different WinGrass-
Versions?

Helmut

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1178#comment:17&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hellik):

Replying to [comment:16 hamish]:
>
> ps- why not "C:\Program Files\GRASS-6.4.SVN" ? -64- looks a little weird
to me and could be confused with 64bit. does the .4 or .svn get mistaken
for a file type?

for example I have different examples of installation paths in my
WinVista-box which are working:

C:\Program Files\ET GeoTools 9.4 for ArcGIS 9.2
C:\Program Files\MSXML 4.0
C:\Program Files\OpenOffice.org 3
C:\Program Files\Scribus 1.3.5.1
C:\Program Files\Notepad++

Helmut

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1178#comment:18&gt;
GRASS GIS <http://grass.osgeo.org>

#1178: WinGrass: g.extension - problem with path to $GISBASE
---------------------------------------------------------------+------------
Reporter: hellik | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Installation | Version: svn-releasebranch64
Keywords: wingrass, g.extension, path, installation, addons | Platform: MSWindows Vista
      Cpu: x86-32 |
---------------------------------------------------------------+------------

Comment(by hamish):

{{{
FileOpen $0 $INSTALL_DIR\msys\etc\fstab w
IfErrors done_create_fstab
FileWrite $0 '$INST_DIR_SHORT /grass$\r$\n'
}}}

IIRC the fstab file was one of the MSys dev's "we don't support spaces in
path names and won't even accept bugfix patches" fun times. (/etc/fstab is
whitespace delimited)

Should we (can we?) rewrite that file each time at program startup to
reflect the current shortname version of the path?

no reports of it breaking anything (yet).

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1178#comment:19&gt;
GRASS GIS <http://grass.osgeo.org>