[PUP-2838] Puppet generates invalid .dot files due to missing escapes of quoted strings in resource names Created: 2014/06/25  Updated: 2018/09/19  Resolved: 2018/05/22

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: PUP 3.6.1, PUP 3.6.2, PUP 5.5.1
Fix Version/s: PUP 6.0.0

Type: Bug Priority: Normal
Reporter: Tristan Helmich Assignee: Jacob Helwig
Resolution: Fixed Votes: 1
Labels: community, puppethack, the-goods
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File graph_fail.png    
Issue Links:
Duplicate
is duplicated by PUP-3803 PE sometimes generates graph dotfiles... Closed
Relates
Template: PUP Bug Template
Team: Platform Core
Release Notes: Bug Fix
Release Notes Summary: Generating graphs of catalogs (Eg: puppet apply --graph) now correctly handles resources with double quotes in the title.

 Description   

Puppet generates invalid .dot files.
If a resource name contains a quoted string the name is not escaped in the .dot file.

Example content generated by puppet:

    "Postgresql_psql[GRANT ALL ON DATABASE "puppetdb" TO "puppetdb"]" [
        fontsize = 8,
        label = "Postgresql_psql[GRANT ALL ON DATABASE "puppetdb" TO "puppetdb"]"
    ]

resulting in something like this:

Correctly escaped it would look like this:

    "Postgresql_psql[GRANT ALL ON DATABASE \"puppetdb\" TO \"puppetdb\"]" [
        fontsize = 8,
        label = "Postgresql_psql[GRANT ALL ON DATABASE \"puppetdb\" TO \"puppetdb\"]"
    ]

The behavior has been reproduced with Puppet 3.6.1 and 3.6.2



 Comments   
Comment by Josh Holland [ 2014/12/12 ]

There is a ticket in the old system for this bug, with a stalled pull request.

Comment by Beth Cornils [ 2014/12/31 ]

Reid Vandewiele

Is this the ticket we discussed in IAC?

Comment by Reid Vandewiele [ 2014/12/31 ]

[~bcornils] No, I was talking about PUP-914.

Comment by Scott Walker [ 2015/07/23 ]

Beth Cornils I ran into this too generating a graph using the agent running on master. Is there any concern that introduction of graphs into the UI might draw users to try --graph with the agent?

Comment by Verne Lindner [ 2015/07/23 ]

Scott Walker I'm not following your comment about UI graphs and CL --graph use: would you explain what the concern is?

Comment by Scott Walker [ 2015/07/24 ]

Verne Lindner This ticket captures a bug in which the agent can generate dot files that aren't syntactically valid. If you use "--graph" on the master agent you get an example - in that case because of some unescaped quotes. My rationale is: the graph is now much more visible and so maybe customers are more likely to try out the --graph option on the agent. If they try it on their master in PE 2015.2 they'll run into the bug straight away.

Beth Cornils I hadn't thought of deprecating - I like it. There's probably still value in expanded_relationships.dot for agent debugging purposes but there's less reason to use it compared with the others.

Comment by Verne Lindner [ 2015/07/24 ]

+1 Reid

Comment by Romain Tartière [ 2018/05/19 ]

Problem still exist with Puppet 5 but the symptoms are not the same: dot(1) complains that the .dot file is invalid:

λ dot /var/puppet/state/graphs/relationships.dot
Error: /var/puppet/state/graphs/relationships.dot: syntax error in line 5765 near '"'

The line 5765 says:

λ sed -e '5765!d' /var/puppet/state/graphs/relationships.dot
label = "Postgresql_psql[CREATE DATABASE "ejabberd"]"

Comment by Jacob Helwig [ 2018/05/21 ]

PR merged to master branch in 81d213d80d.

Generated at Tue Aug 20 09:05:27 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.