[Rt-commit] rt branch 4.4/convert-to-graphviz2 created. rt-4.4.6-41-g7f5193425a

BPS Git Server git at git.bestpractical.com
Mon Oct 3 13:30:18 UTC 2022


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 4.4/convert-to-graphviz2 has been created
        at  7f5193425a7ea36dc15a8341301e2148f7dd7c9b (commit)

- Log -----------------------------------------------------------------
commit 7f5193425a7ea36dc15a8341301e2148f7dd7c9b
Author: Brian Conry <bconry at bestpractical.com>
Date:   Tue Sep 13 15:16:06 2022 -0500

    Allow additonal ticket relationship graph directions
    
    When graph directions were added in cbe49d600b0 the options for "bottom
    to top" and "right to left" were commented out because the GraphViz
    module didn't support them.
    
    WIth the conversion to GraphViz2 these directions are now supported.

diff --git a/share/html/Ticket/Graphs/Elements/EditGraphProperties b/share/html/Ticket/Graphs/Elements/EditGraphProperties
index 5ba8492bb9..752bd964c1 100644
--- a/share/html/Ticket/Graphs/Elements/EditGraphProperties
+++ b/share/html/Ticket/Graphs/Elements/EditGraphProperties
@@ -50,9 +50,8 @@
 <% loc('Direction') %> <select name="Direction">
 <option value="TB" <% ($Direction||'TB') eq 'TB'? 'selected="selected"': '' |n %>><% loc('top to bottom') %></option>
 <option value="LR" <% ($Direction||'TB') eq 'LR'? 'selected="selected"': '' |n %>><% loc('left to right') %></option>
-%# XXX: not supported by GraphViz perl module
-%#<option value="BT" <% ($Direction||'TB') eq 'BT'? 'selected="selected"': '' |n %>><% loc('bottom to top') %></option>
-%#<option value="RL" <% ($Direction||'TB') eq 'RL'? 'selected="selected"': '' |n %>><% loc('right to left') %></option>
+<option value="BT" <% ($Direction||'TB') eq 'BT'? 'selected="selected"': '' |n %>><% loc('bottom to top') %></option>
+<option value="RL" <% ($Direction||'TB') eq 'RL'? 'selected="selected"': '' |n %>><% loc('right to left') %></option>
 </select><br />
 
 <% loc('Main type of links') %> <select name="LeadingLink">

commit 3a5869dbdc3aaa13e761de548009c148dede9495
Author: Brian Conry <bconry at bestpractical.com>
Date:   Fri Aug 19 15:48:55 2022 -0500

    Convert RT to use GraphViz2
    
    The GraphViz module has been delisted, making it unavailable for new
    installs.
    
    The GraphViz2 module does not present an identical API, so several
    changes needed to be made.
    
    As part of this update the graphs on /Ticket/Graphs/index.html are now
    displayed as SVG with links instead of as PNG with a client-side
    imagemap.
    
    The PNG images are still available via the same paths as before this
    change.

diff --git a/docs/UPGRADING-4.4 b/docs/UPGRADING-4.4
index c27f47e6fc..64190a6ffb 100644
--- a/docs/UPGRADING-4.4
+++ b/docs/UPGRADING-4.4
@@ -725,4 +725,19 @@ loads. This bug is fixed in this release.
 
 =back
 
+=head1 UPGRADING FROM 4.4.6 AND EARLIER
+
+=over 4
+
+=item * Dependency change with GraphViz
+
+RT 4.4.6 and earlier use the Perl GraphViz module for interfacing with the graphviz
+library for generating ticket link graphs.  That module has been deprecated so
+we have replaced it with the GraphViz2 module.
+
+Systems using C<--enable-graphviz> should install the Perl GraphViz2 module,
+and its dependencies, before upgrading.
+
+=back
+
 =cut
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index b6c4dd0e5b..3335bde437 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -728,7 +728,7 @@ our %META;
             my $self  = shift;
             my $value = shift;
             return if $value;
-            return if GraphViz->require;
+            return if GraphViz2->require;
             $RT::Logger->debug("You've enabled GraphViz, but we couldn't load the module: $@");
             $self->Set( DisableGraphViz => 1 );
         },
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index 2fd2cda3d0..16bf795c22 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -58,8 +58,8 @@ RT::Graph::Tickets - view relations between tickets as graphs
 =cut
 
 unless ($RT::DisableGraphViz) {
-    require GraphViz;
-    GraphViz->import;
+    require GraphViz2;
+    GraphViz2->import;
 }
 
 our %ticket_status_style = (
@@ -282,7 +282,7 @@ sub AddTicket {
         }
     }
 
