X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FControl.pm;h=afd85bded1d051be0373bee6d4afd4e79fac173f;hb=ad30a96a3281439d4284f8ca54942d26c945279e;hp=915b6749d93e48dbb182fda110adce7c9e97c8ff;hpb=86475657d997b61da7181f17a5d85a0c3f410be7;p=debbugs.git diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm index 915b674..afd85bd 100644 --- a/Debbugs/Control.pm +++ b/Debbugs/Control.pm @@ -99,6 +99,7 @@ BEGIN{ clone => [qw(clone_bug)], archive => [qw(bug_archive bug_unarchive), ], + limit => [qw(check_limit)], log => [qw(append_action_to_log), ], ); @@ -108,7 +109,7 @@ BEGIN{ } use Debbugs::Config qw(:config); -use Debbugs::Common qw(:lock buglog :misc get_hashname sort_versions); +use Debbugs::Common qw(:lock buglog :misc get_hashname sort_versions :utf8); use Debbugs::Status qw(bug_archiveable :read :hook writebug new_bug splitpackages split_status_fields get_bug_status); use Debbugs::CGI qw(html_escape); use Debbugs::Log qw(:misc :write); @@ -132,6 +133,7 @@ use POSIX qw(strftime); use Storable qw(dclone nfreeze); use List::Util qw(first max); +use Encode qw(encode_utf8); use Carp; @@ -951,8 +953,8 @@ sub set_done { for my $data (@data) { my $old_data = dclone($data); my $hash = get_hashname($data->{bug_num}); - my $report_fh = IO::File->new("db-h/$hash/$data->{bug_num}.report",'r') or - die "Unable to open original report db-h/$hash/$data->{bug_num}.report for reading: $!"; + my $report_fh = IO::File->new("$config{spool_dir}/db-h/$hash/$data->{bug_num}.report",'r') or + die "Unable to open original report $config{spool_dir}/db-h/$hash/$data->{bug_num}.report for reading: $!"; my $orig_report; { local $/; @@ -996,7 +998,7 @@ sub set_done { headers => [To => $data->{submitter}, Subject => "$config{ubug}#$data->{bug_num} ". - "closed by $param{requester} ($param{request_subject})", + "closed by $param{requester} ".(defined $param{request_subject}?"($param{request_subject})":""), ], ) ], @@ -2019,7 +2021,7 @@ sub set_merged { $new_locks += $n_locks; %data = %{$data}; @data = values %data; - if (not __check_limit(data => [@data], + if (not check_limit(data => [@data], exists $param{limit}?(limit => $param{limit}):(), transcript => $transcript, )) { @@ -2898,7 +2900,7 @@ sub clone_bug { for my $bug (split ' ', $data->{blocks}) { for my $new_bug (@new_bugs) { set_blocks(bug => $new_bug, - blocks => $bug, + block => $bug, hash_slice(%param, keys %common_options, keys %append_action_options), @@ -2909,7 +2911,7 @@ sub clone_bug { for my $bug (split ' ', $data->{blockedby}) { for my $new_bug (@new_bugs) { set_blocks(bug => $bug, - blocks => $new_bug, + block => $new_bug, hash_slice(%param, keys %common_options, keys %append_action_options), @@ -3355,7 +3357,7 @@ sub append_action_to_log{ $nd{$key} = $new_data->{$key}; # $data_diff .= html_escape("$Debbugs::Status::fields{$key}: $new_data->{$key}")."\n"; } - $data_diff .= html_escape(Data::Dumper->Dump([\%nd],[qw(new_data)])); + $data_diff .= html_escape(Data::Dumper->Dump([encode_utf8_structure(\%nd)],[qw(new_data)])); $data_diff .= "-->\n"; $data_diff .= "\n"; } my $msg = join('', (exists $param{command} ? - "\n":"" + "\n":"" ), (length $param{requester} ? - "\n":"" + "\n":"" ), (length $param{request_addr} ? - "\n":"" + "\n":"" ), "\n", $data_diff, - "".html_escape($param{action})."\n"); + "".html_escape(encode_utf8($param{action}))."\n"); if (length $param{requester}) { - $msg .= "Request was from ".html_escape($param{requester})."\n"; + $msg .= "Request was from ".html_escape(encode_utf8($param{requester}))."\n"; } if (length $param{request_addr}) { - $msg .= "to ".html_escape($param{request_addr}).""; + $msg .= "to ".html_escape(encode_utf8($param{request_addr})).""; } if (length $param{desc}) { - $msg .= ":
\n$param{desc}\n"; + $msg .= ":
\n".encode_utf8($param{desc})."\n"; } else { $msg .= ".\n"; @@ -3617,7 +3619,7 @@ sub __begin_control { } } } - if (not __check_limit(data => \@data, + if (not check_limit(data => \@data, exists $param{limit}?(limit => $param{limit}):(), transcript => $transcript, )) { @@ -3684,9 +3686,9 @@ sub __end_control { } -=head2 __check_limit +=head2 check_limit - __check_limit(data => \@data, limit => $param{limit}); + check_limit(data => \@data, limit => $param{limit}); Checks to make sure that bugs match any limits; each entry of @data @@ -3703,7 +3705,7 @@ limit to succeed. =cut -sub __check_limit{ +sub check_limit{ my %param = validate_with(params => \@_, spec => {data => {type => ARRAYREF|SCALAR, },