[GRASS5] raster filename length problem
Markus Neteler
neteler at itc.it
Thu Jul 14 04:45:10 EDT 2005
On Thu, Jul 14, 2005 at 02:00:08AM +0100, Glynn Clements wrote:
>
> Markus Neteler wrote:
>
> > > More generally, it would help if we had standardised NAME_MAX and
> > > MAPSET_MAX constants, rather than having arbitrary integer literals
> > > scattered all over the code.
> >
> > I'll try whenever I come across NAME/MAPSET definitions to set them
> > to NAME_MAX,MAPSET_MAX. Before adding those to gis.h, how long?
> > Is 100 ok during the migration to NAME_MAX,MAPSET_MAX? I'm not
> > sure how to capture string overflows.
>
> The set_data program limits the location and mapset to 25 characters
> each (not including the terminating NUL).
In lib/init/set_data.c we have
char gisdbase[70];
char location_name[41] ;
char location[1024] ;
char mapset[41] ;
V_ques (location_name, 's', line++, 12, 25);
...
V_ques (mapset, 's', line++, 12, 25);
...
V_ques (gisdbase, 's', line++, 10, sizeof(gisdbase) - 1);
Which looks a bit messy to me.
Is there a problem to set things to GNAME_NAME length?
> I suggest 256 for NAME_MAX
> (most filesystems impose a limit of 255 bytes or less for filenames).
>
> I can't think of a reliable way of locating undersized buffers other
> than waiting for bug reports.
For me that's fine. I'll change locally to this value to see what happens.
With a few scripts things could be tested automatically (use g.proj to
generate new locations with long names in different projections;
use r.mapcalc or r.surf.fractal to generate landscapes etc).
Markus
More information about the grass-dev
mailing list