[GRASS-dev] [GRASS GIS] #3162: Quote script module path when calling its gui from parser

GRASS GIS trac at osgeo.org
Sun Sep 18 02:21:09 PDT 2016


#3162: Quote script module path when calling its gui from parser
-------------------------+-------------------------
 Reporter:  marisn       |      Owner:  grass-dev@…
     Type:  defect       |     Status:  new
 Priority:  normal       |  Milestone:  7.4.0
Component:  Parser       |    Version:  svn-trunk
 Keywords:               |        CPU:  Unspecified
 Platform:  Unspecified  |
-------------------------+-------------------------
 Currently parser will fail if a script module path contains spaces:
 {{{
 grass_trunk > python /home/maris/nezinatniskie_projekti/Zinatnes\ nakts\
 2016/gol.py
 Traceback (most recent call last):
   File "/home/maris/soft/grass_trunk/dist.x86_64-pc-linux-
 gnu/gui/wxpython/gui_core/forms.py", line 2962, in <module>
     task.set_options(cmd[1:])
   File "/home/maris/soft/grass_trunk/dist.x86_64-pc-linux-
 gnu/etc/python/grass/script/task.py", line 299, in set_options
     key, value = opt.split('=', 1)
 ValueError: need more than 1 value to unpack
 }}}

 The problem comes from recreate_command in lib/gis/parser.c invoking
 forms.py and passing all args as a single string. Forms.py expect each
 space to be an argument separator thus causing failure in option parsing.
 Easiest workaround is to quote module path and name while calling
 forms.py.

 I'm attaching patch that provides required quoting and thus allows to have
 script modules to be located in a path with spaces. As parser is quite
 sensitive thing (too easy to break something by accident), I haven't it
 applied to svn myself to get some feedback first. If it will be considered
 to be safe, backport to all 7.x is needed.

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



More information about the grass-dev mailing list