[GRASS5] [bug #1797] (grass) g.gisenv

sorry about that last empty message, pressed enter in the wrong place.

With respect to being able to set a new mapset after the old has been set
incorrectly with g.gisenv, this seems to work fine, thanks. Can you forsee any
unwanted repercussions?

--- grass/src/general/g.gisenv/main.c Sat Apr 12 18:24:38 2003
+++ grass/src/general/g.gisenv/main.c.NEW Thu Apr 17 15:43:02 2003
@@ -12,7 +12,8 @@
     struct Option *get, *set;
     struct GModule *module;
     
- G_gisinit (argv[0]);
+ G_set_program_name(argv[0]);
+ G_no_gisinit();

     module = G_define_module();
     module->description =

I'm still looking for a (gis lib) way of testing to see if a mapset/whatever
exists without the library function generating a fatal error. ?
(for test before G_setenv)

> Subject: g.gisenv
>
> g.gisenv lets you set a variable to nonexistant values without a check,
> and the only way to go on is to exit GRASS and delete/edit the .grassrc5
> file.
>
> any ideas?

g.gisenv calls G_gisinit(), which generates a fatal error if the
mapset directory doesn't exist or has incorrect permissions (i.e.
ownership).

Using:

  G_set_program_name(argv[0]);
  G_no_gisinit();

should work.

-------------------------------------------- Managed by Request Tracker

Harmisch Bowman via RT wrote:

With respect to being able to set a new mapset after the old has been set
incorrectly with g.gisenv, this seems to work fine, thanks. Can you forsee any
unwanted repercussions?

No. The only code which is actually bypassed by that change is the
check for a valid database/location/mapset. I've looked through the
various parts of libgis which could be called (basically parser.c and
env.c), and I can't see any way in which this could matter.

I'm still looking for a (gis lib) way of testing to see if a mapset/whatever
exists without the library function generating a fatal error. ?
(for test before G_setenv)

G__mapset_permissions() should do the job. The database and location
parameters need to be set; the mapset is passed as a parameter.

I wouldn't recommend adding special-case checks to g.gisenv. However,
it would be useful to have a better way to change the GISDBASE,
LOCATION_NAME and MAPSET parameters. Either a dedicated utility, or a
re-write of the set_data program.

BTW, a few things still don't like database/location/mapset switching;
primarily tcltkgrass (this needs to call g.gisenv for each operation,
rather than just at the start of the program) and XDRIVER's resize
handling (which should just be removed).

--
Glynn Clements <glynn.clements@virgin.net>