summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcyeh%bluemartini.com <>2001-02-27 07:50:58 +0100
committercyeh%bluemartini.com <>2001-02-27 07:50:58 +0100
commit0e41bda17fca72191e1342fd8eae53ae922c45dd (patch)
treee84b778f091452d8632a9bcbd96935aaf0b6d063
parent28875a1899e901fb30f51abc5e34a41eb9d92805 (diff)
downloadbugzilla-0e41bda17fca72191e1342fd8eae53ae922c45dd.tar.gz
bugzilla-0e41bda17fca72191e1342fd8eae53ae922c45dd.tar.xz
fix for bug 51670: Dependency loops are possible
we now search each list (dependson, blocks) to see if a bug number shows up in each list. a bug can't be dependent upon and block the same bug. also make it so you can't set a bug blocking or dependent on itself.
-rwxr-xr-xprocess_bug.cgi24
1 files changed, 23 insertions, 1 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index 74780acb7..061dadc93 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -755,6 +755,9 @@ The changes made were:
if ($comp ne $i) {
PuntTryAgain("$i is not a legal bug number");
}
+ if ($id eq $i) {
+ PuntTryAgain("You can't make a bug blocked or dependent on itself.");
+ }
if (!exists $seen{$i}) {
push(@{$deps{$target}}, $i);
$seen{$i} = 1;
@@ -778,8 +781,27 @@ The changes made were:
}
}
}
-
+ if ($me eq 'dependson') {
+ my @deps = @{$deps{'dependson'}};
+ my @blocks = @{$deps{'blocked'}};
+ my @union = ();
+ my @isect = ();
+ my %union = ();
+ my %isect = ();
+ foreach my $b (@deps, @blocks) { $union{$b}++ && $isect{$b}++ }
+ @union = keys %union;
+ @isect = keys %isect;
+ if (@isect > 0) {
+ my $both;
+ foreach my $i (@isect) {
+ $both = $both . "#" . $i . " ";
+ }
+ PuntTryAgain("Dependency loop detected!<P>" .
+ "This bug can't be both blocked and dependent " .
+ "on bug " . $both . "!");
+ }
+ }
my $tmp = $me;
$me = $target;
$target = $tmp;