Skip to content

Commit

Permalink
init: clean mapset only after locking it (fixes https://trac.osgeo.or…
Browse files Browse the repository at this point in the history
…g/grass/ticket/613, see https://trac.osgeo.org/grass/ticket/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 https://trac.osgeo.org/grass/changeset/11260 but it got moved to a wrong place some
time after that but before r37863.


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@73342 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
wenzeslaus committed Sep 16, 2018
1 parent 172963f commit 4e670a3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/init/grass.py
Original file line number Diff line number Diff line change
Expand Up @@ -2081,10 +2081,6 @@ def main():
"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..."))

Expand Down Expand Up @@ -2142,6 +2138,11 @@ def main():
# 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)
Expand Down

0 comments on commit 4e670a3

Please sign in to comment.