Package: bugs.debian.org
Followup-For: Bug #782740

I've prepared a patch for this. The patch doesn't touch the regex in
Bugreport.pm since that is difficult to test. Instead it changes
some strings in Control.pm to include a '.' at the end of the
string to make them consistent with all other control messages.
This makes the regex from Bugreport.pm match correctly.

Obviously this will only fix new instances of the issue, not
retroactively fix all the instances from past bugs.

The patch also includes a test case. This part of the patch depends
on my patch from #767327.

Regards,
  Frank

-- System Information:
Debian Release: 8.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.16.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
>From cfd18704f92efde38d5cbe0615fa84774dd57d24 Mon Sep 17 00:00:00 2001
From: Frank Lichtenheld <fr...@lichtenheld.de>
Date: Sun, 27 Mar 2016 17:01:46 +0200
Subject: [PATCH] Control: Add missing full stop at the end of "Changed"
 messages

This leads to broken links for at least the forwarded-to case.
(Closes: #782740)
---
 Debbugs/Control.pm | 6 +++---
 t/07_bugreport.t   | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm
index 44d0062..36c416f 100644
--- a/Debbugs/Control.pm
+++ b/Debbugs/Control.pm
@@ -1116,7 +1116,7 @@ sub set_submitter {
 	}
 	else {
 	    if (defined $data->{originator} and length($data->{originator})) {
-		$action= "Changed $config{bug} submitter to '$param{submitter}' from '$data->{originator}'";
+		$action= "Changed $config{bug} submitter to '$param{submitter}' from '$data->{originator}'.";
 		$notify_old_submitter = 1;
 	    }
 	    else {
@@ -1231,7 +1231,7 @@ sub set_forwarded {
 		$action= "Unset $config{bug} forwarded-to-address";
 	    }
 	    elsif (defined $data->{forwarded} and length($data->{forwarded})) {
-		$action= "Changed $config{bug} forwarded-to-address to '$param{forwarded}' from '$data->{forwarded}'";
+		$action= "Changed $config{bug} forwarded-to-address to '$param{forwarded}' from '$data->{forwarded}'.";
 	    }
 	    else {
 		$action= "Set $config{bug} forwarded-to-address to '$param{forwarded}'.";
@@ -1316,7 +1316,7 @@ sub set_title {
 	}
 	else {
 	    if (defined $data->{subject} and length($data->{subject})) {
-		$action= "Changed $config{bug} title to '$param{title}' from '$data->{subject}'";
+		$action= "Changed $config{bug} title to '$param{title}' from '$data->{subject}'.";
 	    } else {
 		$action= "Set $config{bug} title to '$param{title}'.";
 	    }
diff --git a/t/07_bugreport.t b/t/07_bugreport.t
index 80dfc92..78d89b1 100644
--- a/t/07_bugreport.t
+++ b/t/07_bugreport.t
@@ -1,7 +1,7 @@
 # -*- mode: cperl;-*-
 
 
-use Test::More tests => 14;
+use Test::More tests => 16;
 
 use warnings;
 use strict;
@@ -101,6 +101,10 @@ my @control_commands =
 			     value   => 'https://foo.invalid/bugs?id=1',
 			     regex   => qr{<strong>Set bug forwarded-to-address to &#39;<a href="https://foo\.invalid/bugs\?id=1";>https://foo\.invalid/bugs\?id=1</a>&#39;\.},
 			    },
+      forwarded_foo_2    => {command => 'forwarded',
+			     value   => 'https://foo.example/bugs?id=1',
+			     regex   => qr{<strong>Changed bug forwarded-to-address to &#39;<a href="https://foo\.example/bugs\?id=1";>https://foo\.example/bugs\?id=1</a>&#39; from &#39;<a href="https://foo\.invalid/bugs\?id=1";>https://foo\.invalid/bugs\?id=1</a>&#39;\.},
+			    },
       clone        => {command => 'clone',
 		       value   => '-1',
 		       regex   => qr{<strong>Bug <a href="bugreport.cgi\?bug=1">1</a> cloned as bug <a href="bugreport.cgi\?bug=2">2</a>},
-- 
2.1.4

Reply via email to