[GRASS-dev] Re: [GRASS-user] barin option in r.flow module

Markus Neteler neteler at osgeo.org
Sun Dec 21 03:58:56 EST 2008


On Sun, Dec 21, 2008 at 5:56 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
>
> Markus Neteler wrote:
>
>> >> Hello everybody,
>> >> I have got some troubles using r.flow with this option..it stays forever
>> >> at the:
>> >> Reading input files: elevation...
>> >> , barrier
>> >> If I remove the barin option, all is fine.
>> >> I am using the DEM from spearfish with GRASS 6.2.3 and latest 6.4svn.
>> >>
>> > This is how replicate using Spearfish dataset:
>> > g.region rast=elevation.10m
>> > v.to.rast input=streams at PERMANENT output=streamsTest use=val type=line layer=1 value=1 rows=4096 --overwrite
>> > r.null map=streamsTest null=0
>> > r.report units=me map=streamsTest | grep "no data"
>> > r.flow elevin=elevation.10m barin=streamsTest skip=37 bound=9432 flout=testvector lgout=testraster
>>
>> I can reproduce the crash (one typo fixed in above example):
>>
>>
>> (gdb) r elevin=elevation.10m barin=streamTest skip=37 bound=9432 flout=testvector lgout=testraster
>
>> Reading input files: barrier
>>
>> Program received signal SIGSEGV, Segmentation fault.
>> [Switching to Thread 47222862720544 (LWP 24952)]
>> 0x00000000004050b8 in read_input_files () at io.c:121
>> 121                         put(ds, row, col, -1);
>
> Initialisation of ds is conditional upon parm.dsout, which isn't set.
>
> This should fix the immediate problem:
>
> --- raster/r.flow/io.c  (revision 34960)
> +++ raster/r.flow/io.c  (working copy)
> @@ -117,7 +117,7 @@
>            G_get_d_raster_row(fd, barc, row);
>            for (col = 0; col < region.cols; col++) {
>                BM_set(bitbar, col, row, (barc[col] != 0));
> -               if (barc[col] != 0)
> +               if (parm.dsout && barc[col] != 0)
>                    put(ds, row, col, -1);
>            }
>        }

Thanks. Fixed in
7.svn, 6.4.svn, 6.4.0svn, 6.3.svn.

(note to devs: the backporting took about 30 seconds in total).

> but I don't know if there are similar cases. If the two are intimately
> related, then main() will need e.g.:
>
>        if (parm.barin && !parm.dsout)
>            G_fatal_error(_("barin= requires dsout="));

I have left that out for now as it does not seem to be a requirement.
Maybe Helena has a suggestion here.

Markus


More information about the grass-dev mailing list