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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 11 02:22:34 PDT 2018


Author: marisn
Date: 2018-10-11 02:22:33 -0700 (Thu, 11 Oct 2018)
New Revision: 73519

Modified:
   grass/trunk/lib/init/grass.py
Log:
init: Do not fail if directory exists (observed in a case of race condition)


Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2018-10-10 13:24:13 UTC (rev 73518)
+++ grass/trunk/lib/init/grass.py	2018-10-11 09:22:33 UTC (rev 73519)
@@ -435,7 +435,14 @@
         grass_config_dirname = ".grass7"
         directory = os.path.join(os.getenv('HOME'), grass_config_dirname)
     if not os.path.exists(directory):
-        os.mkdir(directory)
+        try:
+            os.mkdir(directory)
+        except OSError as e:
+            # Can happen as a race condition
+            if not e.errno == 17:
+                fatal(
+                    _("Failed to create configuration directory '%s' with error: %s")
+                    % (directory, e.strerror))
     return directory
 
 



More information about the grass-commit mailing list