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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Oct 12 01:09:50 PDT 2015


Author: lucadelu
Date: 2015-10-12 01:09:50 -0700 (Mon, 12 Oct 2015)
New Revision: 66473

Modified:
   grass/trunk/lib/init/grass.py
Log:
init/grass.py: check if owner mapset is valid

Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py	2015-10-12 07:11:01 UTC (rev 66472)
+++ grass/trunk/lib/init/grass.py	2015-10-12 08:09:50 UTC (rev 66473)
@@ -1161,6 +1161,13 @@
     """
     if not os.path.exists(mapset_path):
         fatal(_("Path '%s' doesn't exist") % mapset_path)
+    if not os.access(mapset_path, os.W_OK):
+        error = "Path '%s' not accessible.\n" % mapset_path
+        stat_info = os.stat(mapset_path)
+        mapset_uid = stat_info.st_uid
+        if mapset_uid != os.getuid():
+            error += "You are not the owner of '%s'" % mapset_path
+        fatal(_(error))
     # Check for concurrent use
     lockfile = os.path.join(mapset_path, ".gislock")
     ret = call([gpath("etc", "lock"), lockfile, "%d" % os.getpid()])



More information about the grass-commit mailing list