-    $args{'Graph'}->add_node( $args{'Ticket'}->id, %node_style );
+    $args{'Graph'}->add_node( name => $args{'Ticket'}->id, %node_style );
 }
 
 sub TicketLinks {
@@ -313,11 +313,10 @@ sub TicketLinks {
     $args{LeadingLink} = 'Members' unless $valid_links{ $args{LeadingLink} };
 
     unless ( $args{'Graph'} ) {
-        $args{'Graph'} = GraphViz->new(
+        $args{'Graph'} = GraphViz2->new(
             name    => 'ticket_links_'. $args{'Ticket'}->id,
             bgcolor => "transparent",
-# TODO: patch GraphViz to support all posible RDs
-            rankdir => ($args{'Direction'} || "TB") eq "LR",
+            graph => { rankdir => ($args{'Direction'} || "TB") },
             node => { shape => 'box', style => 'filled,rounded', fillcolor => 'white' },
         );
         %fill_cache = ();
@@ -367,8 +366,8 @@ sub TicketLinks {
             $args{'Graph'}->add_edge(
                 # we revers order of member links to get better layout
                 $link->Type eq 'MemberOf'
-                    ? ($target->id => $base->id, dir => 'back')
-                    : ($base->id => $target->id),
+                    ? (from => $target->id, to => $base->id, dir => 'back')
+                    : (from => $base->id, to => $target->id),
                 %{ $link_style{ $link->Type } || {} },
                 $desc? (label => gv_escape $desc): (),
             );
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 941af7834d..e3e02c9708 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -279,7 +279,7 @@ String::ShellQuote
 .
 
 $deps{'GRAPHVIZ'} = [ text_to_hash( << '.') ];
-GraphViz
+GraphViz2
 IPC::Run 0.90
 .
 
diff --git a/share/html/Ticket/Graphs/Elements/ShowGraph b/share/html/Ticket/Graphs/Elements/ShowGraph
index 16bee5c350..9b22c1b1ac 100644
--- a/share/html/Ticket/Graphs/Elements/ShowGraph
+++ b/share/html/Ticket/Graphs/Elements/ShowGraph
@@ -45,8 +45,13 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<div><img src="<% RT->Config->Get('WebPath') %>/Ticket/Graphs/<% $id %>?<% $m->comp('/Elements/QueryString', %ARGS) %>" usemap="#<% $graph->{'NAME'} || 'test' %>" style="border: none" />
-<% safe_run_child { Encode::decode( "UTF-8", $graph->as_cmapx ) } |n %>
+<div>
+% safe_run_child {
+%   $graph->run(
+%     im_format => 'cmapx',
+%   );
+% };
+<% Encode::decode( "UTF-8", $graph->dot_output ) |n %>
 </div>
 <& ShowLegends, %ARGS, Ticket => $ticket &>
 <%ARGS>
diff --git a/share/html/Ticket/Graphs/dhandler b/share/html/Ticket/Graphs/dhandler
index a1f45a4cdd..3a294050f5 100644
--- a/share/html/Ticket/Graphs/dhandler
+++ b/share/html/Ticket/Graphs/dhandler
@@ -74,8 +74,8 @@ $m->clear_buffer;
 
 my $png;
 use RT::Util 'safe_run_child';
-safe_run_child { $graph->as_png(\$png) };
-$m->out( $png );
+safe_run_child { $graph->run(format => 'png') };
+$m->out( $graph->dot_output );
 
 $m->abort;
 
diff --git a/t/security/CVE-2011-5092-graph-links.t b/t/security/CVE-2011-5092-graph-links.t
index c32ad90ba0..085e148b5e 100644
--- a/t/security/CVE-2011-5092-graph-links.t
+++ b/t/security/CVE-2011-5092-graph-links.t
@@ -4,7 +4,7 @@ use warnings;
 use RT::Test tests => undef;
 
 plan skip_all => 'GraphViz required.'
-    unless GraphViz->require;
+    unless GraphViz2->require;
 
 my ($base, $m) = RT::Test->started_ok;
 $m->login;
@@ -23,7 +23,7 @@ for my $arg (qw(LeadingLink ShowLinks)) {
 
     ok !$ticket->ToldObj->IsSet, 'still no Told';
     $m->content_lacks('GotoFirstItem', 'no GotoFirstItem error');
-    $m->content_like(qr|<img[^>]+?src=['"]/Ticket/Graphs/@{[$ticket->id]}|, 'found image element');
+    $m->content_like(qr|<svg.+?<a xlink:href=['"]/Ticket/Display\.html\?id=@{[$ticket->id]}|s, 'found image element');
 }
 
 done_testing;

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list