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 (($dl > 0 ? (debug => $transcript):()),
131 transcript => $transcript,
132 requester => $header{from},
133 request_addr => $controlrequestaddr,
134 request_msgid => $header{'message-id'},
135 request_subject => $header{subject},
137 request_replyto => $replyto,
139 affected_packages => \%affected_packages,
140 recipients => \%recipients,
145 my $lowstate= 'idle';
146 my $mergelowstate= 'idle';
151 $user =~ s/^.*<(.*)>.*$/$1/;
152 $user =~ s/[(].*[)]//;
153 $user =~ s/^\s*(\S+)\s+.*$/$1/;
154 $user = "" unless (Debbugs::User::is_valid_user($user));
155 my $indicated_user = 0;
160 if (@gExcludeFromControl and grep {$replyto =~ m/\Q$_\E/} @gExcludeFromControl) {
161 print {$transcript} fill_template('mail/excluded_from_control');
172 push @bcc, $_[0] unless grep { $_ eq $_[0] } @bcc;
187 for ($procline=0; $procline<=$#bodylines; $procline++) {
192 $state eq 'idle' || print "state: $state ?\n";
193 $lowstate eq 'idle' || print "lowstate: $lowstate ?\n";
194 $mergelowstate eq 'idle' || print "mergelowstate: $mergelowstate ?\n";
196 print {$transcript} "Stopping processing here.\n\n";
199 $_= $bodylines[$procline]; s/\s+$//;
200 # Remove BOM markers from UTF-8 strings
204 print {$transcript} "> $_\n";
207 if (m/^(?:stop|quit|--|thank(?:s|\s*you)?|kthxbye)\.*\s*$/i) {
208 print {$transcript} "Stopping processing here.\n\n";
210 } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000) {
212 print {$transcript} "Debug level $dl.\n\n";
213 } elsif (m/^(send|get)\s+\#?(\d{2,})$/i) {
215 &sendlynxdoc("bugreport.cgi?bug=$ref","logs for $gBug#$ref");
216 } elsif (m/^send-detail\s+\#?(\d{2,})$/i) {
218 &sendlynxdoc("bugreport.cgi?bug=$ref&boring=yes",
219 "detailed logs for $gBug#$ref");
220 } elsif (m/^index(\s+full)?$/i) {
221 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
223 $ok++; # well, it's not really ok, but it fixes #81224 :)
224 } elsif (m/^index-summary\s+by-package$/i) {
225 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
227 $ok++; # well, it's not really ok, but it fixes #81224 :)
228 } elsif (m/^index-summary(\s+by-number)?$/i) {
229 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
231 $ok++; # well, it's not really ok, but it fixes #81224 :)
232 } elsif (m/^index(\s+|-)pack(age)?s?$/i) {
233 &sendlynxdoc("pkgindex.cgi?indexon=pkg",'index of packages');
234 } elsif (m/^index(\s+|-)maints?$/i) {
235 &sendlynxdoc("pkgindex.cgi?indexon=maint",'index of maintainers');
236 } elsif (m/^index(\s+|-)maint\s+(\S+)$/i) {
238 &sendlynxdoc("pkgreport.cgi?maint=" . urlsanit($maint),
239 "$gBug list for maintainer \`$maint'");
241 } elsif (m/^index(\s+|-)pack(age)?s?\s+(\S.*\S)$/i) {
243 &sendlynxdoc("pkgreport.cgi?pkg=" . urlsanit($package),
244 "$gBug list for package $package");
246 } elsif (m/^send-unmatched(\s+this|\s+-?0)?$/i) {
247 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
249 $ok++; # well, it's not really ok, but it fixes #81224 :)
250 } elsif (m/^send-unmatched\s+(last|-1)$/i) {
251 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
253 $ok++; # well, it's not really ok, but it fixes #81224 :)
254 } elsif (m/^send-unmatched\s+(old|-2)$/i) {
255 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
257 $ok++; # well, it's not really ok, but it fixes #81224 :)
258 } elsif (m/^getinfo\s+([\w.-]+)$/i) {
259 # the following is basically a Debian-specific kludge, but who cares
261 if ($req =~ /^maintainers$/i && -f "$gConfigDir/Maintainers") {
262 &sendinfo("local", "$gConfigDir/Maintainers", "Maintainers file");
263 } elsif ($req =~ /^override\.(\w+)\.([\w.-]+)$/i) {
265 &sendinfo("ftp.d.o", "$req", "override file for $2 part of $1 distribution");
266 } elsif ($req =~ /^pseudo-packages\.(description|maintainers)$/i && -f "$gConfigDir/$req") {
267 &sendinfo("local", "$gConfigDir/$req", "$req file");
269 print {$transcript} "Info file $req does not exist.\n\n";
271 } elsif (m/^help/i) {
273 print {$transcript} "\n";
275 } elsif (m/^refcard/i) {
276 &sendtxthelp("bug-mailserver-refcard.txt","mail servers' reference card");
277 } elsif (m/^subscribe/i) {
278 print {$transcript} <<END;
279 There is no $gProject $gBug mailing list. If you wish to review bug reports
280 please do so via http://$gWebDomain/ or ask this mail server
282 soon: MAILINGLISTS_TEXT
284 } elsif (m/^unsubscribe/i) {
285 print {$transcript} <<END;
286 soon: UNSUBSCRIBE_TEXT
287 soon: MAILINGLISTS_TEXT
289 } elsif (m/^user\s+(\S+)\s*$/i) {
291 if (Debbugs::User::is_valid_user($newuser)) {
292 my $olduser = ($user ne "" ? " (was $user)" : "");
293 print {$transcript} "Setting user to $newuser$olduser.\n";
297 print {$transcript} "Selected user id ($newuser) invalid, sorry\n";
302 } elsif (m/^usercategory\s+(\S+)(\s+\[hidden\])?\s*$/i) {
305 my $hidden = (defined $2 and $2 ne "");
312 print {$transcript} "No valid user selected\n";
316 if (not $indicated_user and defined $user) {
317 print {$transcript} "User is $user\n";
321 while (++$procline <= $#bodylines) {
322 unless ($bodylines[$procline] =~ m/^\s*([*+])\s*(\S.*)$/) {
326 print {$transcript} "> $bodylines[$procline]\n";
328 my ($o, $txt) = ($1, $2);
329 if ($#cats == -1 && $o eq "+") {
330 print {$transcript} "User defined category specification must start with a category name. Skipping.\n\n";
336 unless (ref($cats[-1]) eq "HASH") {
337 $cats[-1] = { "nam" => $cats[-1],
338 "pri" => [], "ttl" => [] };
341 my ($desc, $ord, $op);
342 if ($txt =~ m/^(.*\S)\s*\[((\d+):\s*)?\]\s*$/) {
343 $desc = $1; $ord = $3; $op = "";
344 } elsif ($txt =~ m/^(.*\S)\s*\[((\d+):\s*)?(\S+)\]\s*$/) {
345 $desc = $1; $ord = $3; $op = $4;
346 } elsif ($txt =~ m/^([^[\s]+)\s*$/) {
347 $desc = ""; $op = $1;
349 print {$transcript} "Unrecognised syntax for category section. Skipping.\n\n";
354 $ord = 999 unless defined $ord;
357 push @{$cats[-1]->{"pri"}}, $prefix . $op;
358 push @{$cats[-1]->{"ttl"}}, $desc;
359 push @ords, "$ord $catsec";
361 $cats[-1]->{"def"} = $desc;
362 push @ords, "$ord DEF";
366 my ($a1, $a2, $b1, $b2) = split / /, "$a $b";
367 ((looks_like_number($a1) and looks_like_number($a2))?$a1 <=> $b1:$a1 cmp $b1) ||
368 ((looks_like_number($a2) and looks_like_number($b2))?$a2 <=> $b2:$a2 cmp $b2);
370 $cats[-1]->{"ord"} = [map { m/^.* (\S+)/; $1 eq "DEF" ? $catsec + 1 : $1 } @ords];
371 } elsif ($o eq "*") {
374 if ($txt =~ m/^(.*\S)(\s*\[(\S+)\])\s*$/) {
375 $name = $1; $prefix = $3;
377 $name = $txt; $prefix = "";
382 # XXX: got @cats, now do something with it
383 my $u = Debbugs::User::get_user($user);
385 print {$transcript} "Added usercategory $catname.\n\n";
386 $u->{"categories"}->{$catname} = [ @cats ];
388 push @{$u->{visible_cats}},$catname;
391 print {$transcript} "Removed usercategory $catname.\n\n";
392 delete $u->{"categories"}->{$catname};
393 @{$u->{visible_cats}} = grep {$_ ne $catname} @{$u->{visible_cats}};
396 } elsif (m/^usertags?\s+\#?(-?\d+)\s+(([=+-])\s*)?(\S.*)?$/i) {
399 my $addsubcode = $3 || "+";
401 if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
402 $ref = $clonebugs{$ref};
405 print {$transcript} "No valid user selected\n";
409 if (not $indicated_user and defined $user) {
410 print {$transcript} "User is $user\n";
415 Debbugs::User::read_usertags(\%ut, $user);
416 my @oldtags = (); my @newtags = (); my @badtags = ();
418 if (defined $tags and length $tags) {
419 for my $t (split /[,\s]+/, $tags) {
420 if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
428 print {$transcript} "Ignoring illegal tag/s: ".join(', ', @badtags).".\nPlease use only alphanumerics, at, dot, plus and dash.\n";
431 for my $t (keys %chtags) {
432 $ut{$t} = [] unless defined $ut{$t};
434 for my $t (keys %ut) {
435 my %res = map { ($_, 1) } @{$ut{$t}};
436 push @oldtags, $t if defined $res{$ref};
437 my $addop = ($addsubcode eq "+" or $addsubcode eq "=");
438 my $del = (defined $chtags{$t} ? $addsubcode eq "-"
439 : $addsubcode eq "=");
440 $res{$ref} = 1 if ($addop && defined $chtags{$t});
441 delete $res{$ref} if ($del);
442 push @newtags, $t if defined $res{$ref};
443 $ut{$t} = [ sort { $a <=> $b } (keys %res) ];
446 print {$transcript} "There were no usertags set.\n";
448 print {$transcript} "Usertags were: " . join(" ", @oldtags) . ".\n";
450 print {$transcript} "Usertags are now: " . join(" ", @newtags) . ".\n";
451 Debbugs::User::write_usertags(\%ut, $user);
453 } elsif (!$control) {
454 print {$transcript} <<END;
455 Unknown command or malformed arguments to command.
456 (Use control\@$gEmailDomain to manipulate reports.)
460 if (++$unknowns >= 3) {
461 print {$transcript} "Too many unknown commands, stopping here.\n\n";
464 #### "developer only" ones start here
465 } elsif (m/^close\s+\#?(-?\d+)(?:\s+(\d.*))?$/i) {
468 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
469 $bug_affected{$ref}=1;
472 print {$transcript} "'close' is deprecated; see http://$gWebDomain/Developer$gHTMLSuffix#closing.\n";
473 if (length($data->{done}) and not defined($version)) {
474 print {$transcript} "$gBug is already closed, cannot re-close.\n\n";
479 "marked as fixed in version $version" :
481 ", send any further explanations to $data->{originator}";
483 $affected_packages{$data->{package}} = 1;
484 add_recipients(data => $data,
485 recipients => \%recipients,
486 actions_taken => {done => 1},
487 transcript => $transcript,
488 ($dl > 0 ? (debug => $transcript):()),
490 $data->{done}= $replyto;
491 my @keywords= split ' ', $data->{keywords};
492 my $extramessage = '';
493 if (grep $_ eq 'pending', @keywords) {
494 $extramessage= "Removed pending tag.\n";
495 $data->{keywords}= join ' ', grep $_ ne 'pending',
498 addfixedversions($data, $data->{package}, $version, 'binary');
501 From: $gMaintainerEmail ($gProject $gBug Tracking System)
502 To: $data->{originator}
503 Subject: $gBug#$ref acknowledged by developer
505 References: $header{'message-id'} $data->{msgid}
506 In-Reply-To: $data->{msgid}
507 Message-ID: <handler.$ref.$nn.notifdonectrl.$midix\@$gEmailDomain>
508 Reply-To: $ref\@$gEmailDomain
509 X-$gProject-PR-Message: they-closed-control $ref
511 This is an automatic notification regarding your $gBug report
512 #$ref: $data->{subject},
513 which was filed against the $data->{package} package.
515 It has been marked as closed by one of the developers, namely
518 You should be hearing from them with a substantive response shortly,
519 in case you haven't already. If not, please contact them directly.
522 (administrator, $gProject $gBugs database)
525 &sendmailmessage($message,$data->{originator});
526 } while (&getnextbug);
529 } elsif (m/^reassign\s+\#?(-?\d+)\s+ # bug and command
530 (?:(?:((?:src:|source:)?$config{package_name_re}) # new package
531 (?:\s+((?:$config{package_name_re}\/)?
532 $config{package_version_re}))?)| # optional version
533 ((?:src:|source:)?$config{package_name_re} # multiple package form
534 (?:\s*\,\s*(?:src:|source:)?$config{package_name_re})+))
539 if (not defined $2) {
540 push @new_packages, split /\s*\,\s*/,$4;
543 push @new_packages, $2;
545 @new_packages = map {y/A-Z/a-z/; s/^(?:src|source):/src:/; $_;} @new_packages;
546 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
547 $bug_affected{$ref}=1;
550 set_package(@common_control_options,
552 package => \@new_packages,
554 # if there is a version passed, we make an internal call
556 if (defined($version) && length $version) {
557 set_found(@common_control_options,
565 print {$transcript} "Failed to clear fixed versions and reopen on $ref: ".cleanup_eval_fail($@,$debug)."\n";
567 } elsif (m/^reopen\s+\#?(-?\d+)(?:\s+([\=\!]|(?:\S.*\S)))?$/i) {
570 $bug_affected{$ref}=1;
571 my $new_submitter = $2;
572 if (defined $new_submitter) {
573 if ($new_submitter eq '=') {
574 undef $new_submitter;
576 elsif ($new_submitter eq '!') {
577 $new_submitter = $replyto;
581 reopen(@common_control_options,
583 submitter => $new_submitter,
588 print {$transcript} "Failed to reopen $ref: ".cleanup_eval_fail($@,$debug)."\n";
590 } elsif (m{^(?:(?i)found)\s+\#?(-?\d+)
591 (?:\s+((?:$config{package_name_re}\/)?
592 $config{package_version_re}
593 # allow for multiple packages
594 (?:\s*,\s*(?:$config{package_name_re}\/)?
595 $config{package_version_re})*)
599 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
602 @versions = split /\s*,\s*/,$2;
604 set_found(@common_control_options,
612 print {$transcript} "Failed to add found on $ref: ".cleanup_eval_fail($@,$debug)."\n";
617 set_fixed(@common_control_options,
625 print {$transcript} "Failed to clear fixed versions and reopen on $ref: ".cleanup_eval_fail($@,$debug)."\n";
629 elsif (m{^(?:(?i)notfound)\s+\#?(-?\d+)
630 \s+((?:$config{package_name_re}\/)?
631 $config{package_version_re}
632 # allow for multiple packages
633 (?:\s*,\s*(?:$config{package_name_re}\/)?
634 $config{package_version_re})*
638 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
640 @versions = split /\s*,\s*/,$2;
642 set_found(@common_control_options,
650 print {$transcript} "Failed to remove found on $ref: ".cleanup_eval_fail($@,$debug)."\n";
653 elsif (m{^(?:(?i)fixed)\s+\#?(-?\d+)
654 \s+((?:$config{package_name_re}\/)?
655 $config{package_version_re}
656 # allow for multiple packages
657 (?:\s*,\s*(?:$config{package_name_re}\/)?
658 $config{package_version_re})*)
662 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
664 @versions = split /\s*,\s*/,$2;
666 set_fixed(@common_control_options,
674 print {$transcript} "Failed to add fixed on $ref: ".cleanup_eval_fail($@,$debug)."\n";
677 elsif (m{^(?:(?i)notfixed)\s+\#?(-?\d+)
678 \s+((?:$config{package_name_re}\/)?
679 $config{package_version_re}
680 # allow for multiple packages
681 (?:\s*,\s*(?:$config{package_name_re}\/)?
682 $config{package_version_re})*)
686 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
688 @versions = split /\s*,\s*/,$2;
690 set_fixed(@common_control_options,
698 print {$transcript} "Failed to remove fixed on $ref: ".cleanup_eval_fail($@,$debug)."\n";
701 elsif (m/^submitter\s+\#?(-?\d+)\s+(\!|\S.*\S)$/i) {
704 $bug_affected{$ref}=1;
705 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
706 my $newsubmitter = $2 eq '!' ? $replyto : $2;
707 if (not Mail::RFC822::Address::valid($newsubmitter)) {
708 print {$transcript} "$newsubmitter is not a valid e-mail address; not changing submitter\n";
713 set_submitter(@common_control_options,
715 submitter => $newsubmitter,
720 print {$transcript} "Failed to set submitter on $ref: ".cleanup_eval_fail($@,$debug)."\n";
723 } elsif (m/^forwarded\s+\#?(-?\d+)\s+(\S.*\S)$/i) {
727 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
728 $bug_affected{$ref} = 1;
730 set_forwarded(@common_control_options,
732 forwarded => $forward_to,
737 print {$transcript} "Failed to set the forwarded-to-address of $ref: ".cleanup_eval_fail($@,$debug)."\n";
739 } elsif (m/^notforwarded\s+\#?(-?\d+)$/i) {
742 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
743 $bug_affected{$ref} = 1;
745 set_forwarded(@common_control_options,
752 print {$transcript} "Failed to clear the forwarded-to-address of $ref: ".cleanup_eval_fail($@,$debug)."\n";
754 } elsif (m/^(?:severity|priority)\s+\#?(-?\d+)\s+([-0-9a-z]+)$/i) {
757 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
758 $bug_affected{$ref}=1;
760 if (exists $gObsoleteSeverities{$newseverity}) {
761 print {$transcript} "Severity level \`$newseverity' is obsolete. " .
762 "Use $gObsoleteSeverities{$newseverity} instead.\n\n";
764 } elsif (not defined first {$_ eq $newseverity}
765 (@gSeverityList, "$gDefaultSeverity")) {
766 print {$transcript} "Severity level \`$newseverity' is not known.\n".
767 "Recognized are: $gShowSeverities.\n\n";
771 set_severity(@common_control_options,
773 severity => $newseverity,
778 print {$transcript} "Failed to set severity of $config{bug} $ref to $newseverity: ".cleanup_eval_fail($@,$debug)."\n";
781 } elsif (m/^tags?\s+\#?(-?\d+)\s+(\S.*)$/i) {
784 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
785 $bug_affected{$ref}=1;
787 my @tags = split /[\s,]+/, $tags;
788 # this is an array of hashrefs which contain two elements, the
789 # first of which is the array of tags, the second is the
790 # option to pass to set_tag (we use a hashref here to make it
791 # more obvious what is happening)
794 for my $tag (@tags) {
795 if ($tag =~ /^[=+-]$/) {
797 @tag_operations = {tags => [],
801 elsif ($tag eq '-') {
802 push @tag_operations,
804 option => [remove => 1],
807 elsif ($tag eq '+') {
808 push @tag_operations,
810 option => [add => 1],
815 if (not defined first {$_ eq $tag} @{$config{tags}}) {
819 if (not @tag_operations) {
820 @tag_operations = {tags => [],
821 option => [add => 1],
824 push @{$tag_operations[-1]{tags}},$tag;
827 print {$transcript} "Unknown tag/s: ".join(', ', @badtags).".\n".
828 "Recognized are: ".join(' ', @gTags).".\n\n";
832 for my $operation (@tag_operations) {
833 set_tag(@common_control_options,
835 tag => [@{$operation->{tags}}],
836 warn_on_bad_tags => 0, # don't warn on bad tags,
837 # 'cause we do that above
838 @{$operation->{option}},
843 # we intentionally have two errors here if there is a bad
844 # tag and the above fails for some reason
846 print {$transcript} "Failed to alter tags of $config{bug} $ref: ".cleanup_eval_fail($@,$debug)."\n";
848 } elsif (m/^(un)?block\s+\#?(-?\d+)\s+(?:by|with)\s+(\S.*)?$/i) {
851 my $add_remove = defined $1 && $1 eq 'un';
852 my @blockers = split /[\s,]+/, $3;
853 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
854 $bug_affected{$ref} = 1;
856 set_blocks(@common_control_options,
859 $add_remove ? (remove => 1):(add => 1),
864 print {$transcript} "Failed to set blocking bugs of $ref: ".cleanup_eval_fail($@,$debug)."\n";
866 } elsif (m/^retitle\s+\#?(-?\d+)\s+(\S.*\S)\s*$/i) {
868 $ref= $1; my $newtitle= $2;
869 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
870 $bug_affected{$ref} = 1;
872 set_title(@common_control_options,
879 print {$transcript} "Failed to set the title of $ref: ".cleanup_eval_fail($@,$debug)."\n";
881 } elsif (m/^unmerge\s+\#?(-?\d+)$/i) {
884 $bug_affected{$ref} = 1;
886 if (!length($data->{mergedwith})) {
887 print {$transcript} "$gBug is not marked as being merged with any others.\n\n";
890 $mergelowstate eq 'locked' || die "$mergelowstate ?";
891 $action= "Disconnected #$ref from all other report(s).";
892 my @newmergelist= split(/ /,$data->{mergedwith});
894 @bug_affected{@newmergelist} = 1 x @newmergelist;
896 $affected_packages{$data->{package}} = 1;
897 add_recipients(data => $data,
898 recipients => \%recipients,
899 transcript => $transcript,
900 ($dl > 0 ? (debug => $transcript):()),
902 $data->{mergedwith}= ($ref == $discref) ? ''
903 : join(' ',grep($_ ne $ref,@newmergelist));
904 } while (&getnextbug);
907 } elsif (m/^merge\s+#?(-?\d+(\s+#?-?\d+)+)\s*$/i) {
909 my @tomerge= sort { $a <=> $b } split(/\s+#?/,$1);
910 my @newmergelist= ();
915 while (defined($ref= shift(@tomerge))) {
916 print {$transcript} "D| checking merge $ref\n" if $dl;
918 if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
919 $ref = $clonebugs{$ref};
921 next if grep($_ == $ref,@newmergelist);
922 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
923 if (!&checkpkglimit) { &cancelbug; @newmergelist=(); last; }
925 print {$transcript} "D| adding $ref ($data->{mergedwith})\n" if $dl;
927 &checkmatch('package','m_package',$data->{package},@newmergelist);
928 &checkmatch('forwarded addr','m_forwarded',$data->{forwarded},@newmergelist);
929 $data->{severity} = '$gDefaultSeverity' if $data->{severity} eq '';
930 &checkmatch('severity','m_severity',$data->{severity},@newmergelist);
931 &checkmatch('blocks','m_blocks',$data->{blocks},@newmergelist);
932 &checkmatch('blocked-by','m_blockedby',$data->{blockedby},@newmergelist);
933 &checkmatch('done mark','m_done',length($data->{done}) ? 'done' : 'open',@newmergelist);
934 &checkmatch('owner','m_owner',$data->{owner},@newmergelist);
935 &checkmatch('summary','m_summary',$data->{summary},@newmergelist);
936 &checkmatch('affects','m_affects',$data->{affects},@newmergelist);
937 foreach my $t (split /\s+/, $data->{keywords}) { $tags{$t} = 1; }
938 foreach my $f (@{$data->{found_versions}}) { $found{$f} = 1; }
939 foreach my $f (@{$data->{fixed_versions}}) { $fixed{$f} = 1; }
940 if (length($mismatch)) {
941 print {$transcript} "Mismatch - only $gBugs in same state can be merged:\n".
944 &cancelbug; @newmergelist=(); last;
946 push(@newmergelist,$ref);
947 push(@tomerge,split(/ /,$data->{mergedwith}));
951 @newmergelist= sort { $a <=> $b } @newmergelist;
952 $action= "Merged @newmergelist.";
953 delete @fixed{keys %found};
954 for $ref (@newmergelist) {
955 &getbug || die "huh ? $gBug $ref disappeared during merge";
956 $affected_packages{$data->{package}} = 1;
957 add_recipients(data => $data,
958 recipients => \%recipients,
959 transcript => $transcript,
960 ($dl > 0 ? (debug => $transcript):()),
962 @bug_affected{@newmergelist} = 1 x @newmergelist;
963 $data->{mergedwith}= join(' ',grep($_ != $ref,@newmergelist));
964 $data->{keywords}= join(' ', keys %tags);
965 $data->{found_versions}= [sort keys %found];
966 $data->{fixed_versions}= [sort keys %fixed];
969 print {$transcript} "$action\n\n";
972 } elsif (m/^forcemerge\s+\#?(-?\d+(?:\s+\#?-?\d+)+)\s*$/i) {
974 my @temp = split /\s+\#?/,$1;
975 my $master_bug = shift @temp;
977 my @tomerge = sort { $a <=> $b } @temp;
978 unshift @tomerge,$master_bug;
979 print {$transcript} "D| force merging ".join(',',@tomerge)."\n" if $dl;
980 my @newmergelist= ();
984 # Here we try to do the right thing.
985 # First, if the bugs are in the same package, we merge all of the found, fixed, and tags.
986 # If not, we discard the found and fixed.
987 # Everything else we set to the values of the first bug.
989 while (defined($ref= shift(@tomerge))) {
990 print {$transcript} "D| checking merge $ref\n" if $dl;
992 if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
993 $ref = $clonebugs{$ref};
995 next if grep($_ == $ref,@newmergelist);
996 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
997 if (!&checkpkglimit) { &cancelbug; @newmergelist=(); last; }
999 print {$transcript} "D| adding $ref ($data->{mergedwith})\n" if $dl;
1000 $master_bug_data = $data if not defined $master_bug_data;
1001 if ($data->{package} ne $master_bug_data->{package}) {
1002 print {$transcript} "Mismatch - only $gBugs in the same package can be forcibly merged:\n".
1003 "$gBug $ref is not in the same package as $master_bug\n";
1005 &cancelbug; @newmergelist=(); last;
1007 for my $t (split /\s+/,$data->{keywords}) {
1010 @found{@{$data->{found_versions}}} = (1) x @{$data->{found_versions}};
1011 @fixed{@{$data->{fixed_versions}}} = (1) x @{$data->{fixed_versions}};
1012 push(@newmergelist,$ref);
1013 push(@tomerge,split(/ /,$data->{mergedwith}));
1016 if (@newmergelist) {
1017 @newmergelist= sort { $a <=> $b } @newmergelist;
1018 $action= "Forcibly Merged @newmergelist.";
1019 delete @fixed{keys %found};
1020 for $ref (@newmergelist) {
1021 &getbug || die "huh ? $gBug $ref disappeared during merge";
1022 $affected_packages{$data->{package}} = 1;
1023 add_recipients(data => $data,
1024 recipients => \%recipients,
1025 transcript => $transcript,
1026 ($dl > 0 ? (debug => $transcript):()),
1028 @bug_affected{@newmergelist} = 1 x @newmergelist;
1029 $data->{mergedwith}= join(' ',grep($_ != $ref,@newmergelist));
1030 $data->{keywords}= join(' ', keys %tags);
1031 $data->{found_versions}= [sort keys %found];
1032 $data->{fixed_versions}= [sort keys %fixed];
1033 my @field_list = qw(forwarded package severity blocks blockedby owner done affects summary);
1034 @{$data}{@field_list} = @{$master_bug_data}{@field_list};
1037 print {$transcript} "$action\n\n";
1040 } elsif (m/^clone\s+#?(\d+)\s+((-\d+\s+)*-\d+)\s*$/i) {
1044 my @newclonedids = split /\s+/, $2;
1045 my $newbugsneeded = scalar(@newclonedids);
1048 $bug_affected{$ref} = 1;
1050 $affected_packages{$data->{package}} = 1;
1051 if (length($data->{mergedwith})) {
1052 print {$transcript} "$gBug is marked as being merged with others. Use an existing clone.\n\n";
1056 &filelock("nextnumber.lock");
1057 open(N,"nextnumber") || die "nextnumber: read: $!";
1058 my $v=<N>; $v =~ s/\n$// || die "nextnumber bad format";
1059 my $firstref= $v+0; $v += $newbugsneeded;
1060 open(NN,">nextnumber"); print NN "$v\n"; close(NN);
1063 my $lastref = $firstref + $newbugsneeded - 1;
1065 if ($newbugsneeded == 1) {
1066 $action= "$gBug $origref cloned as bug $firstref.";
1068 $action= "$gBug $origref cloned as bugs $firstref-$lastref.";
1071 my $blocks = $data->{blocks};
1072 my $blockedby = $data->{blockedby};
1075 my $ohash = get_hashname($origref);
1076 my $clone = $firstref;
1077 @bug_affected{@newclonedids} = 1 x @newclonedids;
1078 for my $newclonedid (@newclonedids) {
1079 $clonebugs{$newclonedid} = $clone;
1081 my $hash = get_hashname($clone);
1082 copy("db-h/$ohash/$origref.log", "db-h/$hash/$clone.log");
1083 copy("db-h/$ohash/$origref.status", "db-h/$hash/$clone.status");
1084 copy("db-h/$ohash/$origref.summary", "db-h/$hash/$clone.summary");
1085 copy("db-h/$ohash/$origref.report", "db-h/$hash/$clone.report");
1086 &bughook('new', $clone, $data);
1088 # Update blocking info of bugs blocked by or blocking the
1090 foreach $ref (split ' ', $blocks) {
1092 $data->{blockedby} = manipset($data->{blockedby}, $clone, 1);
1095 foreach $ref (split ' ', $blockedby) {
1097 $data->{blocks} = manipset($data->{blocks}, $clone, 1);
1105 } elsif (m/^package\:?\s+(\S.*\S)?\s*$/i) {
1107 my @pkgs = split /\s+/, $1;
1108 if (scalar(@pkgs) > 0) {
1109 %limit_pkgs = map { ($_, 1) } @pkgs;
1110 $limit{package} = [@pkgs];
1111 print {$transcript} "Ignoring bugs not assigned to: " .
1112 join(" ", keys(%limit_pkgs)) . "\n\n";
1115 print {$transcript} "Not ignoring any bugs.\n\n";
1117 } elsif (m/^limit\:?\s+(\S.*\S)\s*$/) {
1119 my ($field,@options) = split /\s+/, $1;
1120 $field = lc($field);
1121 if ($field =~ /^(?:clear|unset|blank)$/) {
1123 print {$transcript} "Limit cleared.\n\n";
1125 elsif (exists $Debbugs::Status::fields{$field} ) {
1126 # %limit can actually contain regexes, but because they're
1127 # not evaluated in Safe, DO NOT allow them through without
1129 $limit{$field} = [@options];
1130 print {$transcript} "Limiting to bugs with field '$field' containing at least one of ".join(', ',map {qq('$_')} @options)."\n";
1131 print {$transcript} "Limit currently set to ";
1132 for my $limit_field (keys %limit) {
1133 print {$transcript} " '$limit_field':".join(', ',map {qq('$_')} @options)."\n";
1135 print {$transcript} "\n";
1138 print {$transcript} "Limit key $field not understood. Stopping processing here.\n\n";
1142 } elsif (m/^affects?\s+\#?(-?\d+)(?:\s+((?:[=+-])?)\s*(\S.*)?)?\s*$/i) {
1145 my $add_remove = $2 || '';
1146 my $packages = $3 || '';
1147 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1148 $bug_affected{$ref} = 1;
1150 affects(@common_control_options,
1152 packages => [splitpackages($3)],
1153 ($add_remove eq '+'?(add => 1):()),
1154 ($add_remove eq '-'?(remove => 1):()),
1159 print {$transcript} "Failed to mark $ref as affecting package(s): ".cleanup_eval_fail($@,$debug)."\n";
1162 } elsif (m/^summary\s+\#?(-?\d+)\s*(\d+|)\s*$/i) {
1165 my $summary_msg = length($2)?$2:undef;
1166 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1167 $bug_affected{$ref} = 1;
1169 summary(@common_control_options,
1171 summary => $summary_msg,
1176 print {$transcript} "Failed to give $ref a summary: ".cleanup_eval_fail($@,$debug)."\n";
1179 } elsif (m/^owner\s+\#?(-?\d+)\s+((?:\S.*\S)|\!)\s*$/i) {
1182 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1184 if ($newowner eq '!') {
1185 $newowner = $replyto;
1187 $bug_affected{$ref} = 1;
1189 owner(@common_control_options,
1196 print {$transcript} "Failed to mark $ref as having an owner: ".cleanup_eval_fail($@,$debug)."\n";
1198 } elsif (m/^noowner\s+\#?(-?\d+)\s*$/i) {
1201 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1202 $bug_affected{$ref} = 1;
1204 owner(@common_control_options,
1211 print {$transcript} "Failed to mark $ref as not having an owner: ".cleanup_eval_fail($@,$debug)."\n";
1213 } elsif (m/^unarchive\s+#?(\d+)$/i) {
1216 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1217 $bug_affected{$ref} = 1;
1219 bug_unarchive(@common_control_options,
1221 recipients => \%recipients,
1227 } elsif (m/^archive\s+#?(\d+)$/i) {
1230 $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
1231 $bug_affected{$ref} = 1;
1233 bug_archive(@common_control_options,
1236 archive_unarchived => 0,
1243 print {$transcript} "Unknown command or malformed arguments to command.\n\n";
1245 if (++$unknowns >= 5) {
1246 print {$transcript} "Too many unknown commands, stopping here.\n\n";
1251 if ($procline>$#bodylines) {
1252 print {$transcript} ">\nEnd of message, stopping processing here.\n\n";
1254 if (!$ok && !$quickabort) {
1256 print {$transcript} "No commands successfully parsed; sending the help text(s).\n";
1258 print {$transcript} "\n";
1261 my @maintccs = determine_recipients(recipients => \%recipients,
1265 my $maintccs = 'Cc: '.join(",\n ",
1266 determine_recipients(recipients => \%recipients,
1272 $packagepr = "X-${gProject}-PR-Package: " . join(keys %affected_packages) . "\n" if keys %affected_packages;
1274 # Add Bcc's to subscribed bugs
1275 # now handled by Debbugs::Recipients
1276 #push @bcc, map {"bugs=$_\@$gListDomain"} keys %bug_affected;
1278 if (!defined $header{'subject'} || $header{'subject'} eq "") {
1279 $header{'subject'} = "your mail";
1282 # Error text here advertises how many errors there were
1283 my $error_text = $errors > 0 ? " (with $errors errors)":'';
1286 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1288 ${maintccs}Subject: Processed${error_text}: $header{'subject'}
1289 In-Reply-To: $header{'message-id'}
1292 References: $header{'message-id'}
1293 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
1295 ${packagepr}X-$gProject-PR-Message: transcript
1297 ${transcript_scalar}Please contact me if you need assistance.
1300 (administrator, $gProject $gBugs database)
1303 my $repliedshow= join(', ',$replyto,
1304 determine_recipients(recipients => \%recipients,
1309 # -1 is the service.in log
1310 &filelock("lock/-1");
1311 open(AP,">>db-h/-1.log") || die "open db-h/-1.log: $!";
1313 "\2\n$repliedshow\n\5\n$reply\n\3\n".
1315 "<strong>Request received</strong> from <code>".
1316 html_escape($header{'from'})."</code>\n".
1317 "to <code>".html_escape($controlrequestaddr)."</code>\n".
1319 "\7\n",escape_log(@log),"\n\3\n") || die "writing db-h/-1.log: $!";
1320 close(AP) || die "open db-h/-1.log: $!";
1322 utime(time,time,"db-h");
1324 &sendmailmessage($reply,
1325 exists $header{'x-debbugs-no-ack'}?():$replyto,
1326 make_list(values %{{determine_recipients(recipients => \%recipients,
1332 unlink("incoming/P$nn") || die "unlinking incoming/P$nn: $!";
1334 sub sendmailmessage {
1335 my ($message,@recips) = @_;
1336 $message = "X-Loop: $gMaintainerEmail\n" . $message;
1337 send_mail_message(message => $message,
1338 recipients => \@recips,
1344 my ($template,$extra_var) = @_;
1346 my $variables = {config => \%config,
1347 defined($ref)?(ref => $ref):(),
1348 defined($data)?(data => $data):(),
1351 my $hole_var = {'&bugurl' =>
1353 'http://'.$config{cgi_domain}.'/'.
1354 Debbugs::CGI::bug_url($_[0]);
1357 return fill_in_template(template => $template,
1358 variables => $variables,
1359 hole_var => $hole_var,
1363 =head2 message_body_template
1365 message_body_template('mail/ack',{ref=>'foo'});
1367 Creates a message body using a template
1371 sub message_body_template{
1372 my ($template,$extra_var) = @_;
1374 my $body = fill_template($template,$extra_var);
1375 return fill_template('mail/message_body',
1384 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
1387 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
1391 #sub unimplemented {
1392 # print {$transcript} "Sorry, command $_[0] not yet implemented.\n\n";
1394 our %checkmatch_values;
1396 my ($string,$mvarname,$svarvalue,@newmergelist) = @_;
1398 if (@newmergelist) {
1399 $mvarvalue = $checkmatch_values{$mvarname};
1400 print {$transcript} "D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n"
1403 "Values for \`$string' don't match:\n".
1404 " #$newmergelist[0] has \`$mvarvalue';\n".
1405 " #$ref has \`$svarvalue'\n"
1406 if $mvarvalue ne $svarvalue;
1408 print {$transcript} "D| setupmatch \`$string' /$mvarname/$svarvalue/\n"
1410 $checkmatch_values{$mvarname} = $svarvalue;
1415 if (keys %limit_pkgs and not defined $limit_pkgs{$data->{package}}) {
1416 print {$transcript} "$gBug number $ref belongs to package $data->{package}, skipping.\n\n";
1428 my %h = map { $_ => 1 } split ' ', $list;
1435 return join ' ', sort keys %h;
1438 # High-level bug manipulation calls
1439 # Do announcements themselves
1441 # Possible calling sequences:
1442 # setbug (returns 0)
1444 # setbug (returns 1)
1445 # &transcript(something)
1448 # setbug (returns 1)
1449 # $action= (something)
1451 # (modify s_* variables)
1452 # } while (getnextbug);
1457 &dlen("nochangebug");
1458 $state eq 'single' || $state eq 'multiple' || die "$state ?";
1460 &endmerge if $manybugs;
1462 &dlex("nochangebug");
1466 our @thisbugmergelist;
1469 &dlen("setbug $ref");
1470 if ($ref =~ m/^-\d+/) {
1471 if (!defined $clonebugs{$ref}) {
1473 &dlex("setbug => noclone");
1476 $ref = $clonebugs{$ref};
1478 $state eq 'idle' || die "$state ?";
1481 &dlex("setbug => 0s");
1485 if (!&checkpkglimit) {
1490 @thisbugmergelist= split(/ /,$data->{mergedwith});
1491 if (!@thisbugmergelist) {
1496 &dlex("setbug => 1s");
1505 &dlex("setbug => 0mc");
1509 $state= 'multiple'; $sref=$ref;
1510 &dlex("setbug => 1m");
1515 &dlen("getnextbug");
1516 $state eq 'single' || $state eq 'multiple' || die "$state ?";
1518 if (!$manybugs || !@thisbugmergelist) {
1519 length($action) || die;
1520 print {$transcript} "$action\n$extramessage\n";
1521 &endmerge if $manybugs;
1523 &dlex("getnextbug => 0");
1526 $ref= shift(@thisbugmergelist);
1527 &getbug || die "bug $ref disappeared";
1529 &dlex("getnextbug => 1");
1533 # Low-level bug-manipulation calls
1534 # Do no announcements
1536 # getbug (returns 0)
1538 # getbug (returns 1)
1542 # $action= (something)
1543 # getbug (returns 1)
1545 # getbug (returns 1)
1547 # [getbug (returns 0)]
1548 # &transcript("$action\n\n")
1551 sub notfoundbug { print {$transcript} "$gBug number $ref not found. (Is it archived?)\n\n"; }
1552 sub foundbug { print {$transcript} "$gBug#$ref: $data->{subject}\n"; }
1556 $mergelowstate eq 'idle' || die "$mergelowstate ?";
1557 &filelock('lock/merge');
1558 $mergelowstate='locked';
1564 $mergelowstate eq 'locked' || die "$mergelowstate ?";
1566 $mergelowstate='idle';
1571 &dlen("getbug $ref");
1572 $lowstate eq 'idle' || die "$state ?";
1573 # Only use unmerged bugs here
1574 if (($data = &lockreadbug($ref,'db-h'))) {
1577 &dlex("getbug => 1");
1582 &dlex("getbug => 0");
1588 $lowstate eq 'open' || die "$state ?";
1595 &dlen("savebug $ref");
1596 $lowstate eq 'open' || die "$lowstate ?";
1597 length($action) || die;
1598 $ref == $sref || die "read $sref but saving $ref ?";
1599 append_action_to_log(bug => $ref,
1601 requester => $header{from},
1602 request_addr => $controlrequestaddr,
1606 unlockwritebug($ref, $data);
1613 print {$transcript} "C> @_ ($state $lowstate $mergelowstate)\n";
1618 print {$transcript} "R> @_ ($state $lowstate $mergelowstate)\n";
1625 my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot');
1626 $url =~ s/([<>&"])/\&$saniarray{$1};/g;
1632 print {$transcript} "\n";
1638 print {$transcript} "\n";
1644 sub sendtxthelpraw {
1645 my ($relpath,$description) = @_;
1647 if (not -e "$gDocDir/$relpath") {
1648 print {$transcript} "Unfortunatly, the help text doesn't exist, so it wasn't sent.\n";
1649 warn "Help text $gDocDir/$relpath not found";
1652 open(D,"$gDocDir/$relpath") || die "open doc file $relpath: $!";
1653 while(<D>) { $doc.=$_; }
1655 print {$transcript} "Sending $description in separate message.\n";
1656 &sendmailmessage(<<END.$doc,$replyto);
1657 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1659 Subject: $gProject $gBug help: $description
1660 References: $header{'message-id'}
1661 In-Reply-To: $header{'message-id'}
1662 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
1664 X-$gProject-PR-Message: doc-text $relpath
1670 sub sendlynxdocraw {
1671 my ($relpath,$description) = @_;
1673 open(L,"lynx -nolist -dump http://$gCGIDomain/\Q$relpath\E 2>&1 |") || die "fork for lynx: $!";
1674 while(<L>) { $doc.=$_; }
1676 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
1677 print {$transcript} "Information ($description) is not available -\n".
1678 "perhaps the $gBug does not exist or is not on the WWW yet.\n";
1681 print {$transcript} "Error getting $description (code $? $!):\n$doc\n";
1683 print {$transcript} "Sending $description.\n";
1684 &sendmailmessage(<<END.$doc,$replyto);
1685 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1687 Subject: $gProject $gBugs information: $description
1688 References: $header{'message-id'}
1689 In-Reply-To: $header{'message-id'}
1690 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
1692 X-$gProject-PR-Message: doc-html $relpath
1701 my ($wherefrom,$path,$description) = @_;
1702 if ($wherefrom eq "ftp.d.o") {
1703 $doc = `lynx -nolist -dump http://ftp.debian.org/debian/indices/$path.gz 2>&1 | gunzip -cf` or die "fork for lynx/gunzip: $!";
1705 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
1706 print {$transcript} "$description is not available.\n";
1709 print {$transcript} "Error getting $description (code $? $!):\n$doc\n";
1712 } elsif ($wherefrom eq "local") {
1714 $doc = do { local $/; <P> };
1717 print {$transcript} "internal errror: info files location unknown.\n";
1720 print {$transcript} "Sending $description.\n";
1721 &sendmailmessage(<<END.$doc,$replyto);
1722 From: $gMaintainerEmail ($gProject $gBug Tracking System)
1724 Subject: $gProject $gBugs information: $description
1725 References: $header{'message-id'}
1726 In-Reply-To: $header{'message-id'}
1727 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
1729 X-$gProject-PR-Message: getinfo
1731 $description follows:
1735 print {$transcript} "\n";