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 POSIX qw(strftime locale_h);
12 setlocale(LC_TIME, "C");
14 use Debbugs::Config qw(:globals :config);
19 use Params::Validate qw(:types validate_with);
21 use Debbugs::Common qw(:util :quit :misc :lock);
23 use Debbugs::Status qw(:read :status :write :versions :hook);
24 use Debbugs::Packages qw(binary_to_source);
26 use Debbugs::MIME qw(decode_rfc1522 encode_rfc1522 create_mime_message);
27 use Debbugs::Mail qw(send_mail_message);
29 use Debbugs::Recipients qw(:all);
30 use HTML::Entities qw(encode_entities);
31 use Debbugs::Versions::Dpkg;
33 use Debbugs::Status qw(splitpackages);
35 use Debbugs::CGI qw(html_escape);
36 use Debbugs::Control qw(:all);
37 use Debbugs::Control::Service qw(:all);
38 use Debbugs::Log qw(:misc);
39 use Debbugs::Text qw(:templates);
41 use Scalar::Util qw(looks_like_number);
43 use List::AllUtils qw(first);
45 use Mail::RFC822::Address;
46 use Encode qw(decode encode);
48 chdir($config{spool_dir}) or
49 die "Unable to chdir to spool_dir '$config{spool_dir}': $!";
54 my ($nn,$control) = $ARGV[0] =~ m/^(([RC])\.\d+)$/;
55 if (not defined $control or not defined $nn) {
56 die "Bad argument to service.in";
58 if (!rename("incoming/G$nn","incoming/P$nn")) {
59 defined $! and $! =~ m/no such file or directory/i and exit 0;
60 die "Failed to rename incoming/G$nn to incoming/P$nn: $!";
63 my $log_fh = IO::File->new("incoming/P$nn",'r') or
64 die "Unable to open incoming/P$nn for reading: $!";
71 print "###\n",join("##\n",@msg),"\n###\n" if $debug;
73 # Bug numbers to send e-mail to, hash so that we don't send to the
77 my (@headerlines,@bodylines);
79 my $parse_output = Debbugs::MIME::parse(join('',@log));
80 @headerlines = @{$parse_output->{header}};
81 @bodylines = @{$parse_output->{body}};
85 $_ = decode_rfc1522($_);
87 print ">$_<\n" if $debug;
90 print ">$v=$_<\n" if $debug;
93 print "!>$_<\n" if $debug;
96 $header{'message-id'} ||= '';
97 $header{subject} ||= '';
99 grep(s/\s+$//,@bodylines);
101 print "***\n",join("\n",@bodylines),"\n***\n" if $debug;
103 if (defined $header{'resent-from'} && !defined $header{'from'}) {
104 $header{'from'} = $header{'resent-from'};
107 defined($header{'from'}) || die "no From header";
109 delete $header{'reply-to'}
110 if ( defined($header{'reply-to'}) && $header{'reply-to'} =~ m/^\s*$/ );
113 if ( defined($header{'reply-to'}) && $header{'reply-to'} ne "" ) {
114 $replyto = $header{'reply-to'};
116 $replyto = $header{'from'};
119 # This is an error counter which should be incremented every time there is an error.
121 my $controlrequestaddr= ($control ? 'control' : 'request').'@'.$config{email_domain};
122 my $transcript_scalar = '';
123 open my $transcript, ">:scalar:utf8", \$transcript_scalar or
124 die "Unable to create transcript scalar: $!";
125 print {$transcript} "Processing commands for $controlrequestaddr:\n\n";
129 my %affected_packages;
131 # this is the hashref which is passed to all control calls
135 my @common_control_options =
136 (transcript => $transcript,
137 requester => $header{from},
138 request_addr => $controlrequestaddr,
139 request_msgid => $header{'message-id'},
140 request_subject => $header{subject},
142 request_replyto => $replyto,
144 affected_bugs => \%bug_affected,
145 affected_packages => \%affected_packages,
146 recipients => \%recipients,
151 my $lowstate= 'idle';
152 my $mergelowstate= 'idle';
157 $user =~ s/^.*<(.*)>.*$/$1/;
158 $user =~ s/[(].*[)]//;
159 $user =~ s/^\s*(\S+)\s+.*$/$1/;
160 $user = "" unless (Debbugs::User::is_valid_user($user));
161 my $indicated_user = 0;
166 if (@gExcludeFromControl and grep {$replyto =~ m/\Q$_\E/} @gExcludeFromControl) {
167 print {$transcript} fill_template('mail/excluded_from_control');
188 for ($procline=0; $procline<=$#bodylines; $procline++) {
193 $state eq 'idle' || print "state: $state ?\n";
194 $lowstate eq 'idle' || print "lowstate: $lowstate ?\n";
195 $mergelowstate eq 'idle' || print "mergelowstate: $mergelowstate ?\n";
197 print {$transcript} "Stopping processing here.\n\n";
200 $_= $bodylines[$procline]; s/\s+$//;
201 # Remove BOM markers from UTF-8 strings
206 my $temp = decode("utf8",$_,Encode::FB_CROAK);
209 print {$transcript} "> $_\n";
212 if (m/^(?:stop|quit|--|thank(?:s|\s*you)?|kthxbye)\.*\s*$/i) {
213 print {$transcript} "Stopping processing here.\n\n";
215 } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000) {
217 if ($dl > 0 and not grep /debug/,@common_control_options) {
218 push @common_control_options,(debug => $transcript);
220 print {$transcript} "Debug level $dl.\n\n";
221 } elsif (m/^(send|get)\s+\#?(\d{2,})$/i) {
223 &sendlynxdoc("bugreport.cgi?bug=$ref","logs for $gBug#$ref");
224 } elsif (m/^send-detail\s+\#?(\d{2,})$/i) {
226 &sendlynxdoc("bugreport.cgi?bug=$ref&boring=yes",
227 "detailed logs for $gBug#$ref");
228 } elsif (m/^index(\s+full)?$/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-summary\s+by-package$/i) {
233 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
235 $ok++; # well, it's not really ok, but it fixes #81224 :)
236 } elsif (m/^index-summary(\s+by-number)?$/i) {
237 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
239 $ok++; # well, it's not really ok, but it fixes #81224 :)
240 } elsif (m/^index(\s+|-)pack(age)?s?$/i) {
241 &sendlynxdoc("pkgindex.cgi?indexon=pkg",'index of packages');
242 } elsif (m/^index(\s+|-)maints?$/i) {
243 &sendlynxdoc("pkgindex.cgi?indexon=maint",'index of maintainers');
244 } elsif (m/^index(\s+|-)maint\s+(\S+)$/i) {
246 &sendlynxdoc("pkgreport.cgi?maint=" . urlsanit($maint),
247 "$gBug list for maintainer \`$maint'");
249 } elsif (m/^index(\s+|-)pack(age)?s?\s+(\S.*\S)$/i) {
251 &sendlynxdoc("pkgreport.cgi?pkg=" . urlsanit($package),
252 "$gBug list for package $package");
254 } elsif (m/^send-unmatched(\s+this|\s+-?0)?$/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/^send-unmatched\s+(last|-1)$/i) {
259 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
261 $ok++; # well, it's not really ok, but it fixes #81224 :)
262 } elsif (m/^send-unmatched\s+(old|-2)$/i) {
263 print {$transcript} "This BTS function is currently disabled, sorry.\n\n";
265 $ok++; # well, it's not really ok, but it fixes #81224 :)
266 } elsif (m/^getinfo\s+([\w.-]+)$/i) {
267 # the following is basically a Debian-specific kludge, but who cares
269 if ($req =~ /^maintainers$/i && -f "$gConfigDir/Maintainers") {
270 &sendinfo("local", "$gConfigDir/Maintainers", "Maintainers file");
271 } elsif ($req =~ /^override\.(\w+)\.([\w.-]+)$/i) {
273 &sendinfo("ftp.d.o", "$req", "override file for $2 part of $1 distribution");
274 } elsif ($req =~ /^pseudo-packages\.(description|maintainers)$/i && -f "$gConfigDir/$req") {
275 &sendinfo("local", "$gConfigDir/$req", "$req file");
277 print {$transcript} "Info file $req does not exist.\n\n";
279 } elsif (m/^help/i) {
281 print {$transcript} "\n";
283 } elsif (m/^refcard/i) {
284 &sendtxthelp("bug-mailserver-refcard.txt","mail servers' reference card");
285 } elsif (m/^subscribe/i) {
286 print {$transcript} <<END;
287 There is no $gProject $gBug mailing list. If you wish to review bug reports
288 please do so via $gWebDomain or ask this mail server
290 soon: MAILINGLISTS_TEXT
292 } elsif (m/^unsubscribe/i) {
293 print {$transcript} <<END;
294 soon: UNSUBSCRIBE_TEXT
295 soon: MAILINGLISTS_TEXT
297 } elsif (m/^user\s+(\S+)\s*$/i) {
299 if (Debbugs::User::is_valid_user($newuser)) {
300 my $olduser = ($user ne "" ? " (was $user)" : "");
301 print {$transcript} "Setting user to $newuser$olduser.\n";
305 print {$transcript} "Selected user id ($newuser) invalid, sorry\n";
310 } elsif (m/^usercategory\s+(\S+)(\s+\[hidden\])?\s*$/i) {
313 my $hidden = (defined $2 and $2 ne "");
320 print {$transcript} "No valid user selected\n";
324 if (not $indicated_user and defined $user) {
325 print {$transcript} "User is $user\n";
329 while (++$procline <= $#bodylines) {
330 unless ($bodylines[$procline] =~ m/^\s*([*+])\s*(\S.*)$/) {
334 print {$transcript} "> $bodylines[$procline]\n";
336 my ($o, $txt) = ($1, $2);
337 if ($#cats == -1 && $o eq "+") {
338 print {$transcript} "User defined category specification must start with a category name. Skipping.\n\n";
344 unless (ref($cats[-1]) eq "HASH") {
345 $cats[-1] = { "nam" => $cats[-1],
346 "pri" => [], "ttl" => [] };
349 my ($desc, $ord, $op);
350 if ($txt =~ m/^(.*\S)\s*\[((\d+):\s*)?\]\s*$/) {
351 $desc = $1; $ord = $3; $op = "";
352 } elsif ($txt =~ m/^(.*\S)\s*\[((\d+):\s*)?(\S+)\]\s*$/) {
353 $desc = $1; $ord = $3; $op = $4;
354 } elsif ($txt =~ m/^([^[\s]+)\s*$/) {
355 $desc = ""; $op = $1;
357 print {$transcript} "Unrecognised syntax for category section. Skipping.\n\n";
362 $ord = 999 unless defined $ord;
365 push @{$cats[-1]->{"pri"}}, $prefix . $op;
366 push @{$cats[-1]->{"ttl"}}, $desc;
367 push @ords, "$ord $catsec";
369 $cats[-1]->{"def"} = $desc;
370 push @ords, "$ord DEF";
374 my ($a1, $a2, $b1, $b2) = split / /, "$a $b";
375 ((looks_like_number($a1) and looks_like_number($a2))?$a1 <=> $b1:$a1 cmp $b1) ||
376 ((looks_like_number($a2) and looks_like_number($b2))?$a2 <=> $b2:$a2 cmp $b2);
378 $cats[-1]->{"ord"} = [map { m/^.* (\S+)/; $1 eq "DEF" ? $catsec + 1 : $1 } @ords];
379 } elsif ($o eq "*") {
382 if ($txt =~ m/^(.*\S)(\s*\[(\S+)\])\s*$/) {
383 $name = $1; $prefix = $3;
385 $name = $txt; $prefix = "";
390 # XXX: got @cats, now do something with it
391 my $u = Debbugs::User::get_user($user);
393 print {$transcript} "Added usercategory $catname.\n\n";
394 $u->{"categories"}->{$catname} = [ @cats ];
396 push @{$u->{visible_cats}},$catname;
399 print {$transcript} "Removed usercategory $catname.\n\n";
400 delete $u->{"categories"}->{$catname};
401 @{$u->{visible_cats}} = grep {$_ ne $catname} @{$u->{visible_cats}};
404 } elsif (m/^usertags?\s+\#?(-?\d+)\s+(([=+-])\s*)?(\S.*)?$/i) {
407 my $addsubcode = $3 || "+";
409 if ($ref =~ m/^-\d+$/ && defined $clonebugs{$ref}) {
410 $ref = $clonebugs{$ref};
413 print {$transcript} "No valid user selected\n";
416 } elsif (check_limit(data => read_bug(bug => $ref),
418 transcript => $transcript)) {
419 if (not $indicated_user and defined $user) {
420 print {$transcript} "User is $user\n";
424 Debbugs::User::read_usertags(\%ut, $user);
425 my @oldtags = (); my @newtags = (); my @badtags = ();
427 if (defined $tags and length $tags) {
428 for my $t (split /[,\s]+/, $tags) {
429 if ($t =~ m/^[a-zA-Z0-9.+\@-]+$/) {
437 print {$transcript} "Ignoring illegal tag/s: ".join(', ', @badtags).".\nPlease use only alphanumerics, at, dot, plus and dash.\n";
440 for my $t (keys %chtags) {
441 $ut{$t} = [] unless defined $ut{$t};
443 for my $t (keys %ut) {
444 my %res = map { ($_, 1) } @{$ut{$t}};
445 push @oldtags, $t if defined $res{$ref};
446 my $addop = ($addsubcode eq "+" or $addsubcode eq "=");
447 my $del = (defined $chtags{$t} ? $addsubcode eq "-"
448 : $addsubcode eq "=");
449 $res{$ref} = 1 if ($addop && defined $chtags{$t});
450 delete $res{$ref} if ($del);
451 push @newtags, $t if defined $res{$ref};
452 $ut{$t} = [ sort { $a <=> $b } (keys %res) ];
455 print {$transcript} "There were no usertags set.\n";
457 print {$transcript} "Usertags were: " . join(" ", @oldtags) . ".\n";
459 print {$transcript} "Usertags are now: " . join(" ", @newtags) . ".\n";
460 Debbugs::User::write_usertags(\%ut, $user);
462 } elsif (!$control) {
463 print {$transcript} <<END;
464 Unknown command or malformed arguments to command.
465 (Use control\@$gEmailDomain to manipulate reports.)
468 #### "developer only" ones start here
469 } elsif (defined valid_control($_)) {
470 my ($new_errors,$terminate_control) =
471 control_line(line => $_,
472 clonebugs => \%clonebugs,
474 common_control_options => \@common_control_options,
476 transcript => $transcript,
481 if ($terminate_control) {
485 print {$transcript} "Unknown command or malformed arguments to command.\n";
487 if (++$unknowns >= 5) {
488 print {$transcript} "Too many unknown commands, stopping here.\n\n";
493 if ($procline>$#bodylines) {
494 print {$transcript} ">\nEnd of message, stopping processing here.\n\n";
496 if (!$ok && !$quickabort) {
498 print {$transcript} "No commands successfully parsed; sending the help text(s).\n";
500 print {$transcript} "\n";
503 my @maintccs = determine_recipients(recipients => \%recipients,
507 if (!defined $header{'subject'} || $header{'subject'} eq "") {
508 $header{'subject'} = "your mail";
511 # Error text here advertises how many errors there were
512 my $error_text = $errors > 0 ? " (with $errors error" . ($errors > 1 ? "s" : "") . ")" : "";
515 push @common_headers, 'X-Loop',$gMaintainerEmail;
517 my $temp_transcript = $transcript_scalar;
519 $temp_transcript = decode("utf8",$temp_transcript,Encode::FB_CROAK);
522 create_mime_message([From => "$gMaintainerEmail ($gProject $gBug Tracking System)",
524 @maintccs ? (Cc => join(', ',@maintccs)):(),
525 Subject => "Processed${error_text}: $header{subject}",
526 'Message-ID' => "<handler.s.$nn.transcript\@$gEmailDomain>",
527 'In-Reply-To' => $header{'message-id'},
528 References => join(' ',grep {defined $_} $header{'message-id'},$data->{msgid}),
529 Precedence => 'bulk',
530 keys %affected_packages ?("X-${gProject}-PR-Package" => join(' ',keys %affected_packages)):(),
531 keys %affected_packages ?("X-${gProject}-PR-Source" =>
533 map {defined $_ ?(ref($_)?@{$_}:$_):()}
534 binary_to_source(binary => [keys %affected_packages],
535 source_only => 1))):(),
536 "X-$gProject-PR-Message" => 'transcript',
539 fill_template('mail/message_body',
540 {body => "${temp_transcript}Please contact me if you need assistance."},
543 my $repliedshow= join(', ',$replyto,
544 determine_recipients(recipients => \%recipients,
550 utime(time,time,"db-h");
552 &sendmailmessage($reply,
553 exists $header{'x-debbugs-no-ack'}?():$replyto,
554 make_list(values %{{determine_recipients(recipients => \%recipients,
560 unlink("incoming/P$nn") || die "unlinking incoming/P$nn: $!";
562 sub sendmailmessage {
563 my ($message,@recips) = @_;
564 $message = "X-Loop: $gMaintainerEmail\n" . $message;
565 send_mail_message(message => $message,
566 recipients => \@recips,
572 my ($template,$extra_var) = @_;
574 my $variables = {config => \%config,
575 defined($ref)?(ref => $ref):(),
576 defined($data)?(data => $data):(),
577 refs => [map {exists $clonebugs{$_}?$clonebugs{$_}:$_} keys %bug_affected],
580 my $hole_var = {'&bugurl' =>
582 $config{cgi_domain}.'/'.
583 Debbugs::CGI::bug_links(bug=>$_[0],
588 return fill_in_template(template => $template,
589 variables => $variables,
590 hole_var => $hole_var,
594 =head2 message_body_template
596 message_body_template('mail/ack',{ref=>'foo'});
598 Creates a message body using a template
602 sub message_body_template{
603 my ($template,$extra_var) = @_;
605 my $body = fill_template($template,$extra_var);
606 return fill_template('mail/message_body',
615 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
618 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
623 # print {$transcript} "Sorry, command $_[0] not yet implemented.\n\n";
625 our %checkmatch_values;
627 my ($string,$mvarname,$svarvalue,@newmergelist) = @_;
630 $mvarvalue = $checkmatch_values{$mvarname};
631 print {$transcript} "D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n"
634 "Values for \`$string' don't match:\n".
635 " #$newmergelist[0] has \`$mvarvalue';\n".
636 " #$ref has \`$svarvalue'\n"
637 if $mvarvalue ne $svarvalue;
639 print {$transcript} "D| setupmatch \`$string' /$mvarname/$svarvalue/\n"
641 $checkmatch_values{$mvarname} = $svarvalue;
646 if (keys %limit_pkgs and not defined $limit_pkgs{$data->{package}}) {
647 print {$transcript} "$gBug number $ref belongs to package $data->{package}, skipping.\n\n";
659 my %h = map { $_ => 1 } split ' ', $list;
666 return join ' ', sort keys %h;
669 # High-level bug manipulation calls
670 # Do announcements themselves
672 # Possible calling sequences:
676 # &transcript(something)
680 # $action= (something)
682 # (modify s_* variables)
683 # } while (getnextbug);
688 &dlen("nochangebug");
689 $state eq 'single' || $state eq 'multiple' || die "$state ?";
691 &endmerge if $manybugs;
693 &dlex("nochangebug");
697 our @thisbugmergelist;
700 &dlen("setbug $ref");
701 if ($ref =~ m/^-\d+/) {
702 if (!defined $clonebugs{$ref}) {
704 &dlex("setbug => noclone");
707 $ref = $clonebugs{$ref};
709 $state eq 'idle' || die "$state ?";
712 &dlex("setbug => 0s");
716 if (!&checkpkglimit) {
721 @thisbugmergelist= split(/ /,$data->{mergedwith});
722 if (!@thisbugmergelist) {
727 &dlex("setbug => 1s");
736 &dlex("setbug => 0mc");
740 $state= 'multiple'; $sref=$ref;
741 &dlex("setbug => 1m");
747 $state eq 'single' || $state eq 'multiple' || die "$state ?";
749 if (!$manybugs || !@thisbugmergelist) {
750 length($action) || die;
751 print {$transcript} "$action\n$extramessage\n";
752 &endmerge if $manybugs;
754 &dlex("getnextbug => 0");
757 $ref= shift(@thisbugmergelist);
758 &getbug || die "bug $ref disappeared";
760 &dlex("getnextbug => 1");
764 # Low-level bug-manipulation calls
765 # Do no announcements
773 # $action= (something)
778 # [getbug (returns 0)]
779 # &transcript("$action\n\n")
782 sub notfoundbug { print {$transcript} "$gBug number $ref not found. (Is it archived?)\n\n"; }
783 sub foundbug { print {$transcript} "$gBug#$ref: $data->{subject}\n"; }
787 $mergelowstate eq 'idle' || die "$mergelowstate ?";
788 &filelock('lock/merge');
789 $mergelowstate='locked';
795 $mergelowstate eq 'locked' || die "$mergelowstate ?";
797 $mergelowstate='idle';
802 &dlen("getbug $ref");
803 $lowstate eq 'idle' || die "$state ?";
804 # Only use unmerged bugs here
805 if (($data = &lockreadbug($ref,'db-h'))) {
808 &dlex("getbug => 1");
813 &dlex("getbug => 0");
819 $lowstate eq 'open' || die "$state ?";
826 &dlen("savebug $ref");
827 $lowstate eq 'open' || die "$lowstate ?";
828 length($action) || die;
829 $ref == $sref || die "read $sref but saving $ref ?";
830 append_action_to_log(bug => $ref,
832 requester => $header{from},
833 request_addr => $controlrequestaddr,
837 unlockwritebug($ref, $data);
844 print {$transcript} "C> @_ ($state $lowstate $mergelowstate)\n";
849 print {$transcript} "R> @_ ($state $lowstate $mergelowstate)\n";
856 my %saniarray = ('<','lt', '>','gt', '&','amp', '"','quot');
857 $url =~ s/([<>&"])/\&$saniarray{$1};/g;
863 print {$transcript} "\n";
869 print {$transcript} "\n";
876 my ($relpath,$description) = @_;
878 if (not -e "$gDocDir/$relpath") {
879 print {$transcript} "Unfortunatly, the help text doesn't exist, so it wasn't sent.\n";
880 warn "Help text $gDocDir/$relpath not found";
883 open(D,"$gDocDir/$relpath") || die "open doc file $relpath: $!";
884 while(<D>) { $doc.=$_; }
886 print {$transcript} "Sending $description in separate message.\n";
887 &sendmailmessage(<<END.$doc,$replyto);
888 From: $gMaintainerEmail ($gProject $gBug Tracking System)
890 Subject: $gProject $gBug help: $description
891 References: $header{'message-id'}
892 In-Reply-To: $header{'message-id'}
893 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
895 X-$gProject-PR-Message: doc-text $relpath
902 my ($relpath,$description) = @_;
904 open(L,"lynx -nolist -dump $gCGIDomain/\Q$relpath\E 2>&1 |") || die "fork for lynx: $!";
905 while(<L>) { $doc.=$_; }
907 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
908 print {$transcript} "Information ($description) is not available -\n".
909 "perhaps the $gBug does not exist or is not on the WWW yet.\n";
912 print {$transcript} "Error getting $description (code $? $!):\n$doc\n";
914 print {$transcript} "Sending $description.\n";
915 &sendmailmessage(<<END.$doc,$replyto);
916 From: $gMaintainerEmail ($gProject $gBug Tracking System)
918 Subject: $gProject $gBugs information: $description
919 References: $header{'message-id'}
920 In-Reply-To: $header{'message-id'}
921 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
923 X-$gProject-PR-Message: doc-html $relpath
932 my ($wherefrom,$path,$description) = @_;
933 if ($wherefrom eq "ftp.d.o") {
934 $doc = `lynx -nolist -dump http://ftp.debian.org/debian/indices/$path.gz 2>&1 | gunzip -cf` or die "fork for lynx/gunzip: $!";
936 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
937 print {$transcript} "$description is not available.\n";
940 print {$transcript} "Error getting $description (code $? $!):\n$doc\n";
943 } elsif ($wherefrom eq "local") {
945 $doc = do { local $/; <P> };
948 print {$transcript} "internal errror: info files location unknown.\n";
951 print {$transcript} "Sending $description.\n";
952 &sendmailmessage(<<END.$doc,$replyto);
953 From: $gMaintainerEmail ($gProject $gBug Tracking System)
955 Subject: $gProject $gBugs information: $description
956 References: $header{'message-id'}
957 In-Reply-To: $header{'message-id'}
958 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
960 X-$gProject-PR-Message: getinfo
962 $description follows:
966 print {$transcript} "\n";