Graphviz Issue Tracker
Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002493graphvizDotpublic2014-10-05 17:412014-10-06 11:01
Reportersammthomson 
Assigned Toerg 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionno change required 
PlatformOSOS Version
Summary0002493: The DOT language specification makes it impossible to end a quoted string with the character '\'
DescriptionFootnote 1 in http://graphviz.org/content/dot-language [^] reads: "In quoted strings in DOT, the only escaped character is double-quote ("). That is, in quoted strings, the dyad \" is converted to "; all other characters are left unchanged. In particular, \\ remains \\. Layout engines may apply additional escape sequences."

This design (i.e. not escaping "\" as "\\") makes it impossible to end a quoted string with the character '\'.
Steps To Reproducedot <<EOF
digraph A {
    0 [label = "foo\\"]
}
EOF
TagsNo tags attached.
AUXILLARY-FILES
DATE-FIXED
FIX-COMMENT
FORMER-ID
INPUT-FILE
OUTPUT-FILE
STATUS-COMMENT
VERSION2.38.0
Attached Files

- Relationships

-  Notes
User avatar (0000830)
sammthomson (reporter)
2014-10-05 18:40

I believe this is intended behavior so OS probably isn't relevant, but just in case, I'm running Ubuntu 14.04.

dot - graphviz version 2.36.0 (20140111.2315)
User avatar (0000831)
sammthomson (reporter)
2014-10-05 23:51

OK, upgrading to graphviz version 2.39.0 fixed this for me. I didn't think to do that before, because the docs led me to believe that it was expected behavior.

Can the docs be upgraded to reflect that backslashes *are* escaped?

A red herring in my bug report was that I used heredocs incorrectly (heredocs swallow the extra backslash). Here's a better test case that fails in 2.36, but works in 2.39:



cat a.txt
# digraph G { "hello\\" }


# 2.36
dot a.txt
# Warning: a.txt: syntax error in line 1 near ''

# 2.39
dot a.txt
#digraph G {
# graph [bb="0,0,61.095,36"];
# node [label="\N"];
# "hello\\" [height=0.5,
# pos="30.547,18",
# width=0.84854];
#}
User avatar (0000832)
erg (administrator)
2014-10-06 11:01

The docs are correct as they stand. In the dot language, \\ remains \\. If you check the length of the node name, it will be 7 bytes long. In general, the language invokes a minimal amount of magic, leaving that to the layout programs. All of the backslash magic occurs when text in a label is converted for display. See http://www.graphviz.org/content/attrs#kescString. [^]

The bug was introduced in 2.32, probably from own confusion (Aren't multiple levels of string interpretation wonderful?), and fixed in 2.38.

- Issue History
Date Modified Username Field Change
2014-10-05 17:41 sammthomson New Issue
2014-10-05 18:40 sammthomson Note Added: 0000830
2014-10-05 23:51 sammthomson Note Added: 0000831
2014-10-06 11:01 erg Note Added: 0000832
2014-10-06 11:01 erg Assigned To => erg
2014-10-06 11:01 erg Status new => closed
2014-10-06 11:01 erg Resolution open => no change required


MantisBT 1.2.5[^]
Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker