[GRASS-dev] [GRASS GIS] #2116: r.kappa: call to r.stats fails if spaces in path

#2116: r.kappa: call to r.stats fails if spaces in path
-------------------------+--------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Default | Version: svn-releasebranch64
Keywords: kappa path | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
To reproduce with GISBASE="GRASS DATA":

{{{
r.kappa classification=landclass96@PERMANENT
reference=landuse96_28m@PERMANENT

Sorry <DATA/nc_spm_08/user1/.tmp/moritz/31976.0> is not a valid option
}}}

The attached patch solves the problem for me, but I imagine that there is
a more elegant solution.

Moritz

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

#2116: r.kappa: call to r.stats fails if spaces in path
-------------------------+--------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Default | Version: svn-releasebranch64
Keywords: kappa path | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by hamish):

Replying to [ticket:2116 mlennert]:
> The attached patch solves the problem for me, but I imagine that
> there is a more elegant solution.

right, we should use G_vspawn_ex() instead of system(). It's already done
for r.kappa in G7; just needs to be backported & tested. see r40146 and
r44964.

In addition, as a minor style tweak/simplification I'd suggest to consider
using the r.stats output= file option instead of a shell redirect/dealing
with the stdout pipe.

regards,
Hamish

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

#2116: r.kappa: call to r.stats fails if spaces in path
-------------------------+--------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Default | Version: svn-releasebranch64
Keywords: kappa path | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by hamish):

on the other hand, for choosing the path of least change in the stable
branch your patch might be the way to go.

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

#2116: r.kappa: call to r.stats fails if spaces in path
---------------------------+------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: svn-releasebranch64
Keywords: r.kappa, path | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------
Changes (by hamish):

  * keywords: kappa path => r.kappa, path
  * component: Default => Raster

Old description:

To reproduce with GISBASE="GRASS DATA":

{{{
r.kappa classification=landclass96@PERMANENT
reference=landuse96_28m@PERMANENT

Sorry <DATA/nc_spm_08/user1/.tmp/moritz/31976.0> is not a valid option
}}}

The attached patch solves the problem for me, but I imagine that there is
a more elegant solution.

Moritz

New description:

To reproduce with GISDBASE="GRASS DATA":

{{{
r.kappa classification=landclass96@PERMANENT
reference=landuse96_28m@PERMANENT

Sorry <DATA/nc_spm_08/user1/.tmp/moritz/31976.0> is not a valid option
}}}

The attached patch solves the problem for me, but I imagine that there is
a more elegant solution.

Moritz

--

Comment:

simple quoting fix committed in devbr6 & relbr64 with r58111,2.

it should be tested in wingrass before closing the ticket, see the i.smap
help page for an example.

Hamish

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

#2116: r.kappa: call to r.stats fails if spaces in path
---------------------------+------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: svn-releasebranch64
Keywords: r.kappa, path | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by mlennert):

Replying to [comment:3 hamish]:
> simple quoting fix committed in devbr6 & relbr64 with r58111,2.
>
> it should be tested in wingrass before closing the ticket, see the
i.smap help page for an example.

Thanks a lot ! I hadn't applied the patch, yet, since you suggested
G_vspawn_ex(), and I didn't find the time to look into that. Should that
solution be preferred ? Should we maybe leave the ticket open as a
reminder, or should we just say that if it works in windows we're happy
with this quick fix for grass6 ?

Moritz

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

#2116: r.kappa: call to r.stats fails if spaces in path
---------------------------+------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: svn-releasebranch64
Keywords: r.kappa, path | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by glynn):

Replying to [comment:4 mlennert]:

> I hadn't applied the patch, yet, since you suggested G_vspawn_ex(), and
I didn't find the time to look into that. Should that solution be
preferred ?

The spawn functions are preferable (that's what r.kappa uses in 7.0), as
they avoid the shell altogether.

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

#2116: r.kappa: call to r.stats fails if spaces in path
---------------------------+------------------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.4
Component: Raster | Version: svn-releasebranch64
Keywords: r.kappa, path | Platform: Unspecified
      Cpu: Unspecified |
---------------------------+------------------------------------------------

Comment(by neteler):

Replying to [comment:5 glynn]:
> Replying to [comment:4 mlennert]:
>
> > I hadn't applied the patch, yet, since you suggested G_vspawn_ex(),
and I didn't find the time to look into that. Should that solution be
preferred ?
>
> The spawn functions are preferable (that's what r.kappa uses in 7.0), as
they avoid the shell altogether.

Backported to 6.5 in r60121 and to 6.4 in r60122. The result is identical
7.0.

Please test on Windows and close if solved.

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

#2116: r.kappa: call to r.stats fails if spaces in path
--------------------------+-------------------------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.4
Component: Raster | Version: svn-releasebranch64
Resolution: fixed | Keywords: r.kappa, path
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by mlennert):

  * status: new => closed
  * resolution: => fixed

Comment:

Replying to [comment:6 neteler]:
> Replying to [comment:5 glynn]:
> > Replying to [comment:4 mlennert]:
> >
> > > I hadn't applied the patch, yet, since you suggested G_vspawn_ex(),
and I didn't find the time to look into that. Should that solution be
preferred ?
> >
> > The spawn functions are preferable (that's what r.kappa uses in 7.0),
as they avoid the shell altogether.
>
> Backported to 6.5 in r60121 and to 6.4 in r60122. The result is
identical 7.0.
>
> Please test on Windows and close if solved.

Just tested on Windows 7 Virtual Machine with
WinGRASS-6.4.4svn-r60212-962-Setup.exe (yesterday's build) and GISDBASE
containing "GRASS DATA": it seems to work perfectly.

Closing.

Moritz

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