[GRASS-dev] Re: [GRASS GIS] #718: r.li forgets mask/illegal filename
GRASS GIS
trac at osgeo.org
Tue Aug 18 00:19:35 EDT 2009
#718: r.li forgets mask/illegal filename
------------------------+---------------------------------------------------
Reporter: kyngchaos | Owner: grass-dev at lists.osgeo.org
Type: defect | Status: new
Priority: normal | Milestone: 6.4.0
Component: Raster | Version: 6.4.0 RCs
Resolution: | Keywords: r.li, smp
Platform: All | Cpu: All
------------------------+---------------------------------------------------
Comment (by glynn):
Replying to [comment:16 hamish]:
> ok, with the help of Nathan's backtrace in today's grass-user post I
tracked it down to this:
>
> source:grass/trunk/raster/r.li/r.li.daemon/daemon.c at 38766#L397
> i.e. strtok() is '''not thread safe''' and it is being used in a thread.
The result is breakage. And strtok_r() is not as portable as we require.
strtok_r() is specified by POSIX. It doesn't exist on Windows (although
Windows does have strtok_s(), which appears to be identical except for the
name), but r.li doesn't work on Windows for more substantial reasons (e.g.
fork()).
I've attached a patch (against current 7.0) to use strtok_r() instead of
strtok().
> in light of that, could our G_tokenize() help?
G_tokenize() uses a single set of delimiters, while the r.li code uses
vertical bar, space and newline. It may be possible to first split the
text into lines with G_tokenize(str, "\n"), then into fields with vertical
bar and/or space; it depends upon the structure of the data.
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/718#comment:17>
GRASS GIS <http://grass.osgeo.org>
More information about the grass-dev
mailing list