[GRASS5] Re: [GRASSLIST:7160] length restriction on raster names?

[CC'd to developers' list]

Vincent Schut wrote:

is there a length restriction on GRASS raster names, especially when
used in an imaginary group? I have several rasters with quite long names
(like: '20020101_20030101_normalized_min'). I can access these fine, but
when I add them to a group, this doesn't work and the REF file of the
group seems garbage: the raster names looks like they have been cut at
something around 20 characters. Is this intentional?

Looking at the imagery.h header, I notice:

  struct Ref
  {
      int nfiles;
      struct Ref_Files
      {
    char name[30]; /* length is not in sync with other definitions */
    char mapset[30];
      } *file;

That suggests that map names are limited to 30 bytes (29 bytes plus a
terminating NUL).

There isn't a global setting for the maximum length of a map name
(although there probably should be). I note that "struct Reclass"
allows for 50 bytes. Other code which allocates fixed-sized buffers
for map names commonly allocates 100, 256 or 512 bytes (the last one
is likely to exceed the maximum length of a filename on most operating
systems).

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