------------------------------------------------------------
revno: 930 [merge]
committer: Debian BTS <debbugs@busoni>
branch nick: mainline
timestamp: Mon 2012-03-19 17:48:42 +0000
message:
  merge changes from dla source branch
------------------------------------------------------------
Use --include-merges or -n0 to see merged revisions.
=== modified file 'Debbugs/Control.pm'
--- Debbugs/Control.pm  2012-03-13 05:30:23 +0000
+++ Debbugs/Control.pm  2012-03-19 17:48:40 +0000
@@ -2402,7 +2402,7 @@
                 (exists $force_functions{$field}{modify_value} ?
                  
$force_functions{$field}{modify_value}->($merge_status->{$field}):
                  $merge_status->{$field}),
-                value    => $merge_status->{$field},
+                value    => ref($merge_status->{$field}) eq 'HASH'?[sort keys 
%{$merge_status->{$field}}]:$merge_status->{$field},
                 function => $force_functions{$field}{func},
                 key      => $force_functions{$field}{key},
                 options  => $force_functions{$field}{options},

=== modified file 'Debbugs/Log.pm'
--- Debbugs/Log.pm      2010-08-06 06:32:03 +0000
+++ Debbugs/Log.pm      2012-03-19 17:48:40 +0000
@@ -39,6 +39,7 @@
 
 use Debbugs::Common qw(getbuglocation getbugcomponent make_list);
 use Params::Validate qw(:types validate_with);
+use Encode qw(encode);
 
 =head1 NAME
 
@@ -426,7 +427,7 @@
 
 sub escape_log {
        my @log = @_;
-       return map { s/^([\01-\07\030])/\030$1/gm; $_ } @log;
+       return map { eval {$_ = encode("utf8",$_,Encode::FB_CROAK)}; 
s/^([\01-\07\030])/\030$1/gm; $_ } @log;
 }
 
 

=== modified file 'Debbugs/Mail.pm'
--- Debbugs/Mail.pm     2012-02-16 03:11:10 +0000
+++ Debbugs/Mail.pm     2012-03-19 17:48:40 +0000
@@ -48,6 +48,7 @@
 use Debbugs::MIME qw(encode_rfc1522);
 use Debbugs::Config qw(:config);
 use Params::Validate qw(:types validate_with);
+use Encode qw(encode is_utf8);
 
 use Debbugs::Packages;
 
@@ -346,6 +347,11 @@
      if ($param{encode_headers}) {
          $param{message} = encode_headers($param{message});
      }
+     eval {
+        if (is_utf8($param{message})) {
+            $param{message} = encode('utf8',$param{message});
+        }
+     };
 
      # First, try to send the message as is.
      eval {

=== modified file 'Debbugs/Status.pm'
--- Debbugs/Status.pm   2012-03-14 16:41:38 +0000
+++ Debbugs/Status.pm   2012-03-19 17:48:40 +0000
@@ -45,6 +45,7 @@
 use Debbugs::Versions::Dpkg;
 use POSIX qw(ceil);
 use File::Copy qw(copy);
+use Encode qw(decode encode);
 
 use Storable qw(dclone);
 use List::Util qw(min max);
@@ -239,6 +240,9 @@
 
     my %namemap = reverse %fields;
     for my $line (@lines) {
+       eval {
+           $line = decode("utf8",$line,Encode::FB_CROAK);
+       };
         if ($line =~ /(\S+?): (.*)/) {
             my ($name, $value) = (lc $1, $2);
            # this is a bit of a hack; we should never, ever have \r
@@ -636,11 +640,14 @@
                 # Output field names in proper case, e.g. 'Merged-With'.
                 my $properfield = $fields{$field};
                 $properfield =~ s/(?:^|(?<=-))([a-z])/\u$1/g;
-                $contents .= "$properfield: $newdata{$field}\n";
+               my $data = $newdata{$field};
+                $contents .= "$properfield: $data\n";
             }
         }
     }
-
+    eval {
+       $contents = encode("utf8",$contents,Encode::FB_CROAK);
+    };
     return $contents;
 }
 

=== modified file 'scripts/service'
--- scripts/service     2012-03-13 05:30:23 +0000
+++ scripts/service     2012-03-19 17:48:40 +0000
@@ -18,8 +18,9 @@
 use Debbugs::Common qw(:util :quit :misc :lock);
 
 use Debbugs::Status qw(:read :status :write :versions :hook);
+use Debbugs::Packages qw(binary_to_source);
 
-use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522);
+use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522 create_mime_message);
 use Debbugs::Mail qw(send_mail_message);
 use Debbugs::User;
 use Debbugs::Recipients qw(:all);
@@ -38,6 +39,7 @@
 use List::Util qw(first);
 
 use Mail::RFC822::Address;
+use Encode qw(decode encode);
 
 chdir($config{spool_dir}) or
      die "Unable to chdir to spool_dir '$config{spool_dir}': $!";
