X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=Debbugs%2FControl.pm;h=aaba6d54c8334325e56dcb59603b31da65cb47a8;hb=caee25098217688c944b636e54e2fb87d0e4cedb;hp=859d5e8d2067f87a7c7b3f3bed21038df65cfb72;hpb=45b9dc0e4698d73c451331f9e6ec86d22b1393a8;p=debbugs.git diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm index 859d5e8..aaba6d5 100644 --- a/Debbugs/Control.pm +++ b/Debbugs/Control.pm @@ -90,15 +90,22 @@ BEGIN{ use Debbugs::Config qw(:config); use Debbugs::Common qw(:lock buglog make_list get_hashname); -use Debbugs::Status qw(bug_archiveable :read :hook); +use Debbugs::Status qw(bug_archiveable :read :hook writebug); use Debbugs::CGI qw(html_escape); use Debbugs::Log qw(:misc); use Params::Validate qw(validate_with :types); use File::Path qw(mkpath); use IO::File; +use IO::Scalar; -# These are a set of options which are common to all of these functions +use Debbugs::Text qw(:templates); + +use Debbugs::Mail qw(rfc822_date); + +use POSIX qw(strftime); + +# These are a set of options which are common to all of these functions my %common_options = (debug => {type => SCALARREF, optional => 1, @@ -173,6 +180,13 @@ sub bug_archive { %append_action_options, }, ); + our $locks = 0; + local $SIG{__DIE__} = sub { + if ($locks) { + for (1..$locks) { unfilelock(); } + $locks = 0; + } + }; my $action = "$config{bug} archived."; my ($debug,$transcript) = __handle_debug_transcript(%param); if ($param{check_archiveable} and @@ -183,7 +197,8 @@ sub bug_archive { die "Bug $param{bug} cannot be archived"; } print {$debug} "$param{bug} considering\n"; - my ($locks, $data) = lockreadbugmerge($param{bug}); + my ($data); + ($locks, $data) = lockreadbugmerge($param{bug}); print {$debug} "$param{bug} read $locks\n"; defined $data or die "No bug found for $param{bug}"; print {$debug} "$param{bug} read ok (done $data->{done})\n"; @@ -460,28 +475,14 @@ sub __return_append_to_log_options{ } if (not exists $param{message}) { $action = $param{action} if exists $param{action}; - $param{message} = < 'mail/fake_control_message', + variables => {request_addr => $param{request_addr}, + requester => $param{requester}, + date => $date, + action => $action + }, + ); } return (action => $action, %param);