Modify

Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#3901 closed defect (fixed)

Wiki links in graphs are not working

Reported by: Eric Raue Owned by: Christian Boos
Priority: normal Component: GraphvizPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

After installing 0.7.4 by downloading the zip file, I tried the second example and it did not create a graph where the nodes were clickable.

On the plugin page the change log for revision 4478 indicates that version 0.7.4 should correct it.

OS: Linux Graphviz version 2.20.2

Graphviz is enabled in trac.ini and the graphiz section has cache_dir, cmd_path, default_graph_fontname and default_graph_fontsize filled in.

Attachments (1)

3901-warnings-dont-stop-processing.diff (5.0 KB) - added by Christian Boos 16 years ago.
Improve error and warning processing

Download all attachments as: .zip

Change History (11)

comment:1 Changed 16 years ago by Christian Boos

Owner: changed from Peter Kropf to Christian Boos

So you get a graph, but nothing is clickable. Did you have a previous version of the plugin installed? Perhaps for some reason the new version 0.7.4 doesn't get used? Check in the Admin/Plugins page that you really see 0.7.4 there. If so, try to regenerate the graph by adding some extra text and/or nodes, maybe that sample graph was already generated by a previous version of the plugin.

Also note that for now the URL attribute needs to be written using quotes, e.g. URL="GraphvizPlugin". I didn't fix the doc because I'd like to make it work also when the quotes are omitted.

comment:2 Changed 16 years ago by Eric Raue

I did have a previous version of the plugin installed, version 0.7.2 which I deleted from my plugin directory when I installed 0.7.4. The admin panel tells the same story. I also tried adding/modifying nodes in case the images were cached and still no links.

I didn't have the URL attribute in quotes so I tried this example and the links were not clickable. Is there something wrong with the way it is written?

digraph G {
    TestLink [ URL="GraphvizPlugin" ]
    Trac [ URL="http://trac.edgewall.org/" fontcolor=red]
    TestLink -> Trac
}

Some more information that might help to diagnose the problem. I compiled Graphviz from source and it's running on a 64 bit xenon processor. When I generate a new graphic, 'dot' creates the file and returns indicating the fontname is invalid so it went with a generic font. I plan to fix this as soon as I figure out a valid font name on linux, but don't believe this is the cause of the problem.

I'm new to Python, but not programming so I'll see if I can modify the plugin and figure out what exactly is going on. This may take a few days depending on how busy I get.

comment:3 Changed 16 years ago by Christian Boos

It's a bit difficult to imagine what's going wrong besides an installation issue, as it just works for me (including your example above). It's not a dot problem and the font issue is separate.

I think you should dig into to code in order to see what's really going on. For example, try this patch:

Index: graphviz/graphviz.py
===================================================================
--- graphviz/graphviz.py        (revision 4478)
+++ graphviz/graphviz.py        (working copy)
@@ -322,6 +322,7 @@

         # Check for URL="" presence in graph code
         URL_in_graph = 'URL=' in content
+        print 'before', URL_in_graph, content

         # Create image if not in cache
         if not os.path.exists(img_path):
@@ -331,6 +332,7 @@
                 content = self._expand_wiki_links(formatter, out_format,
                                                   content)
                 encoded_content = content.encode(self.encoding)
+                print 'after', encoded_content

             # Antialias PNGs with rsvg, if requested
             if out_format == 'png' and self.png_anti_alias == True:

and test with tracd, or replace the print a,b,c with self.log.debug(repr((a,b,c))).

Also verify that you have .map files besides your image files, in the cache_dir, and check their content. When it works, it should be something like:

$ cat c5f381cfef800a00c20e68f706b028afd1c9aec2.dot.map
<area shape="poly" href="/trac/bct/wiki/GraphvizPlugin" title="TestLink" alt="" coords="139,31 136,23 126,16 111,10 93,6 72,5 51,6 33,10 18,16 8,23 5,31 8,39 18,46 33,51 51,55 72,56 93,55 111,51 126,46 136,39">
<area shape="poly" href="http://trac.edgewall.org/" title="Trac" alt="" coords="113,129 111,121 106,114 96,109 85,105 72,104 59,105 48,109 38,114 33,121 31,129 33,137 38,144 48,150 59,154 72,155 85,154 96,150 106,144 111,137">

comment:4 Changed 16 years ago by Eric Raue

