From: Don Armstrong Date: Fri, 28 Aug 2009 23:24:06 +0000 (-0700) Subject: fix block 1 issue X-Git-Tag: release/2.6.0~441^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=e7c19ba4fddf6b342fc3467e10f18b2f685c612a;p=debbugs.git fix block 1 issue --- diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm index 27dadb8..5534261 100644 --- a/Debbugs/Control.pm +++ b/Debbugs/Control.pm @@ -319,10 +319,10 @@ sub set_blocks { join(', ',grep {$_ !~ /^\d+$/} make_list($param{block})); } my $mode = 'set'; - if (exists $param{add}) { + if ($param{add}) { $mode = 'add'; } - elsif (exists $param{remove}) { + elsif ($param{remove}) { $mode = 'remove'; } @@ -351,7 +351,7 @@ sub set_blocks { $ok_blockers{$blocker} = 1; my @merged_bugs; push @merged_bugs, make_list($data->{mergedwith}); - $ok_blockers{@merged_bugs} = (1) x @merged_bugs if @merged_bugs; + @ok_blockers{@merged_bugs} = (1) x @merged_bugs if @merged_bugs; } else { $bad_blockers{$blocker} = 1; diff --git a/debian/changelog b/debian/changelog index 44cf90b..2fa786d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +debbugs (2.4.2~exp1) experimental; urgency=low + + * Allow (almost) exactly what RFC2822 allows in comments (closes: + #497144) + * Fix problem with non-existant /etc/debbugs/config + + -- Don Armstrong Wed, 26 Aug 2009 21:32:53 -0700 + debbugs (2.4.2~exp0) experimental; urgency=low [ Anthony Towns ] diff --git a/t/11_blocks.t b/t/11_blocks.t new file mode 100644 index 0000000..553fe25 --- /dev/null +++ b/t/11_blocks.t @@ -0,0 +1,161 @@ +# -*- mode: cperl;-*- + +use Test::More tests => 14; + +use warnings; +use strict; + +# Here, we're going to shoot messages through a set of things that can +# happen. + +# First, we're going to send mesages to receive. +# To do so, we'll first send a message to submit, +# then send messages to the newly created bugnumber. + +use IO::File; +use File::Temp qw(tempdir); +use Cwd qw(getcwd); +use Debbugs::MIME qw(create_mime_message); +use File::Basename qw(dirname basename); +# The test functions are placed here to make things easier +use lib qw(t/lib); +use DebbugsTest qw(:all); +use Data::Dumper; + +# HTTP::Server:::Simple defines a SIG{CHLD} handler that breaks system; undef it here. +$SIG{CHLD} = sub {}; +my %config; +eval { + %config = create_debbugs_configuration(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0); +}; +if ($@) { + BAIL_OUT($@); +} + +my $sendmail_dir = $config{sendmail_dir}; +my $spool_dir = $config{spool_dir}; +my $config_dir = $config{config_dir}; + +END{ + if ($ENV{DEBUG}) { + diag("spool_dir: $spool_dir\n"); + diag("config_dir: $config_dir\n"); + diag("sendmail_dir: $sendmail_dir\n"); + } +} + +# We're going to use create mime message to create these messages, and +# then just send them to receive. + +for my $bug (1..11) { + send_message(to=>'submit@bugs.something', + headers => [To => 'submit@bugs.something', + From => 'foo@bugs.something', + Subject => 'Submiting a bug '.$bug, + ], + body => < '1@bugs.something', + headers => [To => '1@bugs.something', + From => 'foo@bugs.something', + Subject => 'Sending a message to a bug', + ], + body => < 'control@bugs.something', + headers => [To => 'control@bugs.something', + From => 'foo@bugs.something', + Subject => 'Munging a bug', + ], + body => <10); +ok($status->{blockedby} eq '2','bug 10 is blocked by 2 (and only 2)'); +$status = read_bug(bug=>2); +ok($status->{blocks} eq '10','bug 2 blocks 10 (and only 10)'); + +send_message(to => 'control@bugs.something', + headers => [To => 'control@bugs.something', + From => 'foo@bugs.something', + Subject => 'Munging a bug', + ], + body => <10); +ok(is_deeply([sort split /\ /,$status->{blockedby}],[qw(2 3 4)]),'bug 10 is blocked by exactly 2, 3, and 4'); +send_message(to => 'control@bugs.something', + headers => [To => 'control@bugs.something', + From => 'foo@bugs.something', + Subject => 'Munging a bug', + ], + body => <10); +ok(is_deeply([sort split /\ /,$status->{blockedby}],[qw(3 4)]),'bug 10 is blocked by exactly 3 and 4'); +$status = read_bug(bug=>3); +ok($status->{blocks} eq '10','bug 3 blocks exactly 10'); + +send_message(to => 'control@bugs.something', + headers => [To => 'control@bugs.something', + From => 'foo@bugs.something', + Subject => 'Munging a bug', + ], + body => <3); +ok($status->{blockedby} eq '5','bug 3 is blocked by exactly 5');