[GRASS-dev] [GRASS GIS] #1286: clean_temp can not be called before LCATION_NAME is set

#1286: clean_temp can not be called before LCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
clean_temp uses G_gisinit(argv[0]) and thus should never be run outside of
GRASS session, still it is used in init.bat before location name is set on
windows and is failing with error: "G_getenv(): Variable LOCATION_NAME not
set" Calling G_getenv on non-existing variable is an fatal error and thus
brings down whole startup procedure.

There are two possible solutions for this problem:
  * do not use clean_temp in init.bat
  * do not use G_gisinit() in clean_temp

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by glynn):

Replying to [ticket:1286 marisn]:

> There are two possible solutions for this problem:
   * do not use clean_temp in init.bat
   * do not use G_gisinit() in clean_temp

There is only one possible solution: the first one. The purpose of
clean_temp is to clean up the mapset's temp directory
(<database>/<location>/<mapset>/.tmp/<hostname>). If you don't have a
database/location/mapset set, clean_temp can't work.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by martinl):

  * keywords: => wingrass

Comment:

Replying to [ticket:1286 marisn]:
> clean_temp uses G_gisinit(argv[0]) and thus should never be run outside
of GRASS session, still it is used in init.bat before location name is set
on windows and is failing with error: "G_getenv(): Variable LOCATION_NAME
not set" Calling G_getenv on non-existing variable is an fatal error and
thus brings down whole startup procedure.
>
> There are two possible solutions for this problem:
> * do not use clean_temp in init.bat
> * do not use G_gisinit() in clean_temp

Probably I overlooked something, `clean_temp` is called in `init.bat` on
three different places. When I disable redirecting to nuldev and run GRASS
with `init.bat` I am getting no error messages and `clean_tmp` seems to
work well.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by marisn):

All three places of clean_tmp can be reached without LOCATION_NAME being
set.
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/init.ba

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by martinl):

Replying to [comment:3 marisn]:
> All three places of clean_tmp can be reached without LOCATION_NAME being
set.
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/init.ba

On which conditions? Seems to work here without any problem.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by martinl):

Replying to [comment:4 martinl]:
> Replying to [comment:3 marisn]:
> > All three places of clean_tmp can be reached without LOCATION_NAME
being set.
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/init.ba
>
> On which conditions? Seems to work here without any problem.

Please provide more precise information, it's marked as a "blocker"...

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by martinl):

  * priority: blocker => critical

Comment:

> > > All three places of clean_tmp can be reached without LOCATION_NAME
being set.
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/init.ba
> >
> > On which conditions? Seems to work here without any problem.
>
> Please provide more precise information, it's marked as a "blocker"...

downgrading priority at this point

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: critical | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by hamish):

Replying to [comment:4 martinl]:
> Replying to [comment:3 marisn]:
> > All three places of clean_tmp can be reached without LOCATION_NAME
being set.
http://trac.osgeo.org/grass/browser/grass/branches/releasebranch_6_4/lib/init/init.ba
>
> On which conditions? Seems to work here without any problem.

try removing the %HOME%/.grassrc6 file or installing on a fresh system/VM.

And/or cancel after initial startup with a new .grassrc6 file containing
location (etc) set to <UNKNOWN>, then restart.

Or delete/rename the GISDBASE, LOCATION, or MAPSET dir which happens to be
the last one used.

The .bat file just checks that the rc file exists in %HOME%, not that it
contains valid entries, and if it's the same as init.sh, the operational
version used by G_*() isn't the one in $HOME anyway.

I'm not sure if init.sh is terribly better about it checking validity, but
the question is if it creates a fatal script exit in the WinGrass startup,
while a similar problem would just create a harmless error message to the
console on UNIX.
??

Hamish

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1286#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LOCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.1
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by hamish):

  * priority: critical => major

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/1286#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LOCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.4
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by neteler):

  * milestone: 6.4.1 => 6.4.4

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#1286: clean_temp can not be called before LOCATION_NAME is set
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: major | Milestone: 6.4.4
Component: Startup | Version: 6.4.1 RCs
Keywords: wingrass | Platform: MSWindows Vista
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by neteler):

See also #560: WinGRASS not deleting temp ppm files from map display

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1286#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>