2 # $Id: service.in,v 1.31 2000/11/22 10:02:51 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
247 which was filed against the $s_package package.
249 It has been marked as closed by one of the developers, namely
252 You should be hearing from them with a substantive response shortly,
253 if you have not already done so. If not, please contact them
257 (administrator, $gProject $gBugs database)
260 &sendmailmessage($message,$s_originator);
261 } while (&getnextbug);
264 } elsif (m/^reassign\s+\#?(\d+)\s+(\S.*\S)$/i) {
266 $ref= $1; $newpackage= $2;
267 $newpackage =~ y/A-Z/a-z/;
269 if (length($s_package)) {
270 $action= "$gBug reassigned from package \`$s_package'".
271 " to \`$newpackage'.";
273 $action= "$gBug assigned to package \`$newpackage'.";
276 &addmaintainers($s_package);
277 &addmaintainers($newpackage);
278 $s_package= $newpackage;
279 } while (&getnextbug);
281 } elsif (m/^reopen\s+\#?(\d+)$/i ? ($noriginator='', 1) :
282 m/^reopen\s+\#?(\d+)\s+\=$/i ? ($noriginator='', 1) :
283 m/^reopen\s+\#?(\d+)\s+\!$/i ? ($noriginator=$replyto, 1) :
284 m/^reopen\s+\#?(\d+)\s+(\S.*\S)$/i ? ($noriginator=$2, 1) : 0) {
288 if (!length($s_done)) {
289 &transcript("$gBug is already open, cannot reopen.\n\n");
293 $noriginator eq '' ? "$gBug reopened, originator not changed." :
294 "$gBug reopened, originator set to $noriginator.";
296 &addmaintainers($s_package);
297 $s_originator= $noriginator eq '' ? $s_originator : $noriginator;
299 } while (&getnextbug);
302 } elsif (m/^forwarded\s+\#?(\d+)\s+(\S.*\S)$/i) {
304 $ref= $1; $whereto= $2;
306 if (length($s_forwarded)) {
307 $action= "Forwarded-to-address changed from $s_forwarded to $whereto.";
309 $action= "Noted your statement that $gBug has been forwarded to $whereto.";
311 if (length($s_done)) {
312 $extramessage= "(By the way, this $gBug is currently marked as done.)\n";
315 &addmaintainers($s_package);
316 if (length($gFowardList)>0 && length($gListDomain)>0 )
317 { &addccaddress("$gFowardList\@$gListDomain"); }
318 $s_forwarded= $whereto;
319 } while (&getnextbug);
321 } elsif (m/^notforwarded\s+\#?(\d+)$/i) {
325 if (!length($s_forwarded)) {
326 &transcript("$gBug is not marked as having been forwarded.\n\n");
329 $action= "Removed annotation that $gBug had been forwarded to $s_forwarded.";
331 &addmaintainers($s_package);
333 } while (&getnextbug);
336 } elsif (m/^severity\s+\#?(\d+)\s+([-0-9a-z]+)$/i ||
337 m/^priority\s+\#?(\d+)\s+([-0-9a-z]+)$/i) {
341 if (!grep($_ eq $newseverity, @gSeverityList, "$gDefaultSeverity")) {
342 &transcript("Severity level \`$newseverity' is not known.\n".
343 "Recognized are: $gShowSeverities.\n\n");
345 $printseverity= $s_severity;
346 $printseverity= "$gDefaultSeverity" if $printseverity eq '';
347 $action= "Severity set to \`$newseverity'.";
349 # if ( &newseverity eq 'fixed' && length( $gDoneList ) > 0 && length( $gListDomain ) > 0 ) {
350 # &addccaddress("$gDoneList\@$gListDomain");
352 &addmaintainers($s_package);
353 $s_severity= $newseverity;
354 } while (&getnextbug);
356 } elsif (m/^tags\s+\#?(\d+)\s+(([=+-])\s+)?(\S.*)?$/) {
358 $ref= $1; $addsubcode= $3; $tags= $4;
360 $addsub = "sub" if ($addsubcode eq "-");
361 $addsub = "add" if ($addsubcode eq "+");
362 $addsub = "set" if ($addsubcode eq "=");
365 foreach my $t (split /[\s,]+/, $tags) {
366 if (!grep($_ eq $t, @gTags)) {
373 &transcript("Unknown tag/s: ".join(', ', @badtags).".\n".
374 "Recognized are: ".join(' ', @gTags).".\n\n");
377 if ($addsub eq "set") {
378 $action= "Tags set to: " . join(", ", @okaytags);
379 } elsif ($addsub eq "add") {
380 $action= "Tags added: " . join(", ", @okaytags);
381 } elsif ($addsub eq "sub") {
382 $action= "Tags removed: " . join(", ", @okaytags);
385 &addmaintainers($s_package);
386 $s_keywords = '' if ($addsub eq "set");
387 if ($addsub eq "sub") {
388 foreach my $t (@badtags) {
389 $s_keywords = join ' ', grep $_ ne $t,
390 split ' ', $s_keywords;
393 foreach my $t (@okaytags) {
394 $s_keywords = join ' ', grep $_ ne $t,
395 split ' ', $s_keywords;
396 $s_keywords = "$t $s_keywords" unless($addsub eq "sub");
398 $s_keywords =~ s/\s*$//;
399 } while (&getnextbug);
401 } elsif (m/^retitle\s+\#?(\d+)\s+(\S.*\S)\s*$/i) {
403 $ref= $1; $newtitle= $2;
406 &addmaintainers($s_package);
407 $s_subject= $newtitle;
408 $action= "Changed $gBug title.";
410 &transcript("$action\n");
411 if (length($s_done)) {
412 &transcript("(By the way, that $gBug is currently marked as done.)\n");
418 } elsif (m/^unmerge\s+\#?(\d+)$/i) {
422 if (!length($s_mergedwith)) {
423 &transcript("$gBug is not marked as being merged with any others.\n\n");
426 $mergelowstate eq 'locked' || die "$mergelowstate ?";
427 $action= "Disconnected #$ref from all other report(s).";
428 @newmergelist= split(/ /,$s_mergedwith);
431 &addmaintainers($s_package);
432 $s_mergedwith= ($ref == $discref) ? ''
433 : join(' ',grep($_ ne $ref,@newmergelist));
434 } while (&getnextbug);
437 } elsif (m/^merge\s+(\d+(\s+\d+)+)\s*$/i) {
439 @tomerge= sort { $a <=> $b } split(/\s+/,$1);
443 while (defined($ref= shift(@tomerge))) {
444 &transcript("D| checking merge $ref\n") if $dl;
446 next if grep($_ eq $ref,@newmergelist);
447 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
449 &transcript("D| adding $ref ($s_mergedwith)\n") if $dl;
451 &checkmatch('package','m_package',$s_package);
452 &checkmatch('forwarded addr','m_forwarded',$s_forwarded);
453 $s_severity = '$gDefaultSeverity' if $s_severity eq '';
454 &checkmatch('severity','m_severity',$s_severity);
455 &checkmatch('done mark','m_done',length($s_done) ? 'done' : 'open');
456 foreach my $t (split /\s+/, $s_keywords) { $tags{$t} = 1; }
457 if (length($mismatch)) {
458 &transcript("Mismatch - only $gBugs in same state can be merged:\n".
460 &cancelbug; @newmergelist=(); last;
462 push(@newmergelist,$ref);
463 push(@tomerge,split(/ /,$s_mergedwith));
467 @newmergelist= sort { $a <=> $b } @newmergelist;
468 $action= "Merged @newmergelist.";
469 for $ref (@newmergelist) {
470 &getbug || die "huh ? $gBug $ref disappeared during merge";
471 &addmaintainers($s_package);
472 $s_mergedwith= join(' ',grep($_ ne $ref,@newmergelist));
473 $s_keywords= join(' ', keys %tags);
476 &transcript("$action\n\n");
480 &transcript("Unknown command or malformed arguments to command.\n\n");
481 if (++$unknowns >= 5) {
482 &transcript("Too many unknown commands, stopping here.\n\n");
487 if ($procline>$#msg) {
488 &transcript(">\nEnd of message, stopping processing here.\n\n");
491 &transcript("No commands successfully parsed; sending the help text(s).\n");
496 &transcript("MC\n") if $dl>1;
498 for $maint (keys %maintccreasons) {
499 &transcript("MM|$maint|\n") if $dl>1;
500 next if $maint eq $replyto;
502 $reasonsref= $maintccreasons{$maint};
503 &transcript("MY|$maint|\n") if $dl>2;
504 for $p (sort keys %$reasonsref) {
505 &transcript("MP|$p|\n") if $dl>2;
506 $reasonstring.= ', ' if length($reasonstring);
507 $reasonstring.= $p.' ' if length($p);
508 $reasonstring.= join(' ',map("#$_",sort keys %{$$reasonsref{$p}}));
510 $reasonstring = "" if (!defined($reasonstring));
511 push(@maintccs,"$maint ($reasonstring)");
512 push(@maintccaddrs,"$maint");
515 &transcript("MC|@maintccs|\n") if $dl>2;
516 $maintccs= "Cc: ".join(",\n ",@maintccs)."\n";
517 } else { $maintccs = ""; }
519 if (!defined $header{'subject'} || $header{'subject'} eq "") {
520 $header{'subject'} = "your mail";
524 From: $gMaintainerEmail ($gProject $gBug Tracking System)
526 ${maintccs}Subject: Processed: $header{'subject'}
527 In-Reply-To: $header{'message-id'}
528 References: $header{'message-id'}
529 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
531 ${transcript}Please contact me if you need assistance.
534 (administrator, $gProject $gBugs database)
538 $repliedshow= join(', ',$replyto,@maintccaddrs);
539 &filelock("lock/-1");
540 open(AP,">>db/-1.log") || &quit("open db/-1.log: $!");
542 "\2\n$repliedshow\n\5\n$reply\n\3\n".
544 "<strong>Request received</strong> from <code>".
545 &sani($header{'from'})."</code>\n".
546 "to <code>".&sani($controlrequestaddr)."</code>\n".
548 "\7\n",@log,"\n\3\n") || &quit("writing db/-1.log: $!");
549 close(AP) || &quit("open db/-1.log: $!");
551 utime(time,time,"db");
553 &sendmailmessage($reply,$replyto,@maintccaddrs);
555 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
559 map { $_->address() }
560 map { Mail::Address->parse($_) } @_;
563 sub sendmailmessage {
564 local ($message,@recips) = @_;
565 print "mailing to >@recips<\n" if $debug;
567 defined($c) || &quit("mailing forking for sendmail: $!");
568 if (!$c) { # ie, we are the child process
569 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odi','-oem','-oi',get_addresses(@recips);
572 print(D $message) || &quit("writing to sendmail process: $!");
573 $!=0; close(D); $? && &quit("sendmail gave exit status $? ($!)");
578 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
579 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
584 # &transcript("Sorry, command $_[0] not yet implemented.\n\n");
588 local ($string,$mvarname,$svarvalue) = @_;
591 eval "\$mvarvalue= \$$mvarname";
592 &transcript("D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n")
595 "Values for \`$string' don't match:\n".
596 " #$newmergelist[0] has \`$mvarvalue';\n".
597 " #$ref has \`$svarvalue'\n"
598 if $mvarvalue ne $svarvalue;
600 &transcript("D| setupmatch \`$string' /$mvarname/$svarvalue/\n")
602 eval "\$$mvarname= \$svarvalue";
606 # High-level bug manipulation calls
607 # Do announcements themselves
609 # Possible calling sequences:
613 # &transcript(something)
617 # $action= (something)
619 # (modify s_* variables)
620 # } while (getnextbug);
623 &dlen("nochangebug");
624 $state eq 'single' || $state eq 'multiple' || die "$state ?";
626 &endmerge if $manybugs;
628 &dlex("nochangebug");
632 &dlen("setbug $ref");
633 $state eq 'idle' || die "$state ?";
636 &dlex("setbug => 0s");
639 @thisbugmergelist= split(/ /,$s_mergedwith);
640 if (!@thisbugmergelist) {
645 &dlex("setbug => 1s");
654 &dlex("setbug => 0mc");
658 $state= 'multiple'; $sref=$ref;
659 &dlex("setbug => 1m");
665 $state eq 'single' || $state eq 'multiple' || die "$state ?";
667 if (!$manybugs || !@thisbugmergelist) {
668 length($action) || die;
669 &transcript("$action\n$extramessage\n");
670 &endmerge if $manybugs;
672 &dlex("getnextbug => 0");
675 $ref= shift(@thisbugmergelist);
676 &getbug || die "bug $ref disappeared";
678 &dlex("getnextbug => 1");
682 # Low-level bug-manipulation calls
683 # Do no announcements
691 # $action= (something)
696 # [getbug (returns 0)]
697 # &transcript("$action\n\n")
700 sub notfoundbug { &transcript("$gBug number $ref not found.\n\n"); }
701 sub foundbug { &transcript("$gBug#$ref: $s_subject\n"); }
705 $mergelowstate eq 'idle' || die "$mergelowstate ?";
706 &filelock('lock/merge');
707 $mergelowstate='locked';
713 $mergelowstate eq 'locked' || die "$mergelowstate ?";
715 $mergelowstate='idle';
720 &dlen("getbug $ref");
721 $lowstate eq 'idle' || die "$state ?";
722 if (&lockreadbug($ref)) {
725 &dlex("getbug => 1");
730 &dlex("getbug => 0");
736 $lowstate eq 'open' || die "$state ?";
743 &dlen("savebug $ref");
744 $lowstate eq 'open' || die "$lowstate ?";
745 length($action) || die;
746 $ref == $sref || die "read $sref but saving $ref ?";
747 open(L,">>db/$ref.log") || &quit("opening db/$ref.log: $!");
750 "<strong>".&sani($action)."</strong>\n".
751 "Request was from <code>".&sani($header{'from'})."</code>\n".
752 "to <code>".&sani($controlrequestaddr)."</code>. \n".
754 "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log: $!");
755 close(L) || &quit("closing db/$ref.log: $!");
756 open(S,">db/$ref.status.new") || &quit("opening db/$ref.status.new: $!");
767 "$s_severity\n") || &quit("writing db/$ref.status.new: $!");
768 close(S) || &quit("closing db/$ref.status.new: $!");
769 rename("db/$ref.status.new","db/$ref.status") ||
770 &quit("installing new db/$ref.status: $!");
778 &transcript("C> @_ ($state $lowstate $mergelowstate)\n");
783 &transcript("R> @_ ($state $lowstate $mergelowstate)\n");
787 print $_[0] if $debug;
804 local ($relpath,$description) = @_;
806 open(D,"$gDocDir/$relpath") || &quit("open doc file $relpath: $!");
807 while(<D>) { $doc.=$_; }
809 &transcript("Sending $description in separate message.\n");
810 &sendmailmessage(<<END.$doc,$replyto);
811 From: $gMaintainerEmail ($gProject $gBug Tracking System)
813 Subject: $gProject $gBug help: $description
814 References: $header{'message-id'}
815 In-Reply-To: $header{'message-id'}
816 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
823 local ($relpath,$description) = @_;
825 open(L,"lynx -nolist -dump http://$gWebDomain/$relpath 2>&1 |") || &quit("fork for lynx: $!");
826 while(<L>) { $doc.=$_; }
828 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
829 &transcript("Information ($description) is not available -\n".
830 "perhaps the $gBug does not exist or is not on the WWW yet.\n");
833 &transcript("Error getting $description (code $? $!):\n$doc\n");
835 &transcript("Sending $description.\n");
836 &sendmailmessage(<<END.$doc,$replyto);
837 From: $gMaintainerEmail ($gProject $gBug Tracking System)
839 Subject: $gProject $gBugs information: $description
840 References: $header{'message-id'}
841 In-Reply-To: $header{'message-id'}
842 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
851 $maintccreasons{$cca}{''}{$ref}= 1;
855 { # Data structure is:
856 # maintainer email address &c -> assoc of packages -> assoc of bug#'s
857 my ($p, $addmaint, $pshow);
858 &ensuremaintainersloaded;
859 $anymaintfound=0; $anymaintnotfound=0;
860 for $p (split(m/[ \t?,()]+/,$_[0]))
862 $pshow= ($p =~ m/[-+.a-z0-9]+/ ? $& : '');
863 if (defined($maintainerof{$p}))
864 { $addmaint= $maintainerof{$p};
865 &transcript("MR|$addmaint|$p|$ref|\n") if $dl>2;
866 $maintccreasons{$addmaint}{$p}{$ref}= 1;
867 print "maintainer add >$p|$addmaint<\n" if $debug;
868 } else { print "maintainer none >$p<\n" if $debug; }
872 sub ensuremaintainersloaded {
874 return if $maintainersloaded++;
875 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
879 m/^(\S+)\s+(\S.*\S)\n$/ || &quit("maintainers bogus \`$_'");
880 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
881 $maintainerof{$1}= $2;