[GRASS-dev] [GRASS GIS] #3833: pygrass.gis.region.Region + WIND_OVERRIDE + non-existing path kills the process

GRASS GIS trac at osgeo.org
Tue Apr 30 03:26:53 PDT 2019


#3833: pygrass.gis.region.Region + WIND_OVERRIDE + non-existing path kills the
process
-------------------------+-------------------------
 Reporter:  pmav99       |      Owner:  grass-dev@…
     Type:  defect       |     Status:  new
 Priority:  normal       |  Milestone:
Component:  PyGRASS      |    Version:  unspecified
 Keywords:               |        CPU:  Unspecified
 Platform:  Unspecified  |
-------------------------+-------------------------
 If you define {{{WIND_OVERRIDE}}} to a non existing path, then,
 instantiating a {{{Region}}} object results in a fatal error which kills
 the current process. This is a problem if you are e.g. in an interactive
 ipython session. Example:

 {{{
 import os
 from grass.pygrass.gis.region import Region

 os.environ["WIND_OVERRIDE"] = 'aaaa'
 r = Region()

 # results in a dead python process with the following message:
 # ERROR: Unable to open element file <windows> for <aaaa at PERMANENT>
 }}}

 The problem is that the {{{Region.read()}}} method calls
 {{{G_get_window}}} which calls {{{G_get_element_window}}}, which calls
 {{{G_fatal_window}}} if the file does not exist.

 Adding a check for {{{WIND_OVERRIDE}}} and the existence of the file in
 {{{Region.read()}}} would solve the issue for most practical purposes, but
 would be subject to a race condition. Not sure what to suggest.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3833>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list