Opened 8 years ago

Last modified 6 years ago

#3162 new defect

Quote script module path when calling its gui from parser

Reported by: marisn Owned by: grass-dev@…
Priority: normal Milestone: 7.4.5
Component: Parser Version: svn-trunk
Keywords: python Cc:
CPU: Unspecified Platform: Unspecified

Description

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.

Attachments (1)

parser_quote_prog_name.patch (604 bytes ) - added by marisn 8 years ago.
lib/gis/parser.c patch quoting program name

Download all attachments as: .zip

Change History (8)

by marisn, 8 years ago

lib/gis/parser.c patch quoting program name

comment:1 by marisn, 7 years ago

Keywords: python added

Ping Pythonistas. Is it safe to commit this patch or forms.py should be changed?

comment:2 by neteler, 7 years ago

Milestone: 7.4.07.4.1

Ticket retargeted after milestone closed

comment:3 by neteler, 6 years ago

Milestone: 7.4.17.4.2

in reply to:  1 comment:4 by neteler, 6 years ago

Replying to marisn:

Ping Pythonistas. Is it safe to commit this patch or forms.py should be changed?

Perhaps apply the patch in trunk? Otherwise feedback does not seem to come up...

comment:5 by neteler, 6 years ago

Milestone: 7.4.27.4.3

Ticket retargeted after milestone closed

comment:6 by martinl, 6 years ago

Milestone: 7.4.37.4.4

Bump milestone to 7.4.4

comment:7 by neteler, 6 years ago

Milestone: 7.4.47.4.5

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.