Opened 10 years ago

Last modified 7 years ago

#2511 new defect

Starting GRASS in mapset which is not owned by the user

Reported by: wenzeslaus Owned by: grass-dev@…
Priority: normal Milestone: 7.2.4
Component: Startup Version: unspecified
Keywords: access, database Cc:
CPU: Unspecified Platform: Unspecified

Description

When GRASS is started in a mapset which is not owned by the current user, the error handling is not very nice.

The following is behavior of 7.0 release branch approximately a month old (r62598, before introduction of exceptions to *_command functions).

Error dialog after a start of GUI (note that the text and traceback does not fit together):

Unable to get current geographic extent. Force quiting wxGUI. Please manually run g.region to fix the problem.

Reason: 'version'

Traceback (most recent call last):
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/lmgr/frame.py", line 93, in __init__
    grassVersion = grass.version()['version']
KeyError: 'version'

Terminal shows GRASS prompt and contains at that point "permission denied" and "unable to get GRASS version" errors.

ERROR: MAPSET PERMANENT - permission denied
ERROR: MAPSET PERMANENT - permission denied
Unable to get GRASS version

GRASS_INFO_ERROR(28313,1): MAPSET PERMANENT - permission denied
GRASS_INFO_END(28313,1)

GRASS_INFO_ERROR(28314,1): MAPSET PERMANENT - permission denied
GRASS_INFO_END(28314,1)

GRASS_INFO_ERROR(28317,1): MAPSET PERMANENT - permission denied
GRASS_INFO_END(28317,1)

Finally, after clicking OK in the GUI error dialog, GUI ends with the following traceback:

Traceback (most recent call last):
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 140, in <module>
    sys.exit(main())
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 133, in main
    app = GMApp(workspaceFile)
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 48, in __init__
    wx.App.__init__(self, False)
  File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 7981, in __init__
    self._BootstrapApp()
  File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 7555, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 82, in OnInit
    workspace = self.workspaceFile)
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/lmgr/frame.py", line 221, in __init__
    self.NewDisplay(show = False)
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/lmgr/frame.py", line 1727, in NewDisplay
    showMapDisplay = show)
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/lmgr/layertree.py", line 176, in __init__
    Map = self.Map)
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/mapdisp/frame.py", line 153, in __init__
    self.statusbarManager.Update()
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/mapdisp/statusbar.py", line 227, in Update
    item.Update() # mask, render
  File "/home/vpetras/dev/futures/grass70_release/dist.x86_64-unknown-linux-gnu/gui/wxpython/mapdisp/statusbar.py", line 810, in Update
    mapset = grass.gisenv()['MAPSET'])['name']:
KeyError: 'name'

You can run commands in the system command line but you get "permission denied".

g.list rast -p
ERROR: MAPSET PERMANENT - permission denied

However, this is not completely true because in my case, I can write there, I just don't own it, so I think the message should be more precise and contain information about different owner, e.g. "permission denied, you are not a owner of this mapset". Maybe even better would be:

ERROR: Permission denied for mapset <%s> because you are not the owner

In trunk approximately 2 weeks old (r62885), GUI does not start but the session in command line still starts. The error is coming from some call of tempfile() from render.py.

ERROR: MAPSET PERMANENT - permission denied
Traceback (most recent call last):
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 36, in <module>
    from lmgr.frame import GMFrame
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/lmgr/frame.py", line 50, in <module>
    from lmgr.layertree        import LayerTree, LMIcons
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/lmgr/layertree.py", line 37, in <module>
    from mapdisp.frame        import MapFrame
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/mapdisp/frame.py", line 65, in <module>
    class MapFrame(SingleMapFrame):
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/mapdisp/frame.py", line 71, in MapFrame
    page = None, Map = Map(), auimgr = None, name = 'MapWindow', **kwargs):
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/core/render.py", line 408, in __init__
    self.mapfile = grass.tempfile(create = False) + '.ppm'
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/core.py", line 702, in tempfile
    return read_command("g.tempfile", flags=flags, pid=os.getpid()).strip()
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/core.py", line 425, in read_command
    return handle_errors(returncode, stdout, args, kwargs)
  File "/opt/src/grass-trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/core.py", line 308, in handle_errors
    returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['g.tempfile', '-d', 'pid=27302'] ended with error
Process ended with non-zero return code 1. See errors in the (error) output.

Latest trunk (r63504) has different error of same sort, list_strings() fails when called from prompt.py.

MAPSET PERMANENT - permission denied
GRASS_INFO_END(27234,1)
Traceback (most recent call last):
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 142, in <module>
    sys.exit(main())
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 134, in main
    app = GMApp(workspaceFile)
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 49, in __init__
    wx.App.__init__(self, False)
  File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 7981, in __init__
    self._BootstrapApp()
  File "/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 7555, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/wxgui.py", line 83, in OnInit
    workspace = self.workspaceFile)
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/lmgr/frame.py", line 135, in __init__
    self.notebook  = self._createNoteBook()
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/lmgr/frame.py", line 301, in _createNoteBook
    gcstyle = GC_PROMPT)
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/gui_core/goutput.py", line 104, in __init__
    self.cmdPrompt = GPromptSTC(parent=self, menuModel=self._menuModel)
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/gui_core/prompt.py", line 137, in __init__
    GPrompt.__init__(self, parent = parent, menuModel = menuModel)
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/gui_core/prompt.py", line 56, in __init__
    self.mapList    = self._getListOfMaps()
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/gui/wxpython/gui_core/prompt.py", line 96, in _getListOfMaps
    result['raster'] = grass.list_strings('raster')
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/core.py", line 1108, in list_strings
    mapset=mapset).splitlines():
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/core.py", line 425, in read_command
    return handle_errors(returncode, stdout, args, kwargs)
  File "/home/vpetras/dev/grass/trunk/dist.x86_64-unknown-linux-gnu/etc/python/grass/script/core.py", line 308, in handle_errors
    returncode=returncode)
grass.exceptions.CalledModuleError: Module run None ['g.list', '--q', '-m', 'type=rast'] ended with error
Process ended with non-zero return code 1. See errors in the (error) output.

I think there is not point in fixing or improving any of these errors. The GRASS session should not start when in text mode and the startup/welcome window should not allow you to start in mapset where you cannot write (according to GRASS rules and settings). I don't know what is the right way of checking this? Is there a module for it? Or should we fix it in a different way?

Change History (6)

comment:1 by neteler, 9 years ago

Milestone: 7.1.07.2.0

Milestone renamed

comment:2 by neteler, 8 years ago

Milestone: 7.2.07.2.1

Ticket retargeted after milestone closed

comment:3 by martinl, 8 years ago

Milestone: 7.2.17.2.2

comment:4 by neteler, 7 years ago

Milestone: 7.2.27.2.3

Ticket retargeted after milestone closed

comment:5 by martinl, 7 years ago

Milestone: 7.2.3

Ticket retargeted after milestone closed

comment:6 by martinl, 7 years ago

Milestone: 7.2.4
Note: See TracTickets for help on using tickets.