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
10 use POSIX qw(strftime locale_h);
11 setlocale(LC_TIME, "C");
13 use Debbugs::Config qw(:globals :config);
18 use Params::Validate qw(:types validate_with);
20 use Debbugs::Common qw(:util :quit :misc :lock);
22 use Debbugs::Status qw(:read :status :write :versions :hook);
23 use Debbugs::Packages qw(binary_to_source);
25 use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522 create_mime_message);
26 use Debbugs::Mail qw(send_mail_message);
28 use Debbugs::Recipients qw(:all);
29 use HTML::Entities qw(encode_entities);
30 use Debbugs::Versions::Dpkg;
32 use Debbugs::Status qw(splitpackages);
34 use Debbugs::CGI qw(html_escape);
35 use Debbugs::Control qw(:all);
36 use Debbugs::Control::Service qw(:all);
37 use Debbugs::Log qw(:misc);
38 use Debbugs::Text qw(:templates);
40 use Scalar::Util qw(looks_like_number);
42 use List::AllUtils qw(first uniqnum);
44 use Mail::RFC822::Address;
45 use Encode qw(decode encode);
47 chdir($config{spool_dir}) or
48 die "Unable to chdir to spool_dir '$config{spool_dir}': $!";
53 my ($nn,$control) = $ARGV[0] =~ m/^(([RC])\.\d+)$/;
54 if (not defined $control or not defined $nn) {
55 die "Bad argument to service.in";
57 if (!rename("incoming/G$nn","incoming/P$nn")) {
58 defined $! and $! =~ m/no such file or directory/i and exit 0;
59 die "Failed to rename incoming/G$nn to incoming/P$nn: $!";
62 my $log_fh = IO::File->new("incoming/P$nn",'r') or
63 die "Unable to open incoming/P$nn for reading: $!";
70 print "###\n",join("##\n",@msg),"\n###\n" if $debug;
72 # Bug numbers to send e-mail to, hash so that we don't send to the
76 my (@headerlines,@bodylines);
78 my $parse_output = Debbugs::MIME::parse(join('',@log));
79 @headerlines = @{$parse_output->{header}};
80 @bodylines = @{$parse_output->{body}};
84 $_ = decode_rfc1522($_);
86 print ">$_<\n" if $debug;
89 print ">$v=$_<\n" if $debug;
92 print "!>$_<\n" if $debug;
95 $header{'message-id'} ||= '';
96 $header{subject} ||= '';
98 grep(s/\s+$//,@bodylines);
100 print "***\n",join("\n",@bodylines),"\n***\n" if $debug;
102 if (defined $header{'resent-from'} && !defined $header{'from'}) {
103 $header{'from'} = $header{'resent-from'};
106 defined($header{'from'}) || die "no From header";
108 delete $header{'reply-to'}
109 if ( defined($header{'reply-to'}) && $header{'reply-to'} =~ m/^\s*$/ );
112 if ( defined($header{'reply-to'}) && $header{'reply-to'} ne "" ) {
113 $replyto = $header{'reply-to'};
115 $replyto = $header{'from'};
118 # This is an error counter which should be incremented every time there is an error.
120 my $controlrequestaddr= ($control ? 'control' : 'request').'@'.$config{email_domain};
121 my $transcript_scalar = '';
122 open my $transcript, ">:scalar:utf8", \$transcript_scalar or
123 die "Unable to create transcript scalar: $!";
124 print {$transcript} "Processing commands for $controlrequestaddr:\n\n";
128 my %affected_packages;
130 # this is the hashref which is passed to all control calls
134 my @common_control_options =
135 (transcript => $transcript,
136 requester => $header{from},
137 request_addr => $controlrequestaddr,
138 request_msgid => $header{'message-id'},
139 request_subject => $header{subject},
141 request_replyto => $replyto,
143 affected_bugs => \%bug_affected,
144 affected_packages => \%affected_packages,
145 recipients => \%recipients,
150 my $lowstate= 'idle';
151 my $mergelowstate= 'idle';
156 $user =~ s/^.*<(.*)>.*$/$1/;
157 $user =~ s/[(].*[)]//;
158 $user =~ s/^\s*(\S+)\s+.*$/$1/;
159 $user = "" unless (Debbugs::User::is_valid_user($user));
160 my $indicated_user = 0;
165 if (@gExcludeFromControl and grep {$replyto =~ m/\Q$_\E/} @gExcludeFromControl) {
166 print {$transcript} fill_template('mail/excluded_from_control');
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
205 my $temp = decode("utf8",$_,Encode::FB_CROAK);
208 print {$transcript} "> $_\n";
211 if (m/^(?:stop|quit|--|thank(?:s|\s*you)?|kthxbye)\.*\s*$/i) {
212 print {$transcript} "Stopping processing here.\n\n";
214 } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000) {
216 if ($dl > 0 and not grep /debug/,@common_control_options) {
217 push @common_control_options,(debug => $transcript);
219 print {$transcript} "Debug level $dl.\n\n";
220 } elsif (m/^(send|get)\s+\#?(\d{2,})$/i) {
222 &sendlynxdoc("bugreport.cgi?bug=$ref","logs for $gBug#$ref");
223 } elsif (m/^send-detail\s+\#?(\d{2,})$/i) {
225 &sendlynxdoc("bugreport.cgi?bug=$ref&boring=yes",
226 "detailed logs for $gBug#$ref");
227 } elsif (m/^index(\s+full)?$/i) {
228 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
230 $ok++; # well, it's not really ok, but it fixes #81224 :)
231 } elsif (m/^index-summary\s+by-package$/i) {
232 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
234 $ok++; # well, it's not really ok, but it fixes #81224 :)
235 } elsif (m/^index-summary(\s+by-number)?$/i) {
236 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
238 $ok++; # well, it's not really ok, but it fixes #81224 :)
239 } elsif (m/^index(\s+|-)pack(age)?s?$/i) {
240 &sendlynxdoc("pkgindex.cgi?indexon=pkg",'index of packages');
241 } elsif (m/^index(\s+|-)maints?$/i) {
242 &sendlynxdoc("pkgindex.cgi?indexon=maint",'index of maintainers');
243 } elsif (m/^index(\s+|-)maint\s+(\S+)$/i) {
245 &sendlynxdoc("pkgreport.cgi?maint=" . urlsanit($maint),
246 "$gBug list for maintainer \`$maint'");
248 } elsif (m/^index(\s+|-)pack(age)?s?\s+(\S.*\S)$/i) {
250 &sendlynxdoc("pkgreport.cgi?pkg=" . urlsanit($package),
251 "$gBug list for package $package");
253 } elsif (m/^send-unmatched(\s+this|\s+-?0)?$/i) {
254 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
256 $ok++; # well, it's not really ok, but it fixes #81224 :)
257 } elsif (m/^send-unmatched\s+(last|-1)$/i) {
258 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
260 $ok++; # well, it's not really ok, but it fixes #81224 :)
261 } elsif (m/^send-unmatched\s+(old|-2)$/i) {
262 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
264 $ok++; # well, it's not really ok, but it fixes #81224 :)
265 } elsif (m/^getinfo\s+([\w.-]+)$/i) {
266 # the following is basically a Debian-specific kludge, but who cares
268 if ($req =~ /^maintainers$/i && -f "$gConfigDir/Maintainers") {
269 &sendinfo("local", "$gConfigDir/Maintainers", "Maintainers file");
270 } elsif ($req =~ /^override\.(\w+)\.([\w.-]+)$/i) {
272 &sendinfo("ftp.d.o", "$req", "override file for $2 part of $1 distribution");
273 } elsif ($req =~ /^pseudo-packages\.(description|maintainers)$/i && -f "$gConfigDir/$req") {
274 &sendinfo("local", "$gConfigDir/$req", "$req file");
276 print {$transcript} "Info file $req does not exist.\n\n";
278 } elsif (m/^help/i) {
280 print {$transcript} "\n";
282 } elsif (m/^refcard/i) {
283 &sendtxthelp("bug-mailserver-refcard.txt","mail servers' reference card");
284 } elsif (m/^subscribe/i) {
285 print {$transcript} <<END;
286 There is no $gProject $gBug mailing list. If you wish to review bug reports
287 please do so via $gWebDomain or ask this mail server
289 soon: MAILINGLISTS_TEXT
291 } elsif (m/^unsubscribe/i) {
292 print {$transcript} <<END;
293 soon: UNSUBSCRIBE_TEXT
294 soon: MAILINGLISTS_TEXT
296 } elsif (m/^user\s+(\S+)\s*$/i) {
298 if (Debbugs::User::is_valid_user($newuser)) {
299 my $olduser = ($user ne "" ? " (was $user)" : "");
300 print {$transcript} "Setting user to $newuser$olduser.\n";
304 print {$transcript} "Selected user id ($newuser) invalid, sorry\n";
309 } elsif (m/^usercategory\s+(\S+)(\s+\[hidden\])?\s*$/i) {
312 my $hidden = (defined $2 and $2 ne "");
319 print {$transcript} "No valid user selected\n";
323 if (not $indicated_user and defined $user) {
324 print {$transcript} "User is $user\n";
328 while (++$procline <= $#bodylines) {
329 unless ($bodylines[$procline] =~ m/^\s*([*+])\s*(\S.*)$/) {
333 print {$transcript} "> $bodylines[$procline]\n";
335 my ($o, $txt) = ($1, $2);
336 if ($#cats == -1 && $o eq "+") {
337 print {$transcript} "User defined category specification must start with a category name. Skipping.\n\n";
343 unless (ref($cats[-1]) eq "HASH") {
344 $cats[-1] = { "nam" => $cats[-1],
345 "pri" => [], "ttl" => [] };
348 my ($desc, $ord, $op);
349 if ($txt =~ m/^(.*\S)\s*\[((\d+):\s*)?\]\s*$/) {
350 $desc = $1; $ord = $3; $op = "";
351 } elsif ($txt =~ m/^(.*\S)\s*\[((\d+):\s*)?(\S+)\]\s*$/) {
352 $desc = $1; $ord = $3; $op = $4;
353 } elsif ($txt =~ m/^([^[\s]+)\s*$/) {
354 $desc = ""; $op = $1;
356 print {$transcript} "Unrecognised syntax for category section. Skipping.\n\n";
361 $ord = 999 unless defined $ord;
364 push @{$cats[-1]->{"pri"}}, $prefix . $op;
365 push @{$cats[-1]->{"ttl"}}, $desc;
366 push @ords, "$ord $catsec";
368 $cats[-1]->{"def"} = $desc;
369 push @ords, "$ord DEF";
373 my ($a1, $a2, $b1, $b2) = split / /, "$a $b";
374 ((looks_like_number($a1) and looks_like_number($a2))?$a1 <=> $b1:$a1 cmp $b1) ||
375 ((looks_like_number($a2) and looks_like_number($b2))?$a2 <=> $b2:$a2 cmp $b2);
377 $cats[-1]->{"ord"} = [map { m/^.* (\S+)/; $1 eq "DEF" ? $catsec + 1 : $1 } @ords];
378 } elsif ($o eq "*") {
381 if ($txt =~ m/^(.*\S)(\s*\[(\S+)\])\s*$/) {
382 $name = $1; $prefix = $3;
384 $name = $txt; $prefix = "";
389 # XXX: got @cats, now do something with it
390 my $u = Debbugs::User::get_user($user);
392 print {$transcript} "Added usercategory $catname.\n\n";
393 $u->{"categories"}->{$catname} = [ @cats ];
395 push @{$u->{visible_cats}},$catname;
398 print {$transcript} "Removed usercategory $catname.\n\n";
399 delete $u->{"categories"}->{$catname};
400 @{$u->{visible_cats}} = grep {$_ ne $catname} @{$u->{visible_cats}};
403 } elsif (m/^usertags?\s+\#?(-?\d+)\s+(([=+-])\s*)?(\S.*)?$/i) {
406 my $addsubcode = $3 || "+";
408 if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
409 $ref = $clonebugs{$ref};
412 print {$transcript} "No valid user selected\n";
415 } elsif (check_limit(data => read_bug(bug => $ref),
417 transcript => $transcript)) {
418 if (not $indicated_user and defined $user) {
419 print {$transcript} "User is $user\n";
423 Debbugs::User::read_usertags(\%ut, $user);
424 my @oldtags = (); my @newtags = (); my @badtags = ();
426 if (defined $tags and length $tags) {
427 for my $t (split /[,\s]+/, $tags) {
428 if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
436 print {$transcript} "Ignoring illegal tag/s: ".join(', ', @badtags).".\nPlease use only alphanumerics, at, dot, plus and dash.\n";
439 for my $t (keys %chtags) {
440 $ut{$t} = [] unless defined $ut{$t};
442 for my $t (keys %ut) {
443 my %res = map { ($_, 1) } @{$ut{$t}};
444 push @oldtags, $t if defined $res{$ref};
445 my $addop = ($addsubcode eq "+" or $addsubcode eq "=");
446 my $del = (defined $chtags{$t} ? $addsubcode eq "-"
447 : $addsubcode eq "=");
448 $res{$ref} = 1 if ($addop && defined $chtags{$t});
449 delete $res{$ref} if ($del);
450 push @newtags, $t if defined $res{$ref};
451 $ut{$t} = [ sort { $a <=> $b } (keys %res) ];
454 print {$transcript} "There were no usertags set.\n";
456 print {$transcript} "Usertags were: " . join(" ", @oldtags) . ".\n";
458 print {$transcript} "Usertags are now: " . join(" ", @newtags) . ".\n";
459 Debbugs::User::write_usertags(\%ut, $user);
461 } elsif (!$control) {
462 print {$transcript} <<END;
463 Unknown command or malformed arguments to command.
464 (Use control\@$gEmailDomain to manipulate reports.)
467 #### "developer only" ones start here
468 } elsif (defined valid_control($_)) {
469 my ($new_errors,$terminate_control) =
470 control_line(line => $_,
471 clonebugs => \%clonebugs,
473 common_control_options => \@common_control_options,
475 transcript => $transcript,
480 if ($terminate_control) {
484 print {$transcript} "Unknown command or malformed arguments to command.\n";
486 if (++$unknowns >= 5) {
487 print {$transcript} "Too many unknown commands, stopping here.\n\n";
492 if ($procline>$#bodylines) {
493 print {$transcript} ">\nEnd of message, stopping processing here.\n\n";
495 if (!$ok && !$quickabort) {
497 print {$transcript} "No commands successfully parsed; sending the help text(s).\n";
499 print {$transcript} "\n";
502 my @maintccs = determine_recipients(recipients => \%recipients,
506 if (!defined $header{'subject'} || $header{'subject'} eq "") {
507 $header{'subject'} = "your mail";
510 # Error text here advertises how many errors there were
511 my $error_text = $errors > 0 ? " (with $errors error" . ($errors > 1 ? "s" : "") . ")" : "";
514 push @common_headers, 'X-Loop',$gMaintainerEmail;
516 my $temp_transcript = $transcript_scalar;
518 $temp_transcript = decode("utf8",$temp_transcript,Encode::FB_CROAK);
521 create_mime_message([From => qq("$gProject $gBug Tracking System" <$gMaintainerEmail>),
523 @maintccs ? (Cc => join(', ',@maintccs)):(),
524 Subject => "Processed${error_text}: $header{subject}",
525 'Message-ID' => "<handler.s.$nn.transcript\@$gEmailDomain>",
526 'In-Reply-To' => $header{'message-id'},
527 References => join(' ',grep {defined $_} $header{'message-id'},$data->{msgid}),
528 Precedence => 'bulk',
529 keys %affected_packages ?("X-${gProject}-PR-Package" => join(' ',keys %affected_packages)):(),
530 keys %affected_packages ?("X-${gProject}-PR-Source" =>
532 map {defined $_ ?(ref($_)?@{$_}:$_):()}
533 binary_to_source(binary => [keys %affected_packages],
534 source_only => 1))):(),
535 "X-$gProject-PR-Message" => 'transcript',
538 fill_template('mail/message_body',
539 {body => "${temp_transcript}Please contact me if you need assistance."},
542 my $repliedshow= join(', ',$replyto,
543 determine_recipients(recipients => \%recipients,
549 utime(time,time,"db-h");
551 &sendmailmessage($reply,
552 exists $header{'x-debbugs-no-ack'}?():$replyto,
553 make_list(values %{{determine_recipients(recipients => \%recipients,
559 unlink("incoming/P$nn") || die "unlinking incoming/P$nn: $!";
561 sub sendmailmessage {
562 my ($message,@recips) = @_;
563 $message = "X-Loop: $gMaintainerEmail\n" . $message;
564 send_mail_message(message => $message,
565 recipients => \@recips,
571 my ($template,$extra_var) = @_;
573 my $variables = {config => \%config,
574 defined($ref)?(ref => $ref):(),
575 defined($data)?(data => $data):(),
577 uniqnum(defined($ref)?($ref):(),
578 map {exists $clonebugs{$_}?$clonebugs{$_}:$_}
579 keys %bug_affected)],
582 return fill_in_template(template => $template,
583 variables => $variables,
584 output_type => 'text',
588 =head2 message_body_template
590 message_body_template('mail/ack',{ref=>'foo'});
592 Creates a message body using a template
596 sub message_body_template{
597 my ($template,$extra_var) = @_;
599 my $body = fill_template($template,$extra_var);
600 return fill_template('mail/message_body',
609 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
612 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
617 # print {$transcript} "Sorry, command $_[0] not yet implemented.\n\n";
619 our %checkmatch_values;
621 my ($string,$mvarname,$svarvalue,@newmergelist) = @_;
624 $mvarvalue = $checkmatch_values{$mvarname};
625 print {$transcript} "D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n"
628 "Values for \`$string' don't match:\n".
629 " #$newmergelist[0] has \`$mvarvalue';\n".
630 " #$ref has \`$svarvalue'\n"
631 if $mvarvalue ne $svarvalue;
633 print {$transcript} "D| setupmatch \`$string' /$mvarname/$svarvalue/\n"
635 $checkmatch_values{$mvarname} = $svarvalue;
640 if (keys %limit_pkgs and not defined $limit_pkgs{$data->{package}}) {
641 print {$transcript} "$gBug number $ref belongs to package $data->{package}, skipping.\n\n";
653 my %h = map { $_ => 1 } split ' ', $list;
660 return join ' ', sort keys %h;
663 # High-level bug manipulation calls
664 # Do announcements themselves
666 # Possible calling sequences:
670 # &transcript(something)
674 # $action= (something)
676 # (modify s_* variables)
677 # } while (getnextbug);
682 &dlen("nochangebug");
683 $state eq 'single' || $state eq 'multiple' || die "$state ?";
685 &endmerge if $manybugs;
687 &dlex("nochangebug");
691 our @thisbugmergelist;
694 &dlen("setbug $ref");
695 if ($ref =~ m/^-\d+/) {
696 if (!defined $clonebugs{$ref}) {
698 &dlex("setbug => noclone");
701 $ref = $clonebugs{$ref};
703 $state eq 'idle' || die "$state ?";
706 &dlex("setbug => 0s");
710 if (!&checkpkglimit) {
715 @thisbugmergelist= split(/ /,$data->{mergedwith});
716 if (!@thisbugmergelist) {
721 &dlex("setbug => 1s");
730 &dlex("setbug => 0mc");
734 $state= 'multiple'; $sref=$ref;
735 &dlex("setbug => 1m");
741 $state eq 'single' || $state eq 'multiple' || die "$state ?";
743 if (!$manybugs || !@thisbugmergelist) {
744 length($action) || die;
745 print {$transcript} "$action\n$extramessage\n";
746 &endmerge if $manybugs;
748 &dlex("getnextbug => 0");
751 $ref= shift(@thisbugmergelist);
752 &getbug || die "bug $ref disappeared";
754 &dlex("getnextbug => 1");
758 # Low-level bug-manipulation calls
759 # Do no announcements
767 # $action= (something)
772 # [getbug (returns 0)]
773 # &transcript("$action\n\n")
776 sub notfoundbug { print {$transcript} "$gBug number $ref not found. (Is it archived?)\n\n"; }
777 sub foundbug { print {$transcript} "$gBug#$ref: $data->{subject}\n"; }
781 $mergelowstate eq 'idle' || die "$mergelowstate ?";
782 &filelock('lock/merge');
783 $mergelowstate='locked';
789 $mergelowstate eq 'locked' || die "$mergelowstate ?";
791 $mergelowstate='idle';
796 &dlen("getbug $ref");
797 $lowstate eq 'idle' || die "$state ?";
798 # Only use unmerged bugs here
799 if (($data = &lockreadbug($ref,'db-h'))) {
802 &dlex("getbug => 1");
807 &dlex("getbug => 0");
813 $lowstate eq 'open' || die "$state ?";
820 &dlen("savebug $ref");
821 $lowstate eq 'open' || die "$lowstate ?";
822 length($action) || die;
823 $ref == $sref || die "read $sref but saving $ref ?";
824 append_action_to_log(bug => $ref,
826 requester => $header{from},
827 request_addr => $controlrequestaddr,
831 unlockwritebug($ref, $data);
838 print {$transcript} "C> @_ ($state $lowstate $mergelowstate)\n";
843 print {$transcript} "R> @_ ($state $lowstate $mergelowstate)\n";
850 my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot');
851 $url =~ s/([<>&"])/\&$saniarray{$1};/g;
857 print {$transcript} "\n";
863 print {$transcript} "\n";
870 my ($relpath,$description) = @_;
872 if (not -e "$gDocDir/$relpath") {
873 print {$transcript} "Unfortunatly, the help text doesn't exist, so it wasn't sent.\n";
874 warn "Help text $gDocDir/$relpath not found";
877 open(D,"$gDocDir/$relpath") || die "open doc file $relpath: $!";
878 while(<D>) { $doc.=$_; }
880 print {$transcript} "Sending $description in separate message.\n";
881 &sendmailmessage(<<END.$doc,$replyto);
882 From: "$gProject $gBug Tracking System" <$gMaintainerEmail>
884 Subject: $gProject $gBug help: $description
885 References: $header{'message-id'}
886 In-Reply-To: $header{'message-id'}
887 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
889 X-$gProject-PR-Message: doc-text $relpath
896 my ($relpath,$description) = @_;
898 open(L,"lynx -nolist -dump $gCGIDomain/\Q$relpath\E 2>&1 |") || die "fork for lynx: $!";
899 while(<L>) { $doc.=$_; }
901 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
902 print {$transcript} "Information ($description) is not available -\n".
903 "perhaps the $gBug does not exist or is not on the WWW yet.\n";
906 print {$transcript} "Error getting $description (code $? $!):\n$doc\n";
908 print {$transcript} "Sending $description.\n";
909 &sendmailmessage(<<END.$doc,$replyto);
910 From: "$gProject $gBug Tracking System" <$gMaintainerEmail>
912 Subject: $gProject $gBugs information: $description
913 References: $header{'message-id'}
914 In-Reply-To: $header{'message-id'}
915 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
917 X-$gProject-PR-Message: doc-html $relpath
926 my ($wherefrom,$path,$description) = @_;
927 if ($wherefrom eq "ftp.d.o") {
928 $doc = `lynx -nolist -dump http://ftp.debian.org/debian/indices/$path.gz 2>&1 | gunzip -cf` or die "fork for lynx/gunzip: $!";
930 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
931 print {$transcript} "$description is not available.\n";
934 print {$transcript} "Error getting $description (code $? $!):\n$doc\n";
937 } elsif ($wherefrom eq "local") {
939 $doc = do { local $/; <P> };
942 print {$transcript} "internal errror: info files location unknown.\n";
945 print {$transcript} "Sending $description.\n";
946 &sendmailmessage(<<END.$doc,$replyto);
947 From: "$gProject $gBug Tracking System" <$gMaintainerEmail>
949 Subject: $gProject $gBugs information: $description
950 References: $header{'message-id'}
951 In-Reply-To: $header{'message-id'}
952 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
954 X-$gProject-PR-Message: getinfo
956 $description follows:
960 print {$transcript} "\n";