Control: tags -1 patch
Control: clone -1 -2
Control: reassign -2 debbugs
Control: found -2 2.6.0~exp1

Hi Sven, hi Debian BTS maintainers, dear debbugs team,

I recently discovered a similar problem like described above when unmerging a set of bugs on bugs.x2go.org (running also debbugs).

The issue is buried in /usr/share/perl5/Debbugs/Status.pm.

In that file, there is a comparison of the new merge situation and a theoretical expected situation after merging:


"""
            push @data,$newdata;
            # perform a sanity check to make sure that the merged bugs
            # are all merged with eachother
my $expectmerge= join(' ',grep {$_ != $bug } sort { $a <=> $b } @bugs);
            if ($newdata->{mergedwith} ne $expectmerge) {
                for (1..$locks) {
                    unfilelock(exists $param{locks}?$param{locks}:());
                }
die "Bug $param{bug} differs from bug $bug: ($newdata->{bug_num}: '$newdata->{mergedwith}') vs. ('$expectmerge') (".join(' ',@bugs).")";
            }
"""

This comparison fails for bug lists like this: #49 #417 #875.

In my test case, the two variables being compared have these values:

  $newdata->{mergedwith}::: "417 49 875"
  $expectedmerge:::         "49 417 875"

The $expectedmerge variable is a string of a strictly numerically sorted list of bug numbers.

Whereas the $newdata->{mergedwith} seems to be a list of alphanumerically sorted bugs numbers ("417" < "49" < "875", like "abd" < "ac" < "def").

The $newdata->{mergedwith} value comes from the read_bug() function. Maybe the sorting order should be fixed there.

However, the attached bug simply does a re-sorting of $newdata->{mergedwith} before comparing $newdata->{mergedwith} with $expectedmerge.

Greets,
Mike

--

DAS-NETZWERKTEAM
mike gabriel, herweg 7, 24357 fleckeby
fon: +49 (1520) 1976 148

GnuPG Key ID 0x25771B31
mail: [email protected], http://das-netzwerkteam.de

freeBusy:
https://mail.das-netzwerkteam.de/mailxchange/kronolith/fb.php?u=m.gabriel%40das-netzwerkteam.de
--- Status.pm.orig      2016-02-23 13:20:32.000000000 +0100
+++ Status.pm   2016-02-23 13:22:53.000000000 +0100
@@ -510,10 +510,14 @@
            }
            $locks++;
            push @data,$newdata;
+       
+            # sort $newdata->{mergedwith} to make the below comparison really 
functional
+            my $ismerge = join(' ',grep {$_ != $bug } sort { $a <=> $b } 
split(/ /, $newdata->{mergedwith}));
+
            # perform a sanity check to make sure that the merged bugs
            # are all merged with eachother
            my $expectmerge= join(' ',grep {$_ != $bug } sort { $a <=> $b } 
@bugs);
-           if ($newdata->{mergedwith} ne $expectmerge) {
+           if ($ismerge ne $expectmerge) {
                for (1..$locks) {
                    unfilelock(exists $param{locks}?$param{locks}:());
                }

Attachment: pgpegJRZqzHTQ.pgp
Description: Digitale PGP-Signatur

Reply via email to