[GRASS-dev] Re: [GRASS GIS] #783: r.watershed fails on wingrass
GRASS GIS
trac at osgeo.org
Fri Oct 16 13:12:58 EDT 2009
#783: r.watershed fails on wingrass
---------------------------+------------------------------------------------
Reporter: hamish | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: major | Milestone: 6.4.0
Component: Raster | Version: 6.4.0 RCs
Resolution: | Keywords: r.watershed, wingrass
Platform: MSWindows XP | Cpu: x86-32
---------------------------+------------------------------------------------
Comment (by glynn):
Replying to [comment:12 hamish]:
> > and without Administrator privileges you may be unable to
> > install GRASS in a directory which doesn't contain spaces.
>
> Can you install to your Windows home dir or desktop anyway?
You ought to be able to create files in that directory, although the
administrator could have added an ACL which prohibits execution (although
I'm not all that sure what "execute" permission really means on Windows).
If you're a member of the "Power Users" group, you can also create files
in the "Program Files" (etc) directory.
But both of those have spaces in the name; Microsoft may have even done
this intentionally to force developers to handle spaces in pathnames. The
only standard directory which doesn't have spaces in the name is the
"Windows" directory, and we shouldn't be putting anything there even if we
could.
> note that MSys devs do not seem interested in accepting patches which
allow it to work in directories containing spaces, so it may be a long
wait until this is more than an academic issue.
Where does MSys' come into this?
We're talking about one binary executable invoking another via system() or
G_system() (which uses cmd.exe on Windows). MSys doesn't have any effect
upon this even if it's installed.
> > In short, I could not find a way to make it work with quotes on
> > windows (BTW, neither osgeo4w nor mingw-w64 with XP 64bit).
>
> the easiest and least invasive solution seems to me to just replace
system("") with G_spawn($0, **list).
I can't guarantee that G_spawn() works correctly on Windows; I suspect
that it still needs more testing (with usable feedback) than it has
received so far.
I note that Microsoft's documentation for the _spawn* functions says that
the caller is supposed to quote arguments (which isn't happening at
present), but I don't think that applies to the executable name.
In any case, G_spawn() only offers a _spawnl() interface, while
r.watershed would need a _spawnv() interface, as the argument list can
vary at run-time. Using G_vspawn_ex() might be a solution.
In any case, I don't doubt that it is possible to make it work using
system(); it just needs someone who cares enough about getting 6.4 working
on Windows to spend more time on it.
One of the first Google hits for "windows command syntax" suggests that
two "levels" of quotes are required:
{{{
CMD /k ""c:\batch files\test.cmd" "Parameter 1 with space" "Parameter2
with space""
}}}
Brief testing from the command line confirms this. I suggest trying this
with both system() and G_system(); if the two don't match, then G_system()
needs to add the outermost quotes itself.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/783#comment:13>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list