X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fservice;h=7e4c2054bcf618b4ec4eb204dbc01d300183d203;hb=eeaa1c6b4d90ed620b53e92efef377446c0b9e8b;hp=35cb4a0d385583c3e68d3487a3f5468753601d47;hpb=88362f1f6dab347b15cd9ea85c6f9ba50b97b43c;p=debbugs.git diff --git a/scripts/service b/scripts/service index 35cb4a0..7e4c205 100755 --- a/scripts/service +++ b/scripts/service @@ -7,6 +7,8 @@ use warnings; use strict; +use POSIX qw(strftime locale_h); +setlocale(LC_TIME, "C"); use Debbugs::Config qw(:globals :config); @@ -37,7 +39,7 @@ use Debbugs::Text qw(:templates); use Scalar::Util qw(looks_like_number); -use List::Util qw(first); +use List::AllUtils qw(first uniqnum); use Mail::RFC822::Address; use Encode qw(decode encode); @@ -282,7 +284,7 @@ for ($procline=0; $procline<=$#bodylines; $procline++) { } elsif (m/^subscribe/i) { print {$transcript} < $transcript, debug => $debug, ok => \$ok, + replyto => $replyto, ); if ($terminate_control) { last; } } else { + print {$transcript} "Unknown command or malformed arguments to command.\n"; $errors++; if (++$unknowns >= 5) { print {$transcript} "Too many unknown commands, stopping here.\n\n"; @@ -504,17 +508,17 @@ if (!defined $header{'subject'} || $header{'subject'} eq "") { } # Error text here advertises how many errors there were -my $error_text = $errors > 0 ? " (with $errors errors)":''; +my $error_text = $errors > 0 ? " (with $errors error" . ($errors > 1 ? "s" : "") . ")" : ""; my @common_headers; push @common_headers, 'X-Loop',$gMaintainerEmail; -my $temp_transcript = ${transcript_scalar}; +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)", + create_mime_message([From => qq("$gProject $gBug Tracking System" <$gMaintainerEmail>), To => $replyto, @maintccs ? (Cc => join(', ',@maintccs)):(), Subject => "Processed${error_text}: $header{subject}", @@ -542,19 +546,6 @@ my $repliedshow= join(', ',$replyto, ) ); -# -1 is the service.in log -&filelock("lock/-1"); -open(AP,">>db-h/-1.log") || die "open db-h/-1.log: $!"; -print(AP - "\2\n$repliedshow\n\5\n$reply\n\3\n". - "\6\n". - "Request received from ". - html_escape($header{'from'})."\n". - "to ".html_escape($controlrequestaddr)."\n". - "\3\n". - "\7\n",escape_log(@log),"\n\3\n") || die "writing db-h/-1.log: $!"; -close(AP) || die "open db-h/-1.log: $!"; -&unfilelock; utime(time,time,"db-h"); &sendmailmessage($reply, @@ -582,20 +573,15 @@ sub fill_template{ my $variables = {config => \%config, defined($ref)?(ref => $ref):(), defined($data)?(data => $data):(), - refs => [map {exists $clonebugs{$_}?$clonebugs{$_}:$_} keys %bug_affected], + refs => [sort + uniqnum(defined($ref)?($ref):(), + map {exists $clonebugs{$_}?$clonebugs{$_}:$_} + keys %bug_affected)], %{$extra_var}, }; - my $hole_var = {'&bugurl' => - sub{"$_[0]: ". - 'http://'.$config{cgi_domain}.'/'. - Debbugs::CGI::bug_links(bug=>$_[0], - links_only => 1, - ); - } - }; return fill_in_template(template => $template, variables => $variables, - hole_var => $hole_var, + output_type => 'text', ); } @@ -893,7 +879,7 @@ sub sendtxthelpraw { close(D); print {$transcript} "Sending $description in separate message.\n"; &sendmailmessage(< To: $replyto Subject: $gProject $gBug help: $description References: $header{'message-id'} @@ -909,7 +895,7 @@ END sub sendlynxdocraw { my ($relpath,$description) = @_; $doc=''; - open(L,"lynx -nolist -dump http://$gCGIDomain/\Q$relpath\E 2>&1 |") || die "fork for lynx: $!"; + open(L,"lynx -nolist -dump $gCGIDomain/\Q$relpath\E 2>&1 |") || die "fork for lynx: $!"; while() { $doc.=$_; } $!=0; close(L); if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) { @@ -921,7 +907,7 @@ sub sendlynxdocraw { } else { print {$transcript} "Sending $description.\n"; &sendmailmessage(< To: $replyto Subject: $gProject $gBugs information: $description References: $header{'message-id'} @@ -958,7 +944,7 @@ sub sendinfo { } print {$transcript} "Sending $description.\n"; &sendmailmessage(< To: $replyto Subject: $gProject $gBugs information: $description References: $header{'message-id'}