[GRASS-dev] Re: [GRASS-user] g.list type=rast gives floating point
glynn at gclements.plus.com
Wed Oct 18 12:45:00 EDT 2006
Patton, Eric wrote:
> Using 2006-10-18 cvs, I get a floating point exception when running g.list
> type=rast, with no output produced. Strangely, g.list -f rast gives me a
> full verbose listing of all rasters in my mapset. g.list type=vect and
> g.list type=region also work fine.
> Any ideas what's going on?
"g.list -f" invokes the $GISBASE/etc/lister/<type> program to list the
maps; without -f, the G_list_element() function is used.
If there exists a map whose name is 80 characters or longer,
G_list_element() will end up dividing by zero, which will normally
result in a floating-point exception.
 It computes the number of columns as:
num_cols = 80 / (maxlen + 1); /* + 1: column separator */
where maxlen is the length of the longest map name in the list. If the
denominator is greater than 80, num_cols will be zero. num_cols is
used as the RHS of the % (modulus) operator, hence the division by
zero. I'll add a test for that case.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev