[GRASS5] [bug #3469] (grass) about i.class

this bug's URL: http://intevation.de/rt/webrt?serial_num=3469
-------------------------------------------------------------------------

Subject: about i.class

Platform: GNU/Linux/i386
grass obtained from: CVS
grass binary for platform: Compiled from Sources

I am working with GRASS61, I try with i.class for supervised classification. After drawing the region on image I click to the Analyze region Menu, I get this error message WARNING:PREPARE_SIGNATURE: DATA ERROR (CLICK MOUSE TO CONTINUE). It seem that all the regions that I chose before now disappear. I try again with GRASS57, the result is also the same. Can you solve this problem for me? Thank you very much,
Best regards,
Tran Van Anh

-------------------------------------------- Managed by Request Tracker

On Sun, 2005-07-31 at 09:46 +0200, Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=3469
-------------------------------------------------------------------------

Subject: about i.class

Platform: GNU/Linux/i386
grass obtained from: CVS
grass binary for platform: Compiled from Sources

I am working with GRASS61, I try with i.class for supervised classification. After drawing the region on image I click to the Analyze region Menu, I get this error message WARNING:PREPARE_SIGNATURE: DATA ERROR (CLICK MOUSE TO CONTINUE). It seem that all the regions that I chose before now disappear. I try again with GRASS57, the result is also the same. Can you solve this problem for me? Thank you very much,
Best regards,
Tran Van Anh

I traced this back to INAME_LEN being changed from 30 to 256 in
include/imagery.h.

This makes lib/vask/V_ques.c: V_ques() bomb out starting at line:

if ((length <= 0) || ((length + col) > 80)) ...

where the variable 'length' is passed in as INAME_LEN.

The program keeps running until it dies with a floating point exception.

--
Brad Douglas <rez@touchofmadness.com>

On Sun, Aug 07, 2005 at 09:19:01PM -0700, Brad Douglas wrote:

On Sun, 2005-07-31 at 09:46 +0200, Request Tracker wrote:
> this bug's URL: http://intevation.de/rt/webrt?serial_num=3469
> -------------------------------------------------------------------------
>
> Subject: about i.class
>
> Platform: GNU/Linux/i386
> grass obtained from: CVS
> grass binary for platform: Compiled from Sources
>
> I am working with GRASS61, I try with i.class for supervised classification. After drawing the region on image I click to the Analyze region Menu, I get this error message WARNING:PREPARE_SIGNATURE: DATA ERROR (CLICK MOUSE TO CONTINUE). It seem that all the regions that I chose before now disappear. I try again with GRASS57, the result is also the same. Can you solve this problem for me? Thank you very much,
> Best regards,
> Tran Van Anh

I traced this back to INAME_LEN being changed from 30 to 256 in
include/imagery.h.

This makes lib/vask/V_ques.c: V_ques() bomb out starting at line:

if ((length <= 0) || ((length + col) > 80)) ...

where the variable 'length' is passed in as INAME_LEN.

The program keeps running until it dies with a floating point exception.

Brad,

the bug discovered by you is probably a new bug.

Miss Van Anh reports that GRASS57 also failed.

For testing, the LANDSAT-7 scene prepared for the Spearfish location
http://mpa.itc.it/grasstutor/data_menu2nd.phtml
-> p033r029_20000712_NAD27_small.tar.gz
may be used.

for i in p033*.tif ; do
    NAME=`echo $i | cut -d'_' -f4`
    r.in.gdal $i out=$NAME
done

i.group gr=lsat subgroup=lsat in=nn10,nn20,nn30,nn40,nn50,nn70
i.class

i.class
V_ask error: Length out of bounds in call to V_ques
V_ask error: Length out of bounds in call to V_ques

Now I see the new bug, coming from
lib/imagery/
vask_group.c: V_ques (group, 's', line++, 10, INAME_LEN);

Attached patch cures *this* problem. Apply to CVS?

Then I made a quick test using i.class.
For me the reported error "prepare_signature: data error." doesn't happen.

Markus

(attachments)

vask_group.diff (1.14 KB)

Brad Douglas wrote:

> this bug's URL: http://intevation.de/rt/webrt?serial_num=3469
> -------------------------------------------------------------------------
>
> Subject: about i.class

> I am working with GRASS61, I try with i.class for supervised
> classification. After drawing the region on image I click to the
> Analyze region Menu, I get this error message
> WARNING:PREPARE_SIGNATURE: DATA ERROR (CLICK MOUSE TO CONTINUE). It
> seem that all the regions that I chose before now disappear. I try
> again with GRASS57, the result is also the same. Can you solve this
> problem for me? Thank you very much,

I traced this back to INAME_LEN being changed from 30 to 256 in
include/imagery.h.

This makes lib/vask/V_ques.c: V_ques() bomb out starting at line:

if ((length <= 0) || ((length + col) > 80)) ...

where the variable 'length' is passed in as INAME_LEN.

The program keeps running until it dies with a floating point exception.

The attached patch changes V_ques() so that it truncates the length so
that col + length <= 80 rather than returning an error. It also
requires the starting column to be less than 80, rather than less than
or equal to 80.

The caller doesn't actually check the return value of V_ques(), and I
suspect that this is quite common. Maybe V_ques() should just use
G_fatal_error()?

Or maybe the imagery stuff should be weaned off of vask altogether.
AFAICS, the only code in 6.1 which still uses vask is:

  i.ortho.photo
  lib/imagery
  set_data
  r.le.setup
  v.transform

lib/edit also uses it, but lib/edit is only used by set_data.

--
Glynn Clements <glynn@gclements.plus.com>

(attachments)

V_ques.c.diff (897 Bytes)

On Mon, 2005-08-08 at 15:29 +0100, Glynn Clements wrote:

Brad Douglas wrote:

> > this bug's URL: http://intevation.de/rt/webrt?serial_num=3469
> > -------------------------------------------------------------------------
> >
> > Subject: about i.class

> > I am working with GRASS61, I try with i.class for supervised
> > classification. After drawing the region on image I click to the
> > Analyze region Menu, I get this error message
> > WARNING:PREPARE_SIGNATURE: DATA ERROR (CLICK MOUSE TO CONTINUE). It
> > seem that all the regions that I chose before now disappear. I try
> > again with GRASS57, the result is also the same. Can you solve this
> > problem for me? Thank you very much,

> I traced this back to INAME_LEN being changed from 30 to 256 in
> include/imagery.h.
>
> This makes lib/vask/V_ques.c: V_ques() bomb out starting at line:
>
> if ((length <= 0) || ((length + col) > 80)) ...
>
> where the variable 'length' is passed in as INAME_LEN.
>
> The program keeps running until it dies with a floating point exception.

The attached patch changes V_ques() so that it truncates the length so
that col + length <= 80 rather than returning an error. It also
requires the starting column to be less than 80, rather than less than
or equal to 80.

The caller doesn't actually check the return value of V_ques(), and I
suspect that this is quite common. Maybe V_ques() should just use
G_fatal_error()?

I vote for applying Markus's quick-fix patch and filing a bug until a
more appropriate solution is developed (getting rid of vask?).

--
Brad Douglas <rez@touchofmadness.com>

On Mon, Aug 08, 2005 at 03:29:56PM +0100, Glynn Clements wrote:
Content-Description: message body and .signature

Brad Douglas wrote:

> > this bug's URL: http://intevation.de/rt/webrt?serial_num=3469
> > -------------------------------------------------------------------------
> >
> > Subject: about i.class

> > I am working with GRASS61, I try with i.class for supervised
> > classification. After drawing the region on image I click to the
> > Analyze region Menu, I get this error message
> > WARNING:PREPARE_SIGNATURE: DATA ERROR (CLICK MOUSE TO CONTINUE). It
> > seem that all the regions that I chose before now disappear. I try
> > again with GRASS57, the result is also the same. Can you solve this
> > problem for me? Thank you very much,

> I traced this back to INAME_LEN being changed from 30 to 256 in
> include/imagery.h.
>
> This makes lib/vask/V_ques.c: V_ques() bomb out starting at line:
>
> if ((length <= 0) || ((length + col) > 80)) ...
>
> where the variable 'length' is passed in as INAME_LEN.
>
> The program keeps running until it dies with a floating point exception.

The attached patch changes V_ques() so that it truncates the length so
that col + length <= 80 rather than returning an error. It also
requires the starting column to be less than 80, rather than less than
or equal to 80.

The caller doesn't actually check the return value of V_ques(), and I
suspect that this is quite common. Maybe V_ques() should just use
G_fatal_error()?

Or maybe the imagery stuff should be weaned off of vask altogether.
AFAICS, the only code in 6.1 which still uses vask is:

  i.ortho.photo
  lib/imagery
  set_data
  r.le.setup
  v.transform

lib/edit also uses it, but lib/edit is only used by set_data.

--
Glynn Clements <glynn@gclements.plus.com>

Applying Glynn's patch and modifying imagery/vask_group.c back
to INAME_LEN and layout cosmetics, we could have:

LOCATION: spearfish60 SUPERVISED CLASSIFIER MAPSET: user1

Please select the group/subgroup to be analyzed

           'list' will show available groups:
GROUP: ______________________________________________________________________
           'list' will show available subgroups:
SUBGROUP: ______________________________________________________________________

If it looks reasonable, I'll submit - or modify to your suggestions.

Markus