[GRASS-dev] No longer able to open a mapset by symbolic link

Glynn Clements glynn at gclements.plus.com
Tue Apr 3 01:29:31 EDT 2007

Joel Pitt wrote:

> > > I'll submit a bug request, but wasn't sure whether this behaviour has
> > > been discussed and decided as intended. I hope not, because I use it
> > > to separate out simulation results (huge and stored on an external
> > > server/HDD) and input data for the simulations (stored locally).
> >
> > AFAIK, having symlinks to mapset directories has never been
> > intentionally supported; it just happened to work.
> I've worked out a simple solution. In lib/gis/paths.c :
> int G_lstat(const char *file_name, struct stat *buf)
> {
> #ifdef __MINGW32__
>     return stat(file_name, buf);
> #else
>     return lstat(file_name, buf);
> #endif
> }
> lstat(...) stats the link itself. Is there any reason why stat(...),
> which follows a link instead, can't be used for both platforms?

Some of the uses of G_lstat() require the use of lstat(); e.g. 
G_remove() uses it for directory traversal, which should treat
symlinks as leaf nodes (i.e. shouldn't traverse symlinks to
directories as if they were directories).

It may be worth having a separate G_stat() function, but G_lstat()
cannot be changed.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-dev mailing list