2 # $Id: service.in,v 1.30 2000/11/08 18:09:39 joy Exp $
4 # Usage: service <code>.nn
5 # Temps: incoming/P<code>.nn
8 require('/etc/debbugs/config');
9 require('/usr/lib/debbugs/errorlib');
10 $ENV{'PATH'} = '/usr/lib/debbugs:'.$ENV{'PATH'};
11 chdir("$gSpoolDir") || die "chdir spool: $!\n";
14 open DEBUG, ">/dev/null";
18 m/^[RC]\.\d+$/ || &quit("bad argument");
21 if (!rename("incoming/G$nn","incoming/P$nn"))
22 { $_=$!.''; m/no such file or directory/i && exit 0;
23 &quit("renaming to lock: $!");
26 open(M,"incoming/P$nn");
31 grep((s/\n$//,s/\s+$//),@msg);
33 print "###\n",join("##\n",@msg),"\n###\n" if $debug;
35 chop($tdate= `date -u '+%a, %d %h %Y %T GMT'`);
37 Received: via spool for service; $tdate
40 for ($i=0; $i<=$#msg; $i++)
42 last unless length($_);
44 while ($msg[$i+1] =~ m/^\s/)
46 $fwd .= $msg[$i]."\n" if $ins; # Huh ? Where is ins set ?
49 print ">$_<\n" if $debug;
51 { $v= $1; $v =~ y/A-Z/a-z/;
52 print ">$v=$_<\n" if $debug;
54 } else { print "!>$_<\n" if $debug; }
57 defined($header{'from'}) || &quit("no From header");
58 delete $header{'reply-to'} if ( defined($header{'reply-to'}) && $header{'reply-to'} =~ m/^\s*$/ );
59 if ( defined($header{'reply-to'}) && $header{'reply-to'} ne "" ) {
60 $replyto = $header{'reply-to'};
62 $replyto = $header{'from'};
65 $controlrequestaddr= $control ? "control\@$gEmailDomain" : "request\@$gEmailDomain";
67 &transcript("Processing commands for $controlrequestaddr:\n\n");
72 $mergelowstate= 'idle';
76 #strip blank line(s) after header
77 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
79 #strip, if exists, mime header
80 if ( $msg[$i] =~ /^This is a multi-part message in MIME format./ )
81 { while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; }
82 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
84 if ( $msg[$i] =~ /^--/ || $msg[$i] =~ /^\s*$/ )
85 { while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i]; $i++; }
86 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
90 for ($procline=$i; $procline<=$#msg; $procline++)
91 { $state eq 'idle' || print "$state ?\n";
92 $lowstate eq 'idle' || print "$lowstate ?\n";
93 $mergelowstate eq 'idle' || print "$mergelowstate ?\n";
94 $_= $msg[$procline]; s/\s+$//;
95 next unless m/\S/; next if m/^\s*\#/;
96 &transcript("> $_\n");
98 if (m/^stop/i || m/^quit/i || m/^--/ || m/^thank/i)
99 { &transcript("Stopping processing here.\n\n");
101 } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000) {
103 &transcript("Debug level $dl.\n\n");
104 } elsif (m/^(send|get)\s+\#?(\d{2,})$/i) {
106 &sendlynxdoc("$ref","logs for $gBug#$ref");
107 } elsif (m/^send-detail\s+\#?(\d+)$/i) {
108 $ref= $1+0; $reffile= $ref; $reffile =~ s,^..,$&/$&,;
109 &sendlynxdoc("db/$reffile-b.html","additional logs for $gBug#$ref");
110 } elsif (m/^index(\s+full)?$/i) {
111 &sendlynxdoc("db/ix/full.html",'full index');
112 } elsif (m/^index-summary\s+by-package$/i) {
113 &sendlynxdoc("db/ix/psummary.html",'summary index sorted by package/title');
114 } elsif (m/^index-summary(\s+by-number)?$/i) {
115 &sendlynxdoc("db/ix/summary.html",'summary index sorted by number/date');
116 } elsif (m/^index(\s+|-)pack(age)?s?$/i) {
117 &sendlynxdoc("db/ix/packages.html",'index of packages');
118 } elsif (m/^index(\s+|-)maints?$/i) {
119 &sendlynxdoc("db/ix/maintainers.html",'index of maintainers');
120 } elsif (m/^index(\s+|-)maint\s+(\S.*\S)$/i) {
121 $substrg= $2; $matches=0;
122 opendir(DBD,"$gWebDir/db/ma") || die $!;
123 while (defined($_=readdir(DBD))) {
124 next unless m/^l/ && m/\.html$/;
125 &transcript("F|$_\n") if $dl>1;
126 $filename= $_; s/^l//; s/\.html$//;
127 &transcript("P|$_\n") if $dl>2;
128 while (s/-(..)([^_])/-$1_-$2/) { }
129 &transcript("P|$_\n") if $dl>2;
130 s/^(.{0,2})_/$1-20_/g; while (s/([^-]..)_/$1-20_/) { };
131 &transcript("P|$_\n") if $dl>2;
132 s/^,(.*),(.*),([^,]+)$/$1-40_$2-20_-28_$3-29_/;
133 &transcript("P|$_\n") if $dl>2;
134 s/^([^,]+),(.*),(.*),$/$1-20_-3c_$2-40_$3-3e_/;
135 &transcript("P|$_\n") if $dl>2;
137 &transcript("P|$_\n") if $dl>2;
139 while (m/-(..)_/) { $out.= $`.sprintf("%c",hex($1)); $_=$'; }
141 &transcript("M|$out\n") if $dl>1;
142 next unless index(lc $out, lc $substrg)>=0;
143 &transcript("S|$filename\n") if $dl>0;
144 &transcript("S|$out\n") if $dl>0;
146 &sendlynxdocraw("db/ma/$filename","$gBug list for maintainer \`$out'");
149 &transcript("$gBug list(s) for $matches maintainer(s) sent.\n\n");
151 &transcript("No maintainers found containing \`$substrg'.\n".
152 "Use \`index-maint' to get list of maintainers.\n\n");
155 } elsif (m/^index(\s+|-)pack(age)?s?\s+(\S.*\S)$/i) {
156 $substrg= $+; $matches=0;
157 opendir(DBD,"$gWebDir/db/pa") || die $!;
158 while (defined($_=readdir(DBD))) {
159 next unless m/^l/ && m/\.html$/;
160 &transcript("F|$_\n") if $dl>1;
161 $filename= $_; s/^l//; s/\.html$//;
162 next unless index(lc $_, lc $substrg)>=0;
163 &transcript("S|$filename\n") if $dl>0;
164 &transcript("S|$out\n") if $dl>0;
166 &sendlynxdocraw("db/pa/$filename","$gBug list for package \`$_'");
169 &transcript("$gBug list(s) for $matches package(s) sent.\n\n");
171 &transcript("No packages found containing \`$substrg'.\n".
172 "Use \`index-packages' to get list of packages.\n\n");
175 } elsif (m/^send-unmatched(\s+this|\s+-?0)?$/i) {
176 &sendlynxdoc("db/ju/unmatched-1.html","junk (this week)");
177 } elsif (m/^send-unmatched\s+(last|-1)$/i) {
178 &sendlynxdoc("db/ju/unmatched-2.html","junk (last week)");
179 } elsif (m/^send-unmatched\s+(old|-2)$/i) {
180 &sendlynxdoc("db/ju/unmatched-3.html","junk (two weeks ago)");
181 } elsif (m/^getinfo\s+(\S+)$/i) {
183 if ($file =~ m/^\./ || $file !~ m/^[-.0-9a-z]+$/ || $file =~ m/\.gz$/) {
184 &transcript("Filename $file is badly formatted.\n\n");
185 } elsif (open(P,"$gDocDir/$file")) {
187 &transcript("Info file $file appears below.\n\n");
188 $extras.= "\n---------- Info file $file follows:\n\n";
189 while(<P>) { $extras.= $_; }
192 &transcript("Info file $file does not exist.\n\n");
194 } elsif (m/^help/i) {
198 } elsif (m/^refcard/i) {
199 &sendtxthelp("bug-mailserver-refcard.txt","mailservers' reference card");
200 } elsif (m/^subscribe/i) {
202 There is no $gProject $gBug mailing list. If you wish to review bug reports
203 please do so via http://$gWebDomain/ or ask this mailserver
205 soon: MAILINGLISTS_TEXT
207 } elsif (m/^unsubscribe/i) {
209 soon: UNSUBSCRIBE_TEXT
210 soon: MAILINGLISTS_TEXT
212 } elsif (!$control) {
214 Unknown command or malformed arguments to command.
215 (Use control\@$gEmailDomain to manipulate reports.)
218 if (++$unknowns >= 3) {
219 &transcript("Too many unknown commands, stopping here.\n\n");
222 } elsif (m/^close\s+\#?(\d+)$/i) {
226 if (length($s_done)) {
227 &transcript("$gBug is already closed, cannot re-close.\n\n");
230 $action= "$gBug closed, send any further explanations to $s_originator";
232 &addmaintainers($s_package);
233 if ( length( $gDoneList ) > 0 && length( $gListDomain ) >
234 0 ) { &addccaddress("$gDoneList\@$gListDomain"); }
237 From: $gMaintainerEmail ($gProject $gBug Tracking System)
239 Subject: $gBug#$ref acknowledged by developer
241 References: $header{'message-id'} $s_msgid
242 In-Reply-To: $s_msgid
243 Message-ID: <handler.$ref.$nn.notifdonectrl.$midix\@$gEmailDomain>
245 This is an automatic notification regarding your $gBug report
248 It has been marked as closed by one of the developers, namely
251 You should be hearing from them with a substantive response shortly,
252 if you have not already done so. If not, please contact them
256 (administrator, $gProject $gBugs database)
258 &sendmailmessage($message,$s_originator);
259 } while (&getnextbug);
262 } elsif (m/^reassign\s+\#?(\d+)\s+(\S.*\S)$/i) {
264 $ref= $1; $newpackage= $2;
265 $newpackage =~ y/A-Z/a-z/;
267 if (length($s_package)) {
268 $action= "$gBug reassigned from package \`$s_package'".
269 " to \`$newpackage'.";
271 $action= "$gBug assigned to package \`$newpackage'.";
274 &addmaintainers($s_package);
275 &addmaintainers($newpackage);
276 $s_package= $newpackage;
277 } while (&getnextbug);
279 } elsif (m/^reopen\s+\#?(\d+)$/i ? ($noriginator='', 1) :
280 m/^reopen\s+\#?(\d+)\s+\=$/i ? ($noriginator='', 1) :
281 m/^reopen\s+\#?(\d+)\s+\!$/i ? ($noriginator=$replyto, 1) :
282 m/^reopen\s+\#?(\d+)\s+(\S.*\S)$/i ? ($noriginator=$2, 1) : 0) {
286 if (!length($s_done)) {
287 &transcript("$gBug is already open, cannot reopen.\n\n");
291 $noriginator eq '' ? "$gBug reopened, originator not changed." :
292 "$gBug reopened, originator set to $noriginator.";
294 &addmaintainers($s_package);
295 $s_originator= $noriginator eq '' ? $s_originator : $noriginator;
297 } while (&getnextbug);
300 } elsif (m/^forwarded\s+\#?(\d+)\s+(\S.*\S)$/i) {
302 $ref= $1; $whereto= $2;
304 if (length($s_forwarded)) {
305 $action= "Forwarded-to-address changed from $s_forwarded to $whereto.";
307 $action= "Noted your statement that $gBug has been forwarded to $whereto.";
309 if (length($s_done)) {
310 $extramessage= "(By the way, this $gBug is currently marked as done.)\n";
313 &addmaintainers($s_package);
314 if (length($gFowardList)>0 && length($gListDomain)>0 )
315 { &addccaddress("$gFowardList\@$gListDomain"); }
316 $s_forwarded= $whereto;
317 } while (&getnextbug);
319 } elsif (m/^notforwarded\s+\#?(\d+)$/i) {
323 if (!length($s_forwarded)) {
324 &transcript("$gBug is not marked as having been forwarded.\n\n");
327 $action= "Removed annotation that $gBug had been forwarded to $s_forwarded.";
329 &addmaintainers($s_package);
331 } while (&getnextbug);
334 } elsif (m/^severity\s+\#?(\d+)\s+([-0-9a-z]+)$/i ||
335 m/^priority\s+\#?(\d+)\s+([-0-9a-z]+)$/i) {
339 if (!grep($_ eq $newseverity, @gSeverityList, "$gDefaultSeverity")) {
340 &transcript("Severity level \`$newseverity' is not known.\n".
341 "Recognized are: $gShowSeverities.\n\n");
343 $printseverity= $s_severity;
344 $printseverity= "$gDefaultSeverity" if $printseverity eq '';
345 $action= "Severity set to \`$newseverity'.";
347 # if ( &newseverity eq 'fixed' && length( $gDoneList ) > 0 && length( $gListDomain ) > 0 ) {
348 # &addccaddress("$gDoneList\@$gListDomain");
350 &addmaintainers($s_package);
351 $s_severity= $newseverity;
352 } while (&getnextbug);
354 } elsif (m/^tags\s+\#?(\d+)\s+(([=+-])\s+)?(\S.*)?$/) {
356 $ref= $1; $addsubcode= $3; $tags= $4;
358 $addsub = "sub" if ($addsubcode eq "-");
359 $addsub = "add" if ($addsubcode eq "+");
360 $addsub = "set" if ($addsubcode eq "=");
363 foreach my $t (split /[\s,]+/, $tags) {
364 if (!grep($_ eq $t, @gTags)) {
371 &transcript("Unknown tag/s: ".join(', ', @badtags).".\n".
372 "Recognized are: ".join(' ', @gTags).".\n\n");
375 if ($addsub eq "set") {
376 $action= "Tags set to: " . join(", ", @okaytags);
377 } elsif ($addsub eq "add") {
378 $action= "Tags added: " . join(", ", @okaytags);
379 } elsif ($addsub eq "sub") {
380 $action= "Tags removed: " . join(", ", @okaytags);
383 &addmaintainers($s_package);
384 $s_keywords = '' if ($addsub eq "set");
385 if ($addsub eq "sub") {
386 foreach my $t (@badtags) {
387 $s_keywords = join ' ', grep $_ ne $t,
388 split ' ', $s_keywords;
391 foreach my $t (@okaytags) {
392 $s_keywords = join ' ', grep $_ ne $t,
393 split ' ', $s_keywords;
394 $s_keywords = "$t $s_keywords" unless($addsub eq "sub");
396 $s_keywords =~ s/\s*$//;
397 } while (&getnextbug);
399 } elsif (m/^retitle\s+\#?(\d+)\s+(\S.*\S)\s*$/i) {
401 $ref= $1; $newtitle= $2;
404 &addmaintainers($s_package);
405 $s_subject= $newtitle;
406 $action= "Changed $gBug title.";
408 &transcript("$action\n");
409 if (length($s_done)) {
410 &transcript("(By the way, that $gBug is currently marked as done.)\n");
416 } elsif (m/^unmerge\s+\#?(\d+)$/i) {
420 if (!length($s_mergedwith)) {
421 &transcript("$gBug is not marked as being merged with any others.\n\n");
424 $mergelowstate eq 'locked' || die "$mergelowstate ?";
425 $action= "Disconnected #$ref from all other report(s).";
426 @newmergelist= split(/ /,$s_mergedwith);
429 &addmaintainers($s_package);
430 $s_mergedwith= ($ref == $discref) ? ''
431 : join(' ',grep($_ ne $ref,@newmergelist));
432 } while (&getnextbug);
435 } elsif (m/^merge\s+(\d+(\s+\d+)+)\s*$/i) {
437 @tomerge= sort { $a <=> $b } split(/\s+/,$1);
441 while (defined($ref= shift(@tomerge))) {
442 &transcript("D| checking merge $ref\n") if $dl;
444 next if grep($_ eq $ref,@newmergelist);
445 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
447 &transcript("D| adding $ref ($s_mergedwith)\n") if $dl;
449 &checkmatch('package','m_package',$s_package);
450 &checkmatch('forwarded addr','m_forwarded',$s_forwarded);
451 $s_severity = '$gDefaultSeverity' if $s_severity eq '';
452 &checkmatch('severity','m_severity',$s_severity);
453 &checkmatch('done mark','m_done',length($s_done) ? 'done' : 'open');
454 foreach my $t (split /\s+/, $s_keywords) { $tags{$t} = 1; }
455 if (length($mismatch)) {
456 &transcript("Mismatch - only $gBugs in same state can be merged:\n".
458 &cancelbug; @newmergelist=(); last;
460 push(@newmergelist,$ref);
461 push(@tomerge,split(/ /,$s_mergedwith));
465 @newmergelist= sort { $a <=> $b } @newmergelist;
466 $action= "Merged @newmergelist.";
467 for $ref (@newmergelist) {
468 &getbug || die "huh ? $gBug $ref disappeared during merge";
469 &addmaintainers($s_package);
470 $s_mergedwith= join(' ',grep($_ ne $ref,@newmergelist));
471 $s_keywords= join(' ', keys %tags);
474 &transcript("$action\n\n");
478 &transcript("Unknown command or malformed arguments to command.\n\n");
479 if (++$unknowns >= 5) {
480 &transcript("Too many unknown commands, stopping here.\n\n");
485 if ($procline>$#msg) {
486 &transcript(">\nEnd of message, stopping processing here.\n\n");
489 &transcript("No commands successfully parsed; sending the help text(s).\n");
494 &transcript("MC\n") if $dl>1;
496 for $maint (keys %maintccreasons) {
497 &transcript("MM|$maint|\n") if $dl>1;
498 next if $maint eq $replyto;
500 $reasonsref= $maintccreasons{$maint};
501 &transcript("MY|$maint|\n") if $dl>2;
502 for $p (sort keys %$reasonsref) {
503 &transcript("MP|$p|\n") if $dl>2;
504 $reasonstring.= ', ' if length($reasonstring);
505 $reasonstring.= $p.' ' if length($p);
506 $reasonstring.= join(' ',map("#$_",sort keys %{$$reasonsref{$p}}));
508 $reasonstring = "" if (!defined($reasonstring));
509 push(@maintccs,"$maint ($reasonstring)");
510 push(@maintccaddrs,"$maint");
513 &transcript("MC|@maintccs|\n") if $dl>2;
514 $maintccs= "Cc: ".join(",\n ",@maintccs)."\n";
515 } else { $maintccs = ""; }
517 if (!defined $header{'subject'} || $header{'subject'} eq "") {
518 $header{'subject'} = "your mail";
522 From: $gMaintainerEmail ($gProject $gBug Tracking System)
524 ${maintccs}Subject: Processed: $header{'subject'}
525 In-Reply-To: $header{'message-id'}
526 References: $header{'message-id'}
527 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
529 ${transcript}Please contact me if you need assistance.
532 (administrator, $gProject $gBugs database)
536 $repliedshow= join(', ',$replyto,@maintccaddrs);
537 &filelock("lock/-1");
538 open(AP,">>db/-1.log") || &quit("open db/-1.log: $!");
540 "\2\n$repliedshow\n\5\n$reply\n\3\n".
542 "<strong>Request received</strong> from <code>".
543 &sani($header{'from'})."</code>\n".
544 "to <code>".&sani($controlrequestaddr)."</code>\n".
546 "\7\n",@log,"\n\3\n") || &quit("writing db/-1.log: $!");
547 close(AP) || &quit("open db/-1.log: $!");
549 utime(time,time,"db");
551 &sendmailmessage($reply,$replyto,@maintccaddrs);
553 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
557 map { $_->address() }
558 map { Mail::Address->parse($_) } @_;
561 sub sendmailmessage {
562 local ($message,@recips) = @_;
563 print "mailing to >@recips<\n" if $debug;
565 defined($c) || &quit("mailing forking for sendmail: $!");
566 if (!$c) { # ie, we are the child process
567 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odi','-oem','-oi',get_addresses(@recips);
570 print(D $message) || &quit("writing to sendmail process: $!");
571 $!=0; close(D); $? && &quit("sendmail gave exit status $? ($!)");
576 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
577 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
582 # &transcript("Sorry, command $_[0] not yet implemented.\n\n");
586 local ($string,$mvarname,$svarvalue) = @_;
589 eval "\$mvarvalue= \$$mvarname";
590 &transcript("D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n")
593 "Values for \`$string' don't match:\n".
594 " #$newmergelist[0] has \`$mvarvalue';\n".
595 " #$ref has \`$svarvalue'\n"
596 if $mvarvalue ne $svarvalue;
598 &transcript("D| setupmatch \`$string' /$mvarname/$svarvalue/\n")
600 eval "\$$mvarname= \$svarvalue";
604 # High-level bug manipulation calls
605 # Do announcements themselves
607 # Possible calling sequences:
611 # &transcript(something)
615 # $action= (something)
617 # (modify s_* variables)
618 # } while (getnextbug);
621 &dlen("nochangebug");
622 $state eq 'single' || $state eq 'multiple' || die "$state ?";
624 &endmerge if $manybugs;
626 &dlex("nochangebug");
630 &dlen("setbug $ref");
631 $state eq 'idle' || die "$state ?";
634 &dlex("setbug => 0s");
637 @thisbugmergelist= split(/ /,$s_mergedwith);
638 if (!@thisbugmergelist) {
643 &dlex("setbug => 1s");
652 &dlex("setbug => 0mc");
656 $state= 'multiple'; $sref=$ref;
657 &dlex("setbug => 1m");
663 $state eq 'single' || $state eq 'multiple' || die "$state ?";
665 if (!$manybugs || !@thisbugmergelist) {
666 length($action) || die;
667 &transcript("$action\n$extramessage\n");
668 &endmerge if $manybugs;
670 &dlex("getnextbug => 0");
673 $ref= shift(@thisbugmergelist);
674 &getbug || die "bug $ref disappeared";
676 &dlex("getnextbug => 1");
680 # Low-level bug-manipulation calls
681 # Do no announcements
689 # $action= (something)
694 # [getbug (returns 0)]
695 # &transcript("$action\n\n")
698 sub notfoundbug { &transcript("$gBug number $ref not found.\n\n"); }
699 sub foundbug { &transcript("$gBug#$ref: $s_subject\n"); }
703 $mergelowstate eq 'idle' || die "$mergelowstate ?";
704 &filelock('lock/merge');
705 $mergelowstate='locked';
711 $mergelowstate eq 'locked' || die "$mergelowstate ?";
713 $mergelowstate='idle';
718 &dlen("getbug $ref");
719 $lowstate eq 'idle' || die "$state ?";
720 if (&lockreadbug($ref)) {
723 &dlex("getbug => 1");
728 &dlex("getbug => 0");
734 $lowstate eq 'open' || die "$state ?";
741 &dlen("savebug $ref");
742 $lowstate eq 'open' || die "$lowstate ?";
743 length($action) || die;
744 $ref == $sref || die "read $sref but saving $ref ?";
745 open(L,">>db/$ref.log") || &quit("opening db/$ref.log: $!");
748 "<strong>".&sani($action)."</strong>\n".
749 "Request was from <code>".&sani($header{'from'})."</code>\n".
750 "to <code>".&sani($controlrequestaddr)."</code>. \n".
752 "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log: $!");
753 close(L) || &quit("closing db/$ref.log: $!");
754 open(S,">db/$ref.status.new") || &quit("opening db/$ref.status.new: $!");
765 "$s_severity\n") || &quit("writing db/$ref.status.new: $!");
766 close(S) || &quit("closing db/$ref.status.new: $!");
767 rename("db/$ref.status.new","db/$ref.status") ||
768 &quit("installing new db/$ref.status: $!");
776 &transcript("C> @_ ($state $lowstate $mergelowstate)\n");
781 &transcript("R> @_ ($state $lowstate $mergelowstate)\n");
785 print $_[0] if $debug;
802 local ($relpath,$description) = @_;
804 open(D,"$gDocDir/$relpath") || &quit("open doc file $relpath: $!");
805 while(<D>) { $doc.=$_; }
807 &transcript("Sending $description in separate message.\n");
808 &sendmailmessage(<<END.$doc,$replyto);
809 From: $gMaintainerEmail ($gProject $gBug Tracking System)
811 Subject: $gProject $gBug help: $description
812 References: $header{'message-id'}
813 In-Reply-To: $header{'message-id'}
814 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
821 local ($relpath,$description) = @_;
823 open(L,"lynx -nolist -dump http://$gWebDomain/$relpath 2>&1 |") || &quit("fork for lynx: $!");
824 while(<L>) { $doc.=$_; }
826 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
827 &transcript("Information ($description) is not available -\n".
828 "perhaps the $gBug does not exist or is not on the WWW yet.\n");
831 &transcript("Error getting $description (code $? $!):\n$doc\n");
833 &transcript("Sending $description.\n");
834 &sendmailmessage(<<END.$doc,$replyto);
835 From: $gMaintainerEmail ($gProject $gBug Tracking System)
837 Subject: $gProject $gBugs information: $description
838 References: $header{'message-id'}
839 In-Reply-To: $header{'message-id'}
840 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
849 $maintccreasons{$cca}{''}{$ref}= 1;
853 { # Data structure is:
854 # maintainer email address &c -> assoc of packages -> assoc of bug#'s
855 my ($p, $addmaint, $pshow);
856 &ensuremaintainersloaded;
857 $anymaintfound=0; $anymaintnotfound=0;
858 for $p (split(m/[ \t?,()]+/,$_[0]))
860 $pshow= ($p =~ m/[-+.a-z0-9]+/ ? $& : '');
861 if (defined($maintainerof{$p}))
862 { $addmaint= $maintainerof{$p};
863 &transcript("MR|$addmaint|$p|$ref|\n") if $dl>2;
864 $maintccreasons{$addmaint}{$p}{$ref}= 1;
865 print "maintainer add >$p|$addmaint<\n" if $debug;
866 } else { print "maintainer none >$p<\n" if $debug; }
870 sub ensuremaintainersloaded {
872 return if $maintainersloaded++;
873 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
877 m/^(\S+)\s+(\S.*\S)\n$/ || &quit("maintainers bogus \`$_'");
878 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
879 $maintainerof{$1}= $2;