Alright, I spent some time inserting quite a few self.log.debug statements to see exactly where the code reached. I'm sure there is a better way but I've never written anything in python before so I'm unfamiliar with it.

The map file was not being generated because the function was immediately returning on any error message generated when creating the image -- even if if it had succeeded. The error message that was being generated contained the words 'succeeded but emitted the following output:'. It might be an idea to check to see if the command still succeeded and continue to make the map file. I would try my hand at making a patch but I'm sure you'll be able to do it more efficiently.

Thanks for the help and for working on this great plugin.

comment:5 in reply to:  4 Changed 16 years ago by Christian Boos

Status: newassigned

Replying to zazery:

The map file was not being generated because the function was immediately returning on any error message generated when creating the image -- even if if it had succeeded.

Uh oh, I see, so the font warning was indeed related.

It might be an idea to check to see if the command still succeeded and continue to make the map file.

You're right, I'll try to do that.

Changed 16 years ago by Christian Boos

Improve error and warning processing

comment:6 Changed 16 years ago by Christian Boos

If you don't mind, you could try attachment:3901-warnings-dont-stop-processing.diff and tell me if it's OK that way.

comment:7 Changed 16 years ago by Eric Raue

I tried the patch this morning and it did not generate the map file, however it did output the error part of the message instead of the succeeded message from before. This is what is displayed immediately after making the change to the wiki. Refreshing the page will display the graphic, but no map file.

2008-10-15 10:43:23,415 Trac[__init__] ERROR: <p><br/>The command:<pre>'/home/subtrac/bin/dot -Tpng -o/home/subtrac/trac_projects/trac_dsp/cache/d73f9ece42ff73bc3da90d9a8ce27cd604ed2b73.dot.png -Gfontsize=10 -Gfontname="Nimbus Roman No9 L"'</pre>failed with the following output:<pre>'Error: &lt;stdin&gt;:7: syntax error near line 7\nError: Could not find/open font\nError: Could not find/open font\n'</pre></p>

I have yet to fix the font configuration issue so it should be the same environment as before. I would be happy to try any patches, however I will be extremely busy until October 23rd so expect slow responses.

comment:8 Changed 16 years ago by Christian Boos

Resolution: fixed
Status: assignedclosed

(In [4537]) GraphvizPlugin: hopefully last round of improvement for error vs. warning reporting. When only a warning is reported further stages of the processing should be performed (fixes #3901).

comment:9 Changed 16 years ago by Christian Boos

There was a problem with my patch above, so I committed a fixed version of it. Please don't hesitate to reopen this ticket if you still have issues (also don't hesitate to report if it works now for you ;-) ).

comment:10 Changed 16 years ago by Eric Raue

I checked out r4594 and tested it. I have discovered that only sometimes Graphviz will return with a succeeded message and most of the time it will simply say that it failed even if the image was generated. I am not sure why it does this since all I am doing is slightly modifying the naming of some of the nodes in the graph to test it. I could not trigger the succeeded message with the r4594 change list after multiple tries, so I am unable to verify the fix.

Here is the errmsg when it succeeds:

2008-10-26 20:28:39,797 Trac[__init__] ERROR: <p><br/>The command:<pre>'/home/subtrac/bin/dot -Tpng -o/home/subtrac/trac_projects/trac_dsp/cache/1cf0574ccce1ed9d588c7364159a0b3d4eca87cd.dot.png -Gfontname="Courier" -Gfontsize=10'</pre>succeeded but emitted the following output:<pre>'Error: &lt;stdin&gt;:7: syntax error near line 7\nError: Could not find/open font\nError: Could not find/open font\nError: Could not find/open font\n'</pre></p>

Here is the errmsg when it fails:

2008-10-26 20:25:20,514 Trac[__init__] ERROR: <p><br/>The command:<pre>'/home/subtrac/bin/dot -Tpng -o/home/subtrac/trac_projects/trac_dsp/cache/f9491fcb7a087c60c0cd2c25383ea86e44f7b99a.dot.png -Gfontname="Courier" -Gfontsize=10'</pre>failed with the following output:<pre>'Error: &lt;stdin&gt;:7: syntax error near line 7\nError: Could not find/open font\nError: Could not find/open font\nError: Could not find/open font\nError: Could not find/open font\n'</pre></p>

I do not imagine there is much you can do so I left this bug as closed. I will fix the font issue or modify the plugin to my needs.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.