Skip to content

Documented optional graphviz dependency and removed use of os.system() in draw_graph#2287

Merged
sphuber merged 2 commits into
aiidateam:provenance_redesignfrom
ConradJohnston:fix_835_graph_generation_does_not_work_without_graphviz
Dec 4, 2018
Merged

Documented optional graphviz dependency and removed use of os.system() in draw_graph#2287
sphuber merged 2 commits into
aiidateam:provenance_redesignfrom
ConradJohnston:fix_835_graph_generation_does_not_work_without_graphviz

Conversation

@ConradJohnston
Copy link
Copy Markdown
Contributor

Fixes #835 and #2285.

The use of verdi graph to generate a plot of part of the provenance graph requires the graphviz package, which was not documented other than in the source code. This pull request increases the visibility of this dependency in the docs and adds a more human-parsable error message suggest when it could be the case that graphviz is not installed.

Also replaces the use of os.system() in aiida.common.graph with subprocess.call to prevent shell script from being injected via verdi graph generate.

@ConradJohnston
Copy link
Copy Markdown
Contributor Author

This perhaps should be two separate PRs? I can re-do the PR if needed.

@ConradJohnston ConradJohnston force-pushed the fix_835_graph_generation_does_not_work_without_graphviz branch from 97dcc76 to da981f1 Compare December 4, 2018 16:34
@sphuber sphuber self-requested a review December 4, 2018 20:59
@sphuber
Copy link
Copy Markdown
Contributor

sphuber commented Dec 4, 2018

I am happy with it being a single PR. There are two nice commits to go with it 👍

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 4, 2018

Coverage Status

Coverage decreased (-0.7%) to 66.562% when pulling 4bddfe7 on ConradJohnston:fix_835_graph_generation_does_not_work_without_graphviz into 074c577 on aiidateam:provenance_redesign.

sphuber
sphuber previously approved these changes Dec 4, 2018
The use of verdi graph to generate a plot of part of the provenance
graph requires the graphviz package, which was not documented
other than in the source code. This commit increases the visibility
of this dependency in the docs.
- Replaces the use of os.system in aiida.common.graph with subprocess.call
The former was dangerous as it was passed arguments directly from the cmdline
via verdi graph and so would execute and valid shell string,
The solution is to use subprocess.call() which sanitises the input automatically.

- Also prints a more usful message if graphviz is possibly not installed.
@sphuber sphuber force-pushed the fix_835_graph_generation_does_not_work_without_graphviz branch from 3ab67ee to 4bddfe7 Compare December 4, 2018 21:48
@sphuber sphuber merged commit 88026c7 into aiidateam:provenance_redesign Dec 4, 2018
@ConradJohnston ConradJohnston deleted the fix_835_graph_generation_does_not_work_without_graphviz branch December 5, 2018 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants