Opened 16 years ago
Closed 16 years ago
#3542 closed defect (fixed)
default_graph_*, default_node_* and default_edge_* of trac.ini incorrectly handled
Reported by: | anonymous | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Component: | GraphvizPlugin |
Severity: | major | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
On some ports the default_* options are handled incorrectly, building an invalid command line for dot. I researched the problem and it is caused by subprocess.Popen() implementation on Unix platforms.
The code that builds the command line (graphviz.py:382...393) concatenates all filtered ini file options into a single string. Later it is passed as a single subprocess argument. On Posix this will be interpreted as a single argument and causes errors such as "Could not find/open font".
Another problem related to this occurs, when you don't specify any default_ options in your ini file. In this case an empty argument is passed to the dot executable, which returns an error.
Proposed FIX
To fix the problem self.processor_options
datatype should be changed to list and all occurrences revised (graphviz.py:182,185,209,225,237,382...393).
Line 182
sha_text = self.processor.encode(encoding) + u''.join(self.processor_options).encode(encoding) + content
Line 185
sha_text = self.processor + ''.join(self.processor_options) + content
Line 209
cmd = [proc_cmd] cmd += self.processor_options cmd += ['-Tsvg', '-o%s.svg' % img_path]
Line 225
cmd = [proc_cmd] cmd += self.processor_options cmd += ['-T%s' % self.out_format, '-o%s' % img_path]
Line 237
cmd = [proc_cmd] cmd += self.processor_options cmd += ['-Tcmap', '-o%s' % map_path]
Lines 382...393
self.processor_options = [] default_attributes = [ o for o in self.config.options('graphviz') if o[0].startswith('default_') ] if default_attributes: graph_attributes = [ o for o in default_attributes if o[0].startswith('default_graph_') ] node_attributes = [ o for o in default_attributes if o[0].startswith('default_node_') ] edge_attributes = [ o for o in default_attributes if o[0].startswith('default_edge_') ] if graph_attributes: self.processor_options += [ "-G" + o[0].replace('default_graph_', '') + "=" + o[1] for o in graph_attributes] if node_attributes: self.processor_options += [ "-N" + o[0].replace('default_node_', '') + "=" + o[1] for o in node_attributes] if edge_attributes: self.processor_options += [ "-E" + o[0].replace('default_edge_', '') + "=" + o[1] for o in edge_attributes]
Attachments (3)
Change History (8)
comment:1 Changed 16 years ago by
Severity: | normal → blocker |
---|
Changed 16 years ago by
Attachment: | processor_options.diff added |
---|
comment:3 Changed 16 years ago by
Severity: | blocker → major |
---|
I came up with a solution similar to attachment:processor_options.diff, but mine should be more robust w.r.t. unicode strings in those parameters.
This patch also improves upon some of my patches of this morning (#3605 and #3073).
Changed 16 years ago by
Attachment: | default_arguments.patch added |
---|
rework self.processor_options so that it's now a list and also change the encoding is performed (everything is now done in self.launch
). Should be applied on top of the patches I sent this morning.
Changed 16 years ago by
Attachment: | graphvizplugin-misc-fixes-r4341.patch added |
---|
cumulative patch for graphviz 0.11, on top of r4341
comment:4 Changed 16 years ago by
Owner: | changed from Peter Kropf to Christian Boos |
---|
comment:5 Changed 16 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch similar to default_arguments.patch applied in [4395].
fixes #3542