]> git.donarmstrong.com Git - debbugs.git/commitdiff
Fix (and test) setting summary/outlook in Control: messages (Closes: #836613).
authorDon Armstrong <don@donarmstrong.com>
Mon, 5 Sep 2016 16:11:13 +0000 (09:11 -0700)
committerDon Armstrong <don@donarmstrong.com>
Mon, 5 Sep 2016 16:11:13 +0000 (09:11 -0700)
Debbugs/Control.pm
debian/changelog
scripts/process
t/19_summary_current_message.t [new file with mode: 0644]

index 226cd1f8c57f2b8ebfeaf5a0a0f918da35f99ae5..416abc150104741bff85625bb03353ab0930a3dd 100644 (file)
@@ -2748,7 +2748,7 @@ sub _summary {
         print {$debug} "Removing $cmd fields\n";
         $action = "Removed $cmd";
     }
         print {$debug} "Removing $cmd fields\n";
         $action = "Removed $cmd";
     }
-    elsif ($param{$cmd} =~ /^\d+$/) {
+    elsif ($param{$cmd} =~ /^-?\d+$/) {
         my $log = [];
         my @records = Debbugs::Log::read_log_records(bug_num => $param{bug});
         if ($param{$cmd} == 0 or $param{$cmd} == -1) {
         my $log = [];
         my @records = Debbugs::Log::read_log_records(bug_num => $param{bug});
         if ($param{$cmd} == 0 or $param{$cmd} == -1) {
index b91355b1345ff2a2f96006e327c4be4c32c53b67..3729408cc647f991f862cd0fe1f6c6a689964a35 100644 (file)
@@ -36,6 +36,8 @@ debbugs (2.6.0~exp1) UNRELEASED; urgency=low
     newer versions of SOAP::Lite. (Closes: #785405)
   * Add patch to do singular/plural in error messages from Rafael.
     (Closes: #790716)
     newer versions of SOAP::Lite. (Closes: #785405)
   * Add patch to do singular/plural in error messages from Rafael.
     (Closes: #790716)
+  * Fix (and test) setting summary/outlook in Control: messages (Closes:
+    #836613).
 
   [Thanks to Arnout Engelen: ]
   * Add Homepage (closes: #670555).
 
   [Thanks to Arnout Engelen: ]
   * Add Homepage (closes: #670555).
index 4c38000121c02e388828aee0374672c5d0abe7a5..2f4341c7a60c115a01d8075049e07f975fbd05c0 100755 (executable)
@@ -1015,7 +1015,7 @@ if (@control_bits) {
         request_subject   => $header{subject},
         request_nn        => $nn,
         request_replyto   => $replyto,
         request_subject   => $header{subject},
         request_nn        => $nn,
         request_replyto   => $replyto,
-        message           => $msg,
+        message           => [$msg],
         affected_bugs     => \%bug_affected,
         affected_packages => \%affected_packages,
         recipients        => \%recipients,
         affected_bugs     => \%bug_affected,
         affected_packages => \%affected_packages,
         recipients        => \%recipients,
diff --git a/t/19_summary_current_message.t b/t/19_summary_current_message.t
new file mode 100644 (file)
index 0000000..0dfc1e7
--- /dev/null
@@ -0,0 +1,91 @@
+# -*- mode: cperl;-*-
+
+use Test::More;
+
+use warnings;
+use strict;
+
+# The test functions are placed here to make things easier
+use lib qw(t/lib);
+use DebbugsTest qw(:all);
+use Data::Dumper;
+
+my %config =
+    create_debbugs_configuration();
+
+my $sendmail_dir = $config{sendmail_dir};
+my $spool_dir = $config{spool_dir};
+
+# We're going to use create mime message to create these messages, and
+# then just send them to receive.
+
+send_message(to=>'submit@bugs.something',
+            headers => [To   => 'submit@bugs.something',
+                        From => 'foo@bugs.something',
+                        Subject => 'Submiting a bug',
+                       ],
+            body => <<EOF) or fail('Unable to send message');
+Package: foo
+Severity: normal
+
+This is a silly bug
+EOF
+
+# now we check to see that we have a bug, and nextnumber has been incremented
+ok(-e "$spool_dir/db-h/01/1.log",'log file created');
+ok(-e "$spool_dir/db-h/01/1.summary",'sumary file created');
+ok(-e "$spool_dir/db-h/01/1.status",'status file created');
+ok(-e "$spool_dir/db-h/01/1.report",'report file created');
+
+# next, we check to see that (at least) the proper messages have been
+# sent out. 1) ack to submitter 2) mail to maintainer
+
+# This keeps track of the previous size of the sendmail directory
+my $SD_SIZE = 0;
+$SD_SIZE =
+    num_messages_sent($SD_SIZE,2,
+                     $sendmail_dir,
+                     'submit messages appear to have been sent out properly',
+                    );
+
+
+# set the summary to "This is the summary of the silly bug"
+
+send_message(to => 'control@bugs.something',
+            headers => [To   => 'control@bugs.something',
+                        From => 'foo@bugs.something',
+                        Subject => 'Munging a bug',
+                       ],
+            body => <<EOF) or fail('sending message to 1@bugs.someting failed');
+summary 1 0
+thanks
+
+This is the summary of the silly bug
+
+This is not the summary of the silly bug
+EOF
+
+# now we need to check to make sure that the control message actually did anything
+# This is an eval because $ENV{DEBBUGS_CONFIG_FILE} isn't set at BEGIN{} time
+eval "use Debbugs::Status qw(read_bug writebug);";
+my $status = read_bug(bug=>1);
+is($status->{summary},"This is the summary of the silly bug",'bug 1 has right summary');
+
+send_message(to => '1@bugs.something',
+            headers => [To   => '1@bugs.something',
+                        From => 'foo@bugs.something',
+                        Subject => 'Munging a bug',
+                       ],
+            body => <<EOF) or fail('sending message to 1@bugs.someting failed');
+Control: summary -1 0
+
+This is a new summary.
+
+This is not the summary of the silly bug
+EOF
+
+$status = read_bug(bug=>1);
+is($status->{summary},"This is a new summary.",'Control: summary setting works');
+
+
+done_testing();