[GRASS-SVN] r73342 - grass/trunk/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Sep 15 20:46:04 PDT 2018


Author: wenzeslaus
Date: 2018-09-15 20:46:04 -0700 (Sat, 15 Sep 2018)
New Revision: 73342

Modified:
   grass/trunk/lib/init/grass.py
Log:
init: clean mapset only after locking it (fixes #613, see #1286)

Only after we set the user-requested mapset as current (GISRC) and lock it,
we can do the startup cleaning using clean_temp (to clean after previous sessions
if needed).

The cleaning was in place at least since r11260 but it got moved to a wrong place some
time after that but before r37863.


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2018-09-16 03:21:45 UTC (rev 73341)
+++ grass/trunk/lib/init/grass.py	2018-09-16 03:46:04 UTC (rev 73342)
@@ -2081,10 +2081,6 @@
                     "See also: https://grass.osgeo.org/{cmd_name}/manuals/helptext.html").format(
                         cmd_name=cmd_name, gisrcrc=gisrcrc))
         create_initial_gisrc(gisrc)
-    else:
-        # clean only for user who is no first time
-        # (measured by presence of rc file)
-        clean_temp()
 
     message(_("Starting GRASS GIS..."))
 
@@ -2142,6 +2138,11 @@
     # unlock the mapset which is current at the time of turning off
     # in case mapset was changed
     atexit.register(lambda: unlock_gisrc_mapset(gisrc, gisrcrc))
+    # We now own the mapset (set and lock), so we can clean temporary
+    # files which previous session may have left behind. We do it even
+    # for first time user because the cost is low and first time user
+    # doesn't necessarily mean that the mapset is used for the first time.
+    clean_temp()
     # clean always at exit, cleans whatever is current mapset based on
     # the GISRC env variable
     atexit.register(clean_temp)



More information about the grass-commit mailing list