[GRASS5] [bug #3362] (grass) r.proj works ONLY when source and target mapset names are identical

Glynn Clements glynn at gclements.plus.com
Thu Jun 23 12:55:46 EDT 2005


Morten Hulden wrote:

> >>It is trying to create a .tmp in a non-existant mapset! Like if it
> >>couldn't read that the source mapset is PERMANENT. Somehow the
> >>source and target mapset names get mixed.
> > 
> > 
> > This is a very good reason not to use G_tempfile() for normal
> > temporary files.
> > 
> > There is no guarantee that the user can create files or directories
> > within the source location.
> 
> So, not a r.proj specific problem then. A lot of modules may suffer from 
> using G_tempfile().

Yep, including anything which uses G_asprintf().

> r.proj is not calling G_tempfile() directly. In the case mentioned above 
> suspects are datum.c, get_datum_name.c, get_ell_name.c or some other 
> function from /lib/gis files.
> 
> What is the correct fix? To rewrite G_tempfile()?

The correct fix would be to not have misused G_tempfile() extensively
throughout GRASS in the first place. Unfortunately, we're a bit too
far gone for that.

The best solution now is to:

1. Rename G_tempfile().

2. Modify legitimate callers of G_tempfile() to use the renamed
function.

3. Implement a new G_tempfile() which uses $TMPDIR or /tmp.

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




More information about the grass-dev mailing list