@@ -114,8 +116,8 @@
 my $errors = 0;
 my $controlrequestaddr= ($control ? 'control' : 
'request').'@'.$config{email_domain};
 my $transcript_scalar = '';
-my $transcript = IO::Scalar->new(\$transcript_scalar) or
-     die "Unable to create new IO::Scalar";
+open my $transcript, ">:scalar:utf8", \$transcript_scalar or
+     die "Unable to create transcript scalar: $!";
 print {$transcript} "Processing commands for $controlrequestaddr:\n\n";
 
 
@@ -201,6 +203,10 @@
     # Fixes #488554
     s/\xef\xbb\xbf//g;
     next unless m/\S/;
+    eval {
+       my $temp = decode("utf8",$_,Encode::FB_CROAK);
+       $_ = $temp;
+    };
     print {$transcript} "> $_\n";
     next if m/^\s*\#/;
     $action= '';
@@ -549,7 +555,7 @@
            set_done(@common_control_options,
                     bug          => $ref,
                     reopen       => 1,
-                    submitter    => $new_submitter,
+                    defined $new_submitter? (submitter    => 
$new_submitter):(),
                    );
        };
        if ($@) {
@@ -1090,22 +1096,31 @@
 # Error text here advertises how many errors there were
 my $error_text = $errors > 0 ? " (with $errors errors)":'';
 
-my $reply= <<END;
-From: $gMaintainerEmail ($gProject $gBug Tracking System)
-To: $replyto
-${maintccs}Subject: Processed${error_text}: $header{'subject'}
-In-Reply-To: $header{'message-id'}
-END
-$reply .= <<END;
-References: $header{'message-id'}
-Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
-Precedence: bulk
-${packagepr}X-$gProject-PR-Message: transcript
-END
+my @common_headers;
+push @common_headers, 'X-Loop',$gMaintainerEmail;
 
-$reply .= fill_template('mail/message_body',
-                         {body => "${transcript_scalar}Please contact me if 
you need assistance."},
-                       );
+my $temp_transcript = ${transcript_scalar};
+eval{
+    $temp_transcript = decode("utf8",$temp_transcript,Encode::FB_CROAK);
+};
+my $reply =
+    create_mime_message([From          => "$gMaintainerEmail ($gProject $gBug 
Tracking System)",
+                        To            => $replyto,
+                        @maintccs ? (Cc => join(', ',@maintccs)):(),
+                        Subject       => "Processed${error_text}: 
$header{subject}",
+                        'Message-ID'  => 
"<handler.s.$nn.transcript\@$gEmailDomain>",
+                        'In-Reply-To' => $header{'message-id'},
+                        References    => join(' ',grep {defined $_} 
$header{'message-id'},$data->{msgid}),
+                        Precedence    => 'bulk',
+                        keys %affected_packages ?("X-${gProject}-PR-Package" 
=> join(' ',keys %affected_packages)):(),
+                        keys %affected_packages ?("X-${gProject}-PR-Source" =>
+                                                  join(' ',grep {defined $_} 
map {binary_to_source(binary => $_)} keys %affected_packages)):(),
+                        "X-$gProject-PR-Message" => 'transcript',
+                        @common_headers,
+                       ],
+                       fill_template('mail/message_body',
+                                     {body => "${temp_transcript}Please 
contact me if you need assistance."},
+                                    ));
 
 my $repliedshow= join(', ',$replyto,
                      determine_recipients(recipients => \%recipients,
@@ -1113,6 +1128,7 @@
                                           address_only => 1,
                                          )
                     );
+
 # -1 is the service.in log
 &filelock("lock/-1");
 open(AP,">>db-h/-1.log") || die "open db-h/-1.log: $!";

=== modified file 't/06_mail_handling.t'
--- t/06_mail_handling.t        2009-07-25 16:22:11 +0000
+++ t/06_mail_handling.t        2012-03-19 17:48:40 +0000
@@ -1,7 +1,7 @@
 # -*- mode: cperl;-*-
 # $Id: 05_mail.t,v 1.1 2005/08/17 21:46:17 don Exp $
 
-use Test::More tests => 114;
+use Test::More tests => 117;
 
 use warnings;
 use strict;
@@ -22,6 +22,7 @@
 use lib qw(t/lib);
 use DebbugsTest qw(:all);
 use Data::Dumper;
+use Encode qw(decode encode);
 
 # HTTP::Server:::Simple defines a SIG{CHLD} handler that breaks system; undef 
it here.
 $SIG{CHLD} = sub {};
@@ -299,6 +300,11 @@
                       status_key => 'keywords',
                       status_value => 'patch',
                      },
+      utf8_retitle => {command => 'retitle',
+                      value   => 'Thïs is a ütff8 title [♥♡☙☎]',
+                      status_key => 'subject',
+                      status_value => decode("utf8",'Thïs is a ütff8 title 
[♥♡☙☎]'),
+                     },
      );
 
 # In order for the archive/unarchive to work, we have to munge the summary 
file slightly

Reply via email to