2 # $Id: service.in,v 1.118 2005/10/19 01:22:14 don Exp $
4 # Usage: service <code>.nn
5 # Temps: incoming/P<code>.nn
11 use Debbugs::Config qw(:globals :config);
16 use Params::Validate qw(:types validate_with);
18 use Debbugs::Common qw(:util :quit :misc :lock);
20 use Debbugs::Status qw(:read :status :write :versions :hook);
22 use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522);
23 use Debbugs::Mail qw(send_mail_message);
25 use Debbugs::Recipients qw(:all);
26 use HTML::Entities qw(encode_entities);
27 use Debbugs::Versions::Dpkg;
29 use Debbugs::Status qw(splitpackages);
31 use Debbugs::CGI qw(html_escape);
32 use Debbugs::Control qw(:all);
33 use Debbugs::Log qw(:misc);
34 use Debbugs::Text qw(:templates);
36 use Scalar::Util qw(looks_like_number);
38 use List::Util qw(first);
40 use Mail::RFC822::Address;
42 chdir($config{spool_dir}) or
43 die "Unable to chdir to spool_dir '$config{spool_dir}': $!";
48 my ($nn,$control) = $ARGV[0] =~ m/^(([RC])\.\d+)$/;
49 if (not defined $control or not defined $nn) {
50 die "Bad argument to service.in";
52 if (!rename("incoming/G$nn","incoming/P$nn")) {
53 defined $! and $! =~ m/no such file or directory/i and exit 0;
54 die "Failed to rename incoming/G$nn to incoming/P$nn: $!";
57 my $log_fh = IO::File->new("incoming/P$nn",'r') or
58 die "Unable to open incoming/P$nn for reading: $!";
65 print "###\n",join("##\n",@msg),"\n###\n" if $debug;
67 # Bug numbers to send e-mail to, hash so that we don't send to the
71 my (@headerlines,@bodylines);
73 my $parse_output = Debbugs::MIME::parse(join('',@log));
74 @headerlines = @{$parse_output->{header}};
75 @bodylines = @{$parse_output->{body}};
79 $_ = decode_rfc1522($_);
81 print ">$_<\n" if $debug;
84 print ">$v=$_<\n" if $debug;
87 print "!>$_<\n" if $debug;
90 $header{'message-id'} ||= '';
91 $header{subject} ||= '';
93 grep(s/\s+$//,@bodylines);
95 print "***\n",join("\n",@bodylines),"\n***\n" if $debug;
97 if (defined $header{'resent-from'} && !defined $header{'from'}) {
98 $header{'from'} = $header{'resent-from'};
101 defined($header{'from'}) || die "no From header";
103 delete $header{'reply-to'}
104 if ( defined($header{'reply-to'}) && $header{'reply-to'} =~ m/^\s*$/ );
107 if ( defined($header{'reply-to'}) && $header{'reply-to'} ne "" ) {
108 $replyto = $header{'reply-to'};
110 $replyto = $header{'from'};
113 # This is an error counter which should be incremented every time there is an error.
115 my $controlrequestaddr= ($control ? 'control' : 'request').'@'.$config{email_domain};
116 my $transcript_scalar = '';
117 my $transcript = IO::Scalar->new(\$transcript_scalar) or
118 die "Unable to create new IO::Scalar";
119 print {$transcript} "Processing commands for $controlrequestaddr:\n\n";
123 my %affected_packages;
125 # this is the hashref which is passed to all control calls
129 my @common_control_options =
130 (transcript => $transcript,
131 requester => $header{from},
132 request_addr => $controlrequestaddr,
133 request_msgid => $header{'message-id'},
134 request_subject => $header{subject},
136 request_replyto => $replyto,
138 affected_packages => \%affected_packages,
139 recipients => \%recipients,
144 my $lowstate= 'idle';
145 my $mergelowstate= 'idle';
150 $user =~ s/^.*<(.*)>.*$/$1/;
151 $user =~ s/[(].*[)]//;
152 $user =~ s/^\s*(\S+)\s+.*$/$1/;
153 $user = "" unless (Debbugs::User::is_valid_user($user));
154 my $indicated_user = 0;
159 if (@gExcludeFromControl and grep {$replyto =~ m/\Q$_\E/} @gExcludeFromControl) {
160 print {$transcript} fill_template('mail/excluded_from_control');
171 push @bcc, $_[0] unless grep { $_ eq $_[0] } @bcc;
186 for ($procline=0; $procline<=$#bodylines; $procline++) {
191 $state eq 'idle' || print "state: $state ?\n";
192 $lowstate eq 'idle' || print "lowstate: $lowstate ?\n";
193 $mergelowstate eq 'idle' || print "mergelowstate: $mergelowstate ?\n";
195 print {$transcript} "Stopping processing here.\n\n";
198 $_= $bodylines[$procline]; s/\s+$//;
199 # Remove BOM markers from UTF-8 strings
203 print {$transcript} "> $_\n";
206 if (m/^(?:stop|quit|--|thank(?:s|\s*you)?|kthxbye)\.*\s*$/i) {
207 print {$transcript} "Stopping processing here.\n\n";
209 } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000) {
211 if ($dl > 0 and not grep /debug/,@common_control_options) {
212 push @common_control_options,(debug => $transcript);
214 print {$transcript} "Debug level $dl.\n\n";
215 } elsif (m/^(send|get)\s+\#?(\d{2,})$/i) {
217 &sendlynxdoc("bugreport.cgi?bug=$ref","logs for $gBug#$ref");
218 } elsif (m/^send-detail\s+\#?(\d{2,})$/i) {
220 &sendlynxdoc("bugreport.cgi?bug=$ref&boring=yes",
221 "detailed logs for $gBug#$ref");
222 } elsif (m/^index(\s+full)?$/i) {
223 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
225 $ok++; # well, it's not really ok, but it fixes #81224 :)
226 } elsif (m/^index-summary\s+by-package$/i) {
227 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
229 $ok++; # well, it's not really ok, but it fixes #81224 :)
230 } elsif (m/^index-summary(\s+by-number)?$/i) {
231 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
233 $ok++; # well, it's not really ok, but it fixes #81224 :)
234 } elsif (m/^index(\s+|-)pack(age)?s?$/i) {
235 &sendlynxdoc("pkgindex.cgi?indexon=pkg",'index of packages');
236 } elsif (m/^index(\s+|-)maints?$/i) {
237 &sendlynxdoc("pkgindex.cgi?indexon=maint",'index of maintainers');
238 } elsif (m/^index(\s+|-)maint\s+(\S+)$/i) {
240 &sendlynxdoc("pkgreport.cgi?maint=" . urlsanit($maint),
241 "$gBug list for maintainer \`$maint'");
243 } elsif (m/^index(\s+|-)pack(age)?s?\s+(\S.*\S)$/i) {
245 &sendlynxdoc("pkgreport.cgi?pkg=" . urlsanit($package),
246 "$gBug list for package $package");
248 } elsif (m/^send-unmatched(\s+this|\s+-?0)?$/i) {
249 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
251 $ok++; # well, it's not really ok, but it fixes #81224 :)
252 } elsif (m/^send-unmatched\s+(last|-1)$/i) {
253 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
255 $ok++; # well, it's not really ok, but it fixes #81224 :)
256 } elsif (m/^send-unmatched\s+(old|-2)$/i) {
257 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
259 $ok++; # well, it's not really ok, but it fixes #81224 :)
260 } elsif (m/^getinfo\s+([\w.-]+)$/i) {
261 # the following is basically a Debian-specific kludge, but who cares
263 if ($req =~ /^maintainers$/i && -f "$gConfigDir/Maintainers") {
264 &sendinfo("local", "$gConfigDir/Maintainers", "Maintainers file");
265 } elsif ($req =~ /^override\.(\w+)\.([\w.-]+)$/i) {
267 &sendinfo("ftp.d.o", "$req", "override file for $2 part of $1 distribution");
268 } elsif ($req =~ /^pseudo-packages\.(description|maintainers)$/i && -f "$gConfigDir/$req") {
269 &sendinfo("local", "$gConfigDir/$req", "$req file");
271 print {$transcript} "Info file $req does not exist.\n\n";
273 } elsif (m/^help/i) {
275 print {$transcript} "\n";
277 } elsif (m/^refcard/i) {
278 &sendtxthelp("bug-mailserver-refcard.txt","mail servers' reference card");
279 } elsif (m/^subscribe/i) {
280 print {$transcript} <<END;
281 There is no $gProject $gBug mailing list. If you wish to review bug reports
282 please do so via http://$gWebDomain/ or ask this mail server
284 soon: MAILINGLISTS_TEXT
286 } elsif (m/^unsubscribe/i) {
287 print {$transcript} <<END;
288 soon: UNSUBSCRIBE_TEXT
289 soon: MAILINGLISTS_TEXT
291 } elsif (m/^user\s+(\S+)\s*$/i) {
293 if (Debbugs::User::is_valid_user($newuser)) {
294 my $olduser = ($user ne "" ? " (was $user)" : "");
295 print {$transcript} "Setting user to $newuser$olduser.\n";
299 print {$transcript} "Selected user id ($newuser) invalid, sorry\n";
304 } elsif (m/^usercategory\s+(\S+)(\s+\[hidden\])?\s*$/i) {
307 my $hidden = (defined $2 and $2 ne "");
314 print {$transcript} "No valid user selected\n";
318 if (not $indicated_user and defined $user) {
319 print {$transcript} "User is $user\n";
323 while (++$procline <= $#bodylines) {
324 unless ($bodylines[$procline] =~ m/^\s*([*+])\s*(\S.*)$/) {
328 print {$transcript} "> $bodylines[$procline]\n";
330 my ($o, $txt) = ($1, $2);
331 if ($#cats == -1 && $o eq "+") {
332 print {$transcript} "User defined category specification must start with a category name. Skipping.\n\n";
338 unless (ref($cats[-1]) eq "HASH") {
339 $cats[-1] = { "nam" => $cats[-1],
340 "pri" => [], "ttl" => [] };
343 my ($desc, $ord, $op);
344 if ($txt =~ m/^(.*\S)\s*\[((\d+):\s*)?\]\s*$/) {
345 $desc = $1; $ord = $3; $op = "";
346 } elsif ($txt =~ m/^(.*\S)\s*\[((\d+):\s*)?(\S+)\]\s*$/) {
347 $desc = $1; $ord = $3; $op = $4;
348 } elsif ($txt =~ m/^([^[\s]+)\s*$/) {
349 $desc = ""; $op = $1;
351 print {$transcript} "Unrecognised syntax for category section. Skipping.\n\n";
356 $ord = 999 unless defined $ord;
359 push @{$cats[-1]->{"pri"}}, $prefix . $op;
360 push @{$cats[-1]->{"ttl"}}, $desc;
361 push @ords, "$ord $catsec";
363 $cats[-1]->{"def"} = $desc;
364 push @ords, "$ord DEF";
368 my ($a1, $a2, $b1, $b2) = split / /, "$a $b";
369 ((looks_like_number($a1) and looks_like_number($a2))?$a1 <=> $b1:$a1 cmp $b1) ||
370 ((looks_like_number($a2) and looks_like_number($b2))?$a2 <=> $b2:$a2 cmp $b2);
372 $cats[-1]->{"ord"} = [map { m/^.* (\S+)/; $1 eq "DEF" ? $catsec + 1 : $1 } @ords];
373 } elsif ($o eq "*") {
376 if ($txt =~ m/^(.*\S)(\s*\[(\S+)\])\s*$/) {
377 $name = $1; $prefix = $3;
379 $name = $txt; $prefix = "";
384 # XXX: got @cats, now do something with it
385 my $u = Debbugs::User::get_user($user);
387 print {$transcript} "Added usercategory $catname.\n\n";
388 $u->{"categories"}->{$catname} = [ @cats ];
390 push @{$u->{visible_cats}},$catname;
393 print {$transcript} "Removed usercategory $catname.\n\n";
394 delete $u->{"categories"}->{$catname};
395 @{$u->{visible_cats}} = grep {$_ ne $catname} @{$u->{visible_cats}};
398 } elsif (m/^usertags?\s+\#?(-?\d+)\s+(([=+-])\s*)?(\S.*)?$/i) {
401 my $addsubcode = $3 || "+";
403 if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
404 $ref = $clonebugs{$ref};
407 print {$transcript} "No valid user selected\n";
411 if (not $indicated_user and defined $user) {
412 print {$transcript} "User is $user\n";
417 Debbugs::User::read_usertags(\%ut, $user);
418 my @oldtags = (); my @newtags = (); my @badtags = ();
420 if (defined $tags and length $tags) {
421 for my $t (split /[,\s]+/, $tags) {
422 if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
430 print {$transcript} "Ignoring illegal tag/s: ".join(', ', @badtags).".\nPlease use only alphanumerics, at, dot, plus and dash.\n";
433 for my $t (keys %chtags) {
434 $ut{$t} = [] unless defined $ut{$t};
436 for my $t (keys %ut) {
437 my %res = map { ($_, 1) } @{$ut{$t}};
438 push @oldtags, $t if defined $res{$ref};
439 my $addop = ($addsubcode eq "+" or $addsubcode eq "=");
440 my $del = (defined $chtags{$t} ? $addsubcode eq "-"
441 : $addsubcode eq "=");
442 $res{$ref} = 1 if ($addop && defined $chtags{$t});
443 delete $res{$ref} if ($del);
444 push @newtags, $t if defined $res{$ref};
445 $ut{$t} = [ sort { $a <=> $b } (keys %res) ];
448 print {$transcript} "There were no usertags set.\n";
450 print {$transcript} "Usertags were: " . join(" ", @oldtags) . ".\n";
452 print {$transcript} "Usertags are now: " . join(" ", @newtags) . ".\n";
453 Debbugs::User::write_usertags(\%ut, $user);
455 } elsif (!$control) {
456 print {$transcript} <<END;
457 Unknown command or malformed arguments to command.
458 (Use control\@$gEmailDomain to manipulate reports.)
462 if (++$unknowns >= 3) {
463 print {$transcript} "Too many unknown commands, stopping here.\n\n";
466 #### "developer only" ones start here
467 } elsif (m/^close\s+\#?(-?\d+)(?:\s+(\d.*))?$/i) {
470 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
471 $bug_affected{$ref}=1;
474 print {$transcript} "'close' is deprecated; see http://$gWebDomain/Developer$gHTMLSuffix#closing.\n";
475 if (length($data->{done}) and not defined($version)) {
476 print {$transcript} "$gBug is already closed, cannot re-close.\n\n";
481 "marked as fixed in version $version" :
483 ", send any further explanations to $data->{originator}";
485 $affected_packages{$data->{package}} = 1;
486 add_recipients(data => $data,
487 recipients => \%recipients,
488 actions_taken => {done => 1},
489 transcript => $transcript,
490 ($dl > 0 ? (debug => $transcript):()),
492 $data->{done}= $replyto;
493 my @keywords= split ' ', $data->{keywords};
494 my $extramessage = '';
495 if (grep $_ eq 'pending', @keywords) {
496 $extramessage= "Removed pending tag.\n";
497 $data->{keywords}= join ' ', grep $_ ne 'pending',
500 addfixedversions($data, $data->{package}, $version, 'binary');
503 From: $gMaintainerEmail ($gProject $gBug Tracking System)
504 To: $data->{originator}
505 Subject: $gBug#$ref acknowledged by developer
507 References: $header{'message-id'} $data->{msgid}
508 In-Reply-To: $data->{msgid}
509 Message-ID: <handler.$ref.$nn.notifdonectrl.$midix\@$gEmailDomain>
510 Reply-To: $ref\@$gEmailDomain
511 X-$gProject-PR-Message: they-closed-control $ref
513 This is an automatic notification regarding your $gBug report
514 #$ref: $data->{subject},
515 which was filed against the $data->{package} package.
517 It has been marked as closed by one of the developers, namely
520 You should be hearing from them with a substantive response shortly,
521 in case you haven't already. If not, please contact them directly.
524 (administrator, $gProject $gBugs database)
527 &sendmailmessage($message,$data->{originator});
528 } while (&getnextbug);
531 } elsif (m/^reassign\s+\#?(-?\d+)\s+ # bug and command
532 (?:(?:((?:src:|source:)?$config{package_name_re}) # new package
533 (?:\s+((?:$config{package_name_re}\/)?
534 $config{package_version_re}))?)| # optional version
535 ((?:src:|source:)?$config{package_name_re} # multiple package form
536 (?:\s*\,\s*(?:src:|source:)?$config{package_name_re})+))
541 if (not defined $2) {
542 push @new_packages, split /\s*\,\s*/,$4;
545 push @new_packages, $2;
547 @new_packages = map {y/A-Z/a-z/; s/^(?:src|source):/src:/; $_;} @new_packages;
548 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
549 $bug_affected{$ref}=1;
552 set_package(@common_control_options,
554 package => \@new_packages,
556 # if there is a version passed, we make an internal call
558 if (defined($version) && length $version) {
559 set_found(@common_control_options,
567 print {$transcript} "Failed to clear fixed versions and reopen on $ref: ".cleanup_eval_fail($@,$debug)."\n";
569 } elsif (m/^reopen\s+\#?(-?\d+)(?:\s+([\=\!]|(?:\S.*\S)))?$/i) {
572 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
573 $bug_affected{$ref}=1;
574 my $new_submitter = $2;
575 if (defined $new_submitter) {
576 if ($new_submitter eq '=') {
577 undef $new_submitter;
579 elsif ($new_submitter eq '!') {
580 $new_submitter = $replyto;
584 reopen(@common_control_options,
586 submitter => $new_submitter,
591 print {$transcript} "Failed to reopen $ref: ".cleanup_eval_fail($@,$debug)."\n";
593 } elsif (m{^(?:(?i)found)\s+\#?(-?\d+)
594 (?:\s+((?:$config{package_name_re}\/)?
595 $config{package_version_re}
596 # allow for multiple packages
597 (?:\s*,\s*(?:$config{package_name_re}\/)?
598 $config{package_version_re})*)
602 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
605 @versions = split /\s*,\s*/,$2;
607 set_found(@common_control_options,
615 print {$transcript} "Failed to add found on $ref: ".cleanup_eval_fail($@,$debug)."\n";
620 set_fixed(@common_control_options,
628 print {$transcript} "Failed to clear fixed versions and reopen on $ref: ".cleanup_eval_fail($@,$debug)."\n";
632 elsif (m{^(?:(?i)notfound)\s+\#?(-?\d+)
633 \s+((?:$config{package_name_re}\/)?
634 $config{package_version_re}
635 # allow for multiple packages
636 (?:\s*,\s*(?:$config{package_name_re}\/)?
637 $config{package_version_re})*
641 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
643 @versions = split /\s*,\s*/,$2;
645 set_found(@common_control_options,
653 print {$transcript} "Failed to remove found on $ref: ".cleanup_eval_fail($@,$debug)."\n";
656 elsif (m{^(?:(?i)fixed)\s+\#?(-?\d+)
657 \s+((?:$config{package_name_re}\/)?
658 $config{package_version_re}
659 # allow for multiple packages
660 (?:\s*,\s*(?:$config{package_name_re}\/)?
661 $config{package_version_re})*)
665 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
667 @versions = split /\s*,\s*/,$2;
669 set_fixed(@common_control_options,
677 print {$transcript} "Failed to add fixed on $ref: ".cleanup_eval_fail($@,$debug)."\n";
680 elsif (m{^(?:(?i)notfixed)\s+\#?(-?\d+)
681 \s+((?:$config{package_name_re}\/)?
682 $config{package_version_re}
683 # allow for multiple packages
684 (?:\s*,\s*(?:$config{package_name_re}\/)?
685 $config{package_version_re})*)
689 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
691 @versions = split /\s*,\s*/,$2;
693 set_fixed(@common_control_options,
701 print {$transcript} "Failed to remove fixed on $ref: ".cleanup_eval_fail($@,$debug)."\n";
704 elsif (m/^submitter\s+\#?(-?\d+)\s+(\!|\S.*\S)$/i) {
707 $bug_affected{$ref}=1;
708 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
709 my $newsubmitter = $2 eq '!' ? $replyto : $2;
710 if (not Mail::RFC822::Address::valid($newsubmitter)) {
711 print {$transcript} "$newsubmitter is not a valid e-mail address; not changing submitter\n";
716 set_submitter(@common_control_options,
718 submitter => $newsubmitter,
723 print {$transcript} "Failed to set submitter on $ref: ".cleanup_eval_fail($@,$debug)."\n";
726 } elsif (m/^forwarded\s+\#?(-?\d+)\s+(\S.*\S)$/i) {
730 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
731 $bug_affected{$ref} = 1;
733 set_forwarded(@common_control_options,
735 forwarded => $forward_to,
740 print {$transcript} "Failed to set the forwarded-to-address of $ref: ".cleanup_eval_fail($@,$debug)."\n";
742 } elsif (m/^notforwarded\s+\#?(-?\d+)$/i) {
745 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
746 $bug_affected{$ref} = 1;
748 set_forwarded(@common_control_options,
755 print {$transcript} "Failed to clear the forwarded-to-address of $ref: ".cleanup_eval_fail($@,$debug)."\n";
757 } elsif (m/^(?:severity|priority)\s+\#?(-?\d+)\s+([-0-9a-z]+)$/i) {
760 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
761 $bug_affected{$ref}=1;
763 if (exists $gObsoleteSeverities{$newseverity}) {
764 print {$transcript} "Severity level \`$newseverity' is obsolete. " .
765 "Use $gObsoleteSeverities{$newseverity} instead.\n\n";
767 } elsif (not defined first {$_ eq $newseverity}
768 (@gSeverityList, "$gDefaultSeverity")) {
769 print {$transcript} "Severity level \`$newseverity' is not known.\n".
770 "Recognized are: $gShowSeverities.\n\n";
774 set_severity(@common_control_options,
776 severity => $newseverity,
781 print {$transcript} "Failed to set severity of $config{bug} $ref to $newseverity: ".cleanup_eval_fail($@,$debug)."\n";
784 } elsif (m/^tags?\s+\#?(-?\d+)\s+(\S.*)$/i) {
787 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
788 $bug_affected{$ref}=1;
790 my @tags = map {m/^([+=-])(.+)/ ? ($1,$2):($_)} split /[\s,]+/, $tags;
791 # this is an array of hashrefs which contain two elements, the
792 # first of which is the array of tags, the second is the
793 # option to pass to set_tag (we use a hashref here to make it
794 # more obvious what is happening)
797 for my $tag (@tags) {
798 if ($tag =~ /^[=+-]$/) {
800 @tag_operations = {tags => [],
804 elsif ($tag eq '-') {
805 push @tag_operations,
807 option => [remove => 1],
810 elsif ($tag eq '+') {
811 push @tag_operations,
813 option => [add => 1],
818 if (not defined first {$_ eq $tag} @{$config{tags}}) {
822 if (not @tag_operations) {
823 @tag_operations = {tags => [],
824 option => [add => 1],
827 push @{$tag_operations[-1]{tags}},$tag;
830 print {$transcript} "Unknown tag/s: ".join(', ', @badtags).".\n".
831 "Recognized are: ".join(' ', @gTags).".\n\n";
835 for my $operation (@tag_operations) {
836 set_tag(@common_control_options,
838 tag => [@{$operation->{tags}}],
839 warn_on_bad_tags => 0, # don't warn on bad tags,
840 # 'cause we do that above
841 @{$operation->{option}},
846 # we intentionally have two errors here if there is a bad
847 # tag and the above fails for some reason
849 print {$transcript} "Failed to alter tags of $config{bug} $ref: ".cleanup_eval_fail($@,$debug)."\n";
851 } elsif (m/^(un)?block\s+\#?(-?\d+)\s+(?:by|with)\s+(\S.*)?$/i) {
854 my $add_remove = defined $1 && $1 eq 'un';
855 my @blockers = map {exists $clonebugs{$_}?$clonebugs{$_}:$_} split /[\s,]+/, $3;
856 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
857 $bug_affected{$ref} = 1;
859 set_blocks(@common_control_options,
862 $add_remove ? (remove => 1):(add => 1),
867 print {$transcript} "Failed to set blocking bugs of $ref: ".cleanup_eval_fail($@,$debug)."\n";
869 } elsif (m/^retitle\s+\#?(-?\d+)\s+(\S.*\S)\s*$/i) {
871 $ref= $1; my $newtitle= $2;
872 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
873 $bug_affected{$ref} = 1;
875 set_title(@common_control_options,
882 print {$transcript} "Failed to set the title of $ref: ".cleanup_eval_fail($@,$debug)."\n";
884 } elsif (m/^unmerge\s+\#?(-?\d+)$/i) {
887 $bug_affected{$ref} = 1;
889 if (!length($data->{mergedwith})) {
890 print {$transcript} "$gBug is not marked as being merged with any others.\n\n";
893 $mergelowstate eq 'locked' || die "$mergelowstate ?";
894 $action= "Disconnected #$ref from all other report(s).";
895 my @newmergelist= split(/ /,$data->{mergedwith});
897 @bug_affected{@newmergelist} = 1 x @newmergelist;
899 $affected_packages{$data->{package}} = 1;
900 add_recipients(data => $data,
901 recipients => \%recipients,
902 transcript => $transcript,
903 ($dl > 0 ? (debug => $transcript):()),
905 $data->{mergedwith}= ($ref == $discref) ? ''
906 : join(' ',grep($_ ne $ref,@newmergelist));
907 } while (&getnextbug);
910 } elsif (m/^merge\s+#?(-?\d+(\s+#?-?\d+)+)\s*$/i) {
912 my @tomerge= sort { $a <=> $b } split(/\s+#?/,$1);
913 my @newmergelist= ();
918 while (defined($ref= shift(@tomerge))) {
919 print {$transcript} "D| checking merge $ref\n" if $dl;
921 if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
922 $ref = $clonebugs{$ref};
924 next if grep($_ == $ref,@newmergelist);
925 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
926 if (!&checkpkglimit) { &cancelbug; @newmergelist=(); last; }
928 print {$transcript} "D| adding $ref ($data->{mergedwith})\n" if $dl;
930 &checkmatch('package','m_package',$data->{package},@newmergelist);
931 &checkmatch('forwarded addr','m_forwarded',$data->{forwarded},@newmergelist);
932 $data->{severity} = '$gDefaultSeverity' if $data->{severity} eq '';
933 &checkmatch('severity','m_severity',$data->{severity},@newmergelist);
934 &checkmatch('blocks','m_blocks',$data->{blocks},@newmergelist);
935 &checkmatch('blocked-by','m_blockedby',$data->{blockedby},@newmergelist);
936 &checkmatch('done mark','m_done',length($data->{done}) ? 'done' : 'open',@newmergelist);
937 &checkmatch('owner','m_owner',$data->{owner},@newmergelist);
938 &checkmatch('summary','m_summary',$data->{summary},@newmergelist);
939 &checkmatch('affects','m_affects',$data->{affects},@newmergelist);
940 foreach my $t (split /\s+/, $data->{keywords}) { $tags{$t} = 1; }
941 foreach my $f (@{$data->{found_versions}}) { $found{$f} = 1; }
942 foreach my $f (@{$data->{fixed_versions}}) { $fixed{$f} = 1; }
943 if (length($mismatch)) {
944 print {$transcript} "Mismatch - only $gBugs in same state can be merged:\n".
947 &cancelbug; @newmergelist=(); last;
949 push(@newmergelist,$ref);
950 push(@tomerge,split(/ /,$data->{mergedwith}));
954 @newmergelist= sort { $a <=> $b } @newmergelist;
955 $action= "Merged @newmergelist.";
956 delete @fixed{keys %found};
957 for $ref (@newmergelist) {
958 &getbug || die "huh ? $gBug $ref disappeared during merge";
959 $affected_packages{$data->{package}} = 1;
960 add_recipients(data => $data,
961 recipients => \%recipients,
962 transcript => $transcript,
963 ($dl > 0 ? (debug => $transcript):()),
965 @bug_affected{@newmergelist} = 1 x @newmergelist;
966 $data->{mergedwith}= join(' ',grep($_ != $ref,@newmergelist));
967 $data->{keywords}= join(' ', keys %tags);
968 $data->{found_versions}= [sort keys %found];
969 $data->{fixed_versions}= [sort keys %fixed];
972 print {$transcript} "$action\n\n";
975 } elsif (m/^forcemerge\s+\#?(-?\d+(?:\s+\#?-?\d+)+)\s*$/i) {
977 my @temp = split /\s+\#?/,$1;
978 my $master_bug = shift @temp;
980 my @tomerge = sort { $a <=> $b } @temp;
981 unshift @tomerge,$master_bug;
982 print {$transcript} "D| force merging ".join(',',@tomerge)."\n" if $dl;
983 my @newmergelist= ();
987 # Here we try to do the right thing.
988 # First, if the bugs are in the same package, we merge all of the found, fixed, and tags.
989 # If not, we discard the found and fixed.
990 # Everything else we set to the values of the first bug.
992 while (defined($ref= shift(@tomerge))) {
993 print {$transcript} "D| checking merge $ref\n" if $dl;
995 if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
996 $ref = $clonebugs{$ref};
998 next if grep($_ == $ref,@newmergelist);
999 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
1000 if (!&checkpkglimit) { &cancelbug; @newmergelist=(); last; }
1002 print {$transcript} "D| adding $ref ($data->{mergedwith})\n" if $dl;
1003 $master_bug_data = $data if not defined $master_bug_data;
1004 if ($data->{package} ne $master_bug_data->{package}) {
1005 print {$transcript} "Mismatch - only $gBugs in the same package can be forcibly merged:\n".
1006 "$gBug $ref is not in the same package as $master_bug\n";
1008 &cancelbug; @newmergelist=(); last;
1010 for my $t (split /\s+/,$data->{keywords}) {
1013 @found{@{$data->{found_versions}}} = (1) x @{$data->{found_versions}};
1014 @fixed{@{$data->{fixed_versions}}} = (1) x @{$data->{fixed_versions}};
1015 push(@newmergelist,$ref);
1016 push(@tomerge,split(/ /,$data->{mergedwith}));
1019 if (@newmergelist) {
1020 @newmergelist= sort { $a <=> $b } @newmergelist;
1021 $action= "Forcibly Merged @newmergelist.";
1022 delete @fixed{keys %found};
1023 for $ref (@newmergelist) {
1024 &getbug || die "huh ? $gBug $ref disappeared during merge";
1025 $affected_packages{$data->{package}} = 1;
1026 add_recipients(data => $data,
1027 recipients => \%recipients,
1028 transcript => $transcript,
1029 ($dl > 0 ? (debug => $transcript):()),
1031 @bug_affected{@newmergelist} = 1 x @newmergelist;
1032 $data->{mergedwith}= join(' ',grep($_ != $ref,@newmergelist));
1033 $data->{keywords}= join(' ', keys %tags);
1034 $data->{found_versions}= [sort keys %found];
1035 $data->{fixed_versions}= [sort keys %fixed];
1036 my @field_list = qw(forwarded package severity blocks blockedby owner done affects summary);
1037 @{$data}{@field_list} = @{$master_bug_data}{@field_list};
1040 print {$transcript} "$action\n\n";
1043 } elsif (m/^clone\s+#?(\d+)\s+((-\d+\s+)*-\d+)\s*$/i) {
1047 my @newclonedids = split /\s+/, $2;
1048 my $newbugsneeded = scalar(@newclonedids);
1051 $bug_affected{$ref} = 1;
1053 $affected_packages{$data->{package}} = 1;
1054 if (length($data->{mergedwith})) {
1055 print {$transcript} "$gBug is marked as being merged with others. Use an existing clone.\n\n";
1059 &filelock("nextnumber.lock");
1060 open(N,"nextnumber") || die "nextnumber: read: $!";
1061 my $v=<N>; $v =~ s/\n$// || die "nextnumber bad format";
1062 my $firstref= $v+0; $v += $newbugsneeded;
1063 open(NN,">nextnumber"); print NN "$v\n"; close(NN);
1066 my $lastref = $firstref + $newbugsneeded - 1;
1068 if ($newbugsneeded == 1) {
1069 $action= "$gBug $origref cloned as bug $firstref.";
1071 $action= "$gBug $origref cloned as bugs $firstref-$lastref.";
1074 my $blocks = $data->{blocks};
1075 my $blockedby = $data->{blockedby};
1078 my $ohash = get_hashname($origref);
1079 my $clone = $firstref;
1080 @bug_affected{@newclonedids} = 1 x @newclonedids;
1081 for my $newclonedid (@newclonedids) {
1082 $clonebugs{$newclonedid} = $clone;
1084 my $hash = get_hashname($clone);
1085 copy("db-h/$ohash/$origref.log", "db-h/$hash/$clone.log");
1086 copy("db-h/$ohash/$origref.status", "db-h/$hash/$clone.status");
1087 copy("db-h/$ohash/$origref.summary", "db-h/$hash/$clone.summary");
1088 copy("db-h/$ohash/$origref.report", "db-h/$hash/$clone.report");
1089 &bughook('new', $clone, $data);
1091 # Update blocking info of bugs blocked by or blocking the
1093 foreach $ref (split ' ', $blocks) {
1095 $data->{blockedby} = manipset($data->{blockedby}, $clone, 1);
1098 foreach $ref (split ' ', $blockedby) {
1100 $data->{blocks} = manipset($data->{blocks}, $clone, 1);
1108 } elsif (m/^package\:?\s+(\S.*\S)?\s*$/i) {
1110 my @pkgs = split /\s+/, $1;
1111 if (scalar(@pkgs) > 0) {
1112 %limit_pkgs = map { ($_, 1) } @pkgs;
1113 $limit{package} = [@pkgs];
1114 print {$transcript} "Limiting to bugs with field 'package' containing at least one of ".join(', ',map {qq('$_')} @pkgs)."\n";
1115 print {$transcript} "Limit currently set to";
1116 for my $limit_field (keys %limit) {
1117 print {$transcript} " '$limit_field':".join(', ',map {qq('$_')} @{$limit{$limit_field}})."\n";
1119 print {$transcript} "\n";
1122 $limit{package} = [];
1123 print {$transcript} "Limit cleared.\n\n";
1125 } elsif (m/^limit\:?\s+(\S.*\S)\s*$/) {
1127 my ($field,@options) = split /\s+/, $1;
1128 $field = lc($field);
1129 if ($field =~ /^(?:clear|unset|blank)$/) {
1131 print {$transcript} "Limit cleared.\n\n";
1133 elsif (exists $Debbugs::Status::fields{$field} ) {
1134 # %limit can actually contain regexes, but because they're
1135 # not evaluated in Safe, DO NOT allow them through without
1137 $limit{$field} = [@options];
1138 print {$transcript} "Limiting to bugs with field '$field' containing at least one of ".join(', ',map {qq('$_')} @options)."\n";
1139 print {$transcript} "Limit currently set to";
1140 for my $limit_field (keys %limit) {
1141 print {$transcript} " '$limit_field':".join(', ',map {qq('$_')} @{$limit{$limit_field}})."\n";
1143 print {$transcript} "\n";
1146 print {$transcript} "Limit key $field not understood. Stopping processing here.\n\n";
1150 } elsif (m/^affects?\s+\#?(-?\d+)(?:\s+((?:[=+-])?)\s*(\S.*)?)?\s*$/i) {
1153 my $add_remove = $2 || '';
1154 my $packages = $3 || '';
1155 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1156 $bug_affected{$ref} = 1;
1158 affects(@common_control_options,
1160 packages => [splitpackages($3)],
1161 ($add_remove eq '+'?(add => 1):()),
1162 ($add_remove eq '-'?(remove => 1):()),
1167 print {$transcript} "Failed to mark $ref as affecting package(s): ".cleanup_eval_fail($@,$debug)."\n";
1170 } elsif (m/^summary\s+\#?(-?\d+)\s*(\d+|)\s*$/i) {
1173 my $summary_msg = length($2)?$2:undef;
1174 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1175 $bug_affected{$ref} = 1;
1177 summary(@common_control_options,
1179 summary => $summary_msg,
1184 print {$transcript} "Failed to give $ref a summary: ".cleanup_eval_fail($@,$debug)."\n";
1187 } elsif (m/^owner\s+\#?(-?\d+)\s+((?:\S.*\S)|\!)\s*$/i) {
1190 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1192 if ($newowner eq '!') {
1193 $newowner = $replyto;
1195 $bug_affected{$ref} = 1;
1197 owner(@common_control_options,
1204 print {$transcript} "Failed to mark $ref as having an owner: ".cleanup_eval_fail($@,$debug)."\n";
1206 } elsif (m/^noowner\s+\#?(-?\d+)\s*$/i) {
1209 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1210 $bug_affected{$ref} = 1;
1212 owner(@common_control_options,
1219 print {$transcript} "Failed to mark $ref as not having an owner: ".cleanup_eval_fail($@,$debug)."\n";
1221 } elsif (m/^unarchive\s+#?(\d+)$/i) {
1224 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1225 $bug_affected{$ref} = 1;
1227 bug_unarchive(@common_control_options,
1229 recipients => \%recipients,
1235 } elsif (m/^archive\s+#?(\d+)$/i) {
1238 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1239 $bug_affected{$ref} = 1;
1241 bug_archive(@common_control_options,
1244 archive_unarchived => 0,
1251 print {$transcript} "Unknown command or malformed arguments to command.\n\n";
1253 if (++$unknowns >= 5) {
1254 print {$transcript} "Too many unknown commands, stopping here.\n\n";
1259 if ($procline>$#bodylines) {
1260 print {$transcript} ">\nEnd of message, stopping processing here.\n\n";
1262 if (!$ok && !$quickabort) {
1264 print {$transcript} "No commands successfully parsed; sending the help text(s).\n";
1266 print {$transcript} "\n";
1269 my @maintccs = determine_recipients(recipients => \%recipients,
1273 my $maintccs = 'Cc: '.join(",\n ",
1274 determine_recipients(recipients => \%recipients,
1280 $packagepr = "X-${gProject}-PR-Package: " . join(keys %affected_packages) . "\n" if keys %affected_packages;
1282 # Add Bcc's to subscribed bugs
1283 # now handled by Debbugs::Recipients
1284 #push @bcc, map {"bugs=$_\@$gListDomain"} keys %bug_affected;
1286 if (!defined $header{'subject'} || $header{'subject'} eq "") {
1287 $header{'subject'} = "your mail";
1290 # Error text here advertises how many errors there were
1291 my $error_text = $errors > 0 ? " (with $errors errors)":'';
1294 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1296 ${maintccs}Subject: Processed${error_text}: $header{'subject'}
1297 In-Reply-To: $header{'message-id'}
1300 References: $header{'message-id'}
1301 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
1303 ${packagepr}X-$gProject-PR-Message: transcript
1305 ${transcript_scalar}Please contact me if you need assistance.
1308 (administrator, $gProject $gBugs database)
1311 my $repliedshow= join(', ',$replyto,
1312 determine_recipients(recipients => \%recipients,
1317 # -1 is the service.in log
1318 &filelock("lock/-1");
1319 open(AP,">>db-h/-1.log") || die "open db-h/-1.log: $!";
1321 "\2\n$repliedshow\n\5\n$reply\n\3\n".
1323 "<strong>Request received</strong> from <code>".
1324 html_escape($header{'from'})."</code>\n".
1325 "to <code>".html_escape($controlrequestaddr)."</code>\n".
1327 "\7\n",escape_log(@log),"\n\3\n") || die "writing db-h/-1.log: $!";
1328 close(AP) || die "open db-h/-1.log: $!";
1330 utime(time,time,"db-h");
1332 &sendmailmessage($reply,
1333 exists $header{'x-debbugs-no-ack'}?():$replyto,
1334 make_list(values %{{determine_recipients(recipients => \%recipients,
1340 unlink("incoming/P$nn") || die "unlinking incoming/P$nn: $!";
1342 sub sendmailmessage {
1343 my ($message,@recips) = @_;
1344 $message = "X-Loop: $gMaintainerEmail\n" . $message;
1345 send_mail_message(message => $message,
1346 recipients => \@recips,
1352 my ($template,$extra_var) = @_;
1354 my $variables = {config => \%config,
1355 defined($ref)?(ref => $ref):(),
1356 defined($data)?(data => $data):(),
1359 my $hole_var = {'&bugurl' =>
1361 'http://'.$config{cgi_domain}.'/'.
1362 Debbugs::CGI::bug_url($_[0]);
1365 return fill_in_template(template => $template,
1366 variables => $variables,
1367 hole_var => $hole_var,
1371 =head2 message_body_template
1373 message_body_template('mail/ack',{ref=>'foo'});
1375 Creates a message body using a template
1379 sub message_body_template{
1380 my ($template,$extra_var) = @_;
1382 my $body = fill_template($template,$extra_var);
1383 return fill_template('mail/message_body',
1392 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
1395 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
1399 #sub unimplemented {
1400 # print {$transcript} "Sorry, command $_[0] not yet implemented.\n\n";
1402 our %checkmatch_values;
1404 my ($string,$mvarname,$svarvalue,@newmergelist) = @_;
1406 if (@newmergelist) {
1407 $mvarvalue = $checkmatch_values{$mvarname};
1408 print {$transcript} "D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n"
1411 "Values for \`$string' don't match:\n".
1412 " #$newmergelist[0] has \`$mvarvalue';\n".
1413 " #$ref has \`$svarvalue'\n"
1414 if $mvarvalue ne $svarvalue;
1416 print {$transcript} "D| setupmatch \`$string' /$mvarname/$svarvalue/\n"
1418 $checkmatch_values{$mvarname} = $svarvalue;
1423 if (keys %limit_pkgs and not defined $limit_pkgs{$data->{package}}) {
1424 print {$transcript} "$gBug number $ref belongs to package $data->{package}, skipping.\n\n";
1436 my %h = map { $_ => 1 } split ' ', $list;
1443 return join ' ', sort keys %h;
1446 # High-level bug manipulation calls
1447 # Do announcements themselves
1449 # Possible calling sequences:
1450 # setbug (returns 0)
1452 # setbug (returns 1)
1453 # &transcript(something)
1456 # setbug (returns 1)
1457 # $action= (something)
1459 # (modify s_* variables)
1460 # } while (getnextbug);
1465 &dlen("nochangebug");
1466 $state eq 'single' || $state eq 'multiple' || die "$state ?";
1468 &endmerge if $manybugs;
1470 &dlex("nochangebug");
1474 our @thisbugmergelist;
1477 &dlen("setbug $ref");
1478 if ($ref =~ m/^-\d+/) {
1479 if (!defined $clonebugs{$ref}) {
1481 &dlex("setbug => noclone");
1484 $ref = $clonebugs{$ref};
1486 $state eq 'idle' || die "$state ?";
1489 &dlex("setbug => 0s");
1493 if (!&checkpkglimit) {
1498 @thisbugmergelist= split(/ /,$data->{mergedwith});
1499 if (!@thisbugmergelist) {
1504 &dlex("setbug => 1s");
1513 &dlex("setbug => 0mc");
1517 $state= 'multiple'; $sref=$ref;
1518 &dlex("setbug => 1m");
1523 &dlen("getnextbug");
1524 $state eq 'single' || $state eq 'multiple' || die "$state ?";
1526 if (!$manybugs || !@thisbugmergelist) {
1527 length($action) || die;
1528 print {$transcript} "$action\n$extramessage\n";
1529 &endmerge if $manybugs;
1531 &dlex("getnextbug => 0");
1534 $ref= shift(@thisbugmergelist);
1535 &getbug || die "bug $ref disappeared";
1537 &dlex("getnextbug => 1");
1541 # Low-level bug-manipulation calls
1542 # Do no announcements
1544 # getbug (returns 0)
1546 # getbug (returns 1)
1550 # $action= (something)
1551 # getbug (returns 1)
1553 # getbug (returns 1)
1555 # [getbug (returns 0)]
1556 # &transcript("$action\n\n")
1559 sub notfoundbug { print {$transcript} "$gBug number $ref not found. (Is it archived?)\n\n"; }
1560 sub foundbug { print {$transcript} "$gBug#$ref: $data->{subject}\n"; }
1564 $mergelowstate eq 'idle' || die "$mergelowstate ?";
1565 &filelock('lock/merge');
1566 $mergelowstate='locked';
1572 $mergelowstate eq 'locked' || die "$mergelowstate ?";
1574 $mergelowstate='idle';
1579 &dlen("getbug $ref");
1580 $lowstate eq 'idle' || die "$state ?";
1581 # Only use unmerged bugs here
1582 if (($data = &lockreadbug($ref,'db-h'))) {
1585 &dlex("getbug => 1");
1590 &dlex("getbug => 0");
1596 $lowstate eq 'open' || die "$state ?";
1603 &dlen("savebug $ref");
1604 $lowstate eq 'open' || die "$lowstate ?";
1605 length($action) || die;
1606 $ref == $sref || die "read $sref but saving $ref ?";
1607 append_action_to_log(bug => $ref,
1609 requester => $header{from},
1610 request_addr => $controlrequestaddr,
1614 unlockwritebug($ref, $data);
1621 print {$transcript} "C> @_ ($state $lowstate $mergelowstate)\n";
1626 print {$transcript} "R> @_ ($state $lowstate $mergelowstate)\n";
1633 my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot');
1634 $url =~ s/([<>&"])/\&$saniarray{$1};/g;
1640 print {$transcript} "\n";
1646 print {$transcript} "\n";
1652 sub sendtxthelpraw {
1653 my ($relpath,$description) = @_;
1655 if (not -e "$gDocDir/$relpath") {
1656 print {$transcript} "Unfortunatly, the help text doesn't exist, so it wasn't sent.\n";
1657 warn "Help text $gDocDir/$relpath not found";
1660 open(D,"$gDocDir/$relpath") || die "open doc file $relpath: $!";
1661 while(<D>) { $doc.=$_; }
1663 print {$transcript} "Sending $description in separate message.\n";
1664 &sendmailmessage(<<END.$doc,$replyto);
1665 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1667 Subject: $gProject $gBug help: $description
1668 References: $header{'message-id'}
1669 In-Reply-To: $header{'message-id'}
1670 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
1672 X-$gProject-PR-Message: doc-text $relpath
1678 sub sendlynxdocraw {
1679 my ($relpath,$description) = @_;
1681 open(L,"lynx -nolist -dump http://$gCGIDomain/\Q$relpath\E 2>&1 |") || die "fork for lynx: $!";
1682 while(<L>) { $doc.=$_; }
1684 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
1685 print {$transcript} "Information ($description) is not available -\n".
1686 "perhaps the $gBug does not exist or is not on the WWW yet.\n";
1689 print {$transcript} "Error getting $description (code $? $!):\n$doc\n";
1691 print {$transcript} "Sending $description.\n";
1692 &sendmailmessage(<<END.$doc,$replyto);
1693 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1695 Subject: $gProject $gBugs information: $description
1696 References: $header{'message-id'}
1697 In-Reply-To: $header{'message-id'}
1698 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
1700 X-$gProject-PR-Message: doc-html $relpath
1709 my ($wherefrom,$path,$description) = @_;
1710 if ($wherefrom eq "ftp.d.o") {
1711 $doc = `lynx -nolist -dump http://ftp.debian.org/debian/indices/$path.gz 2>&1 | gunzip -cf` or die "fork for lynx/gunzip: $!";
1713 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
1714 print {$transcript} "$description is not available.\n";
1717 print {$transcript} "Error getting $description (code $? $!):\n$doc\n";
1720 } elsif ($wherefrom eq "local") {
1722 $doc = do { local $/; <P> };
1725 print {$transcript} "internal errror: info files location unknown.\n";
1728 print {$transcript} "Sending $description.\n";
1729 &sendmailmessage(<<END.$doc,$replyto);
1730 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1732 Subject: $gProject $gBugs information: $description
1733 References: $header{'message-id'}
1734 In-Reply-To: $header{'message-id'}
1735 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
1737 X-$gProject-PR-Message: getinfo
1739 $description follows:
1743 print {$transcript} "\n";