2 # $Id: service.in,v 1.33 2001/03/18 05:17:07 doogie 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 if (defined $header{'resent-from'} && !defined $header{'from'}) {
58 $header{'from'} = $header{'resent-from'};
60 defined($header{'from'}) || &quit("no From header");
61 delete $header{'reply-to'} if ( defined($header{'reply-to'}) && $header{'reply-to'} =~ m/^\s*$/ );
62 if ( defined($header{'reply-to'}) && $header{'reply-to'} ne "" ) {
63 $replyto = $header{'reply-to'};
65 $replyto = $header{'from'};
68 $controlrequestaddr= $control ? "control\@$gEmailDomain" : "request\@$gEmailDomain";
70 &transcript("Processing commands for $controlrequestaddr:\n\n");
75 $mergelowstate= 'idle';
79 #strip blank line(s) after header
80 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
82 #strip, if exists, mime header
83 if ( $msg[$i] =~ /^This is a multi-part message in MIME format./ )
84 { while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; }
85 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
87 if ( $msg[$i] =~ /^--/ || $msg[$i] =~ /^\s*$/ )
88 { while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i]; $i++; }
89 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
93 for ($procline=$i; $procline<=$#msg; $procline++)
94 { $state eq 'idle' || print "$state ?\n";
95 $lowstate eq 'idle' || print "$lowstate ?\n";
96 $mergelowstate eq 'idle' || print "$mergelowstate ?\n";
97 $_= $msg[$procline]; s/\s+$//;
98 next unless m/\S/; next if m/^\s*\#/;
99 &transcript("> $_\n");
101 if (m/^stop/i || m/^quit/i || m/^--/ || m/^thank/i)
102 { &transcript("Stopping processing here.\n\n");
104 } elsif (m/^debug\s+(\d+)$/i && $1 >= 0 && $1 <= 1000) {
106 &transcript("Debug level $dl.\n\n");
107 } elsif (m/^(send|get)\s+\#?(\d{2,})$/i) {
109 &sendlynxdoc("$ref","logs for $gBug#$ref");
110 } elsif (m/^send-detail\s+\#?(\d+)$/i) {
111 $ref= $1+0; $reffile= $ref; $reffile =~ s,^..,$&/$&,;
112 &sendlynxdoc("db/$reffile-b.html","additional logs for $gBug#$ref");
113 } elsif (m/^index(\s+full)?$/i) {
114 &sendlynxdoc("db/ix/full.html",'full index');
115 } elsif (m/^index-summary\s+by-package$/i) {
116 &sendlynxdoc("db/ix/psummary.html",'summary index sorted by package/title');
117 } elsif (m/^index-summary(\s+by-number)?$/i) {
118 &sendlynxdoc("db/ix/summary.html",'summary index sorted by number/date');
119 } elsif (m/^index(\s+|-)pack(age)?s?$/i) {
120 &sendlynxdoc("db/ix/packages.html",'index of packages');
121 } elsif (m/^index(\s+|-)maints?$/i) {
122 &sendlynxdoc("db/ix/maintainers.html",'index of maintainers');
123 } elsif (m/^index(\s+|-)maint\s+(\S.*\S)$/i) {
124 $substrg= $2; $matches=0;
125 opendir(DBD,"$gWebDir/db/ma") || die $!;
126 while (defined($_=readdir(DBD))) {
127 next unless m/^l/ && m/\.html$/;
128 &transcript("F|$_\n") if $dl>1;
129 $filename= $_; s/^l//; s/\.html$//;
130 &transcript("P|$_\n") if $dl>2;
131 while (s/-(..)([^_])/-$1_-$2/) { }
132 &transcript("P|$_\n") if $dl>2;
133 s/^(.{0,2})_/$1-20_/g; while (s/([^-]..)_/$1-20_/) { };
134 &transcript("P|$_\n") if $dl>2;
135 s/^,(.*),(.*),([^,]+)$/$1-40_$2-20_-28_$3-29_/;
136 &transcript("P|$_\n") if $dl>2;
137 s/^([^,]+),(.*),(.*),$/$1-20_-3c_$2-40_$3-3e_/;
138 &transcript("P|$_\n") if $dl>2;
140 &transcript("P|$_\n") if $dl>2;
142 while (m/-(..)_/) { $out.= $`.sprintf("%c",hex($1)); $_=$'; }
144 &transcript("M|$out\n") if $dl>1;
145 next unless index(lc $out, lc $substrg)>=0;
146 &transcript("S|$filename\n") if $dl>0;
147 &transcript("S|$out\n") if $dl>0;
149 &sendlynxdocraw("db/ma/$filename","$gBug list for maintainer \`$out'");
152 &transcript("$gBug list(s) for $matches maintainer(s) sent.\n\n");
154 &transcript("No maintainers found containing \`$substrg'.\n".
155 "Use \`index-maint' to get list of maintainers.\n\n");
158 } elsif (m/^index(\s+|-)pack(age)?s?\s+(\S.*\S)$/i) {
159 $substrg= $+; $matches=0;
160 opendir(DBD,"$gWebDir/db/pa") || die $!;
161 while (defined($_=readdir(DBD))) {
162 next unless m/^l/ && m/\.html$/;
163 &transcript("F|$_\n") if $dl>1;
164 $filename= $_; s/^l//; s/\.html$//;
165 next unless index(lc $_, lc $substrg)>=0;
166 &transcript("S|$filename\n") if $dl>0;
167 &transcript("S|$out\n") if $dl>0;
169 &sendlynxdocraw("db/pa/$filename","$gBug list for package \`$_'");
172 &transcript("$gBug list(s) for $matches package(s) sent.\n\n");
174 &transcript("No packages found containing \`$substrg'.\n".
175 "Use \`index-packages' to get list of packages.\n\n");
178 } elsif (m/^send-unmatched(\s+this|\s+-?0)?$/i) {
179 &sendlynxdoc("db/ju/unmatched-1.html","junk (this week)");
180 } elsif (m/^send-unmatched\s+(last|-1)$/i) {
181 &sendlynxdoc("db/ju/unmatched-2.html","junk (last week)");
182 } elsif (m/^send-unmatched\s+(old|-2)$/i) {
183 &sendlynxdoc("db/ju/unmatched-3.html","junk (two weeks ago)");
184 } elsif (m/^getinfo\s+(\S+)$/i) {
186 if ($file =~ m/^\./ || $file !~ m/^[-.0-9a-z]+$/ || $file =~ m/\.gz$/) {
187 &transcript("Filename $file is badly formatted.\n\n");
188 } elsif (open(P,"$gDocDir/$file")) {
190 &transcript("Info file $file appears below.\n\n");
191 $extras.= "\n---------- Info file $file follows:\n\n";
192 while(<P>) { $extras.= $_; }
195 &transcript("Info file $file does not exist.\n\n");
197 } elsif (m/^help/i) {
201 } elsif (m/^refcard/i) {
202 &sendtxthelp("bug-mailserver-refcard.txt","mailservers' reference card");
203 } elsif (m/^subscribe/i) {
205 There is no $gProject $gBug mailing list. If you wish to review bug reports
206 please do so via http://$gWebDomain/ or ask this mailserver
208 soon: MAILINGLISTS_TEXT
210 } elsif (m/^unsubscribe/i) {
212 soon: UNSUBSCRIBE_TEXT
213 soon: MAILINGLISTS_TEXT
215 } elsif (!$control) {
217 Unknown command or malformed arguments to command.
218 (Use control\@$gEmailDomain to manipulate reports.)
221 if (++$unknowns >= 3) {
222 &transcript("Too many unknown commands, stopping here.\n\n");
225 } elsif (m/^close\s+\#?(\d+)$/i) {
229 if (length($s_done)) {
230 &transcript("$gBug is already closed, cannot re-close.\n\n");
233 $action= "$gBug closed, send any further explanations to $s_originator";
235 &addmaintainers($s_package);
236 if ( length( $gDoneList ) > 0 && length( $gListDomain ) >
237 0 ) { &addccaddress("$gDoneList\@$gListDomain"); }
240 From: $gMaintainerEmail ($gProject $gBug Tracking System)
242 Subject: $gBug#$ref acknowledged by developer
244 References: $header{'message-id'} $s_msgid
245 In-Reply-To: $s_msgid
246 Message-ID: <handler.$ref.$nn.notifdonectrl.$midix\@$gEmailDomain>
248 This is an automatic notification regarding your $gBug report
250 which was filed against the $s_package package.
252 It has been marked as closed by one of the developers, namely
255 You should be hearing from them with a substantive response shortly,
256 if you have not already done so. If not, please contact them
260 (administrator, $gProject $gBugs database)
263 &sendmailmessage($message,$s_originator);
264 } while (&getnextbug);
267 } elsif (m/^reassign\s+\#?(\d+)\s+(\S.*\S)$/i) {
269 $ref= $1; $newpackage= $2;
270 $newpackage =~ y/A-Z/a-z/;
272 if (length($s_package)) {
273 $action= "$gBug reassigned from package \`$s_package'".
274 " to \`$newpackage'.";
276 $action= "$gBug assigned to package \`$newpackage'.";
279 &addmaintainers($s_package);
280 &addmaintainers($newpackage);
281 $s_package= $newpackage;
282 } while (&getnextbug);
284 } elsif (m/^reopen\s+\#?(\d+)$/i ? ($noriginator='', 1) :
285 m/^reopen\s+\#?(\d+)\s+\=$/i ? ($noriginator='', 1) :
286 m/^reopen\s+\#?(\d+)\s+\!$/i ? ($noriginator=$replyto, 1) :
287 m/^reopen\s+\#?(\d+)\s+(\S.*\S)$/i ? ($noriginator=$2, 1) : 0) {
291 if (!length($s_done)) {
292 &transcript("$gBug is already open, cannot reopen.\n\n");
296 $noriginator eq '' ? "$gBug reopened, originator not changed." :
297 "$gBug reopened, originator set to $noriginator.";
299 &addmaintainers($s_package);
300 $s_originator= $noriginator eq '' ? $s_originator : $noriginator;
302 } while (&getnextbug);
305 } elsif (m/^forwarded\s+\#?(\d+)\s+(\S.*\S)$/i) {
307 $ref= $1; $whereto= $2;
309 if (length($s_forwarded)) {
310 $action= "Forwarded-to-address changed from $s_forwarded to $whereto.";
312 $action= "Noted your statement that $gBug has been forwarded to $whereto.";
314 if (length($s_done)) {
315 $extramessage= "(By the way, this $gBug is currently marked as done.)\n";
318 &addmaintainers($s_package);
319 if (length($gFowardList)>0 && length($gListDomain)>0 )
320 { &addccaddress("$gFowardList\@$gListDomain"); }
321 $s_forwarded= $whereto;
322 } while (&getnextbug);
324 } elsif (m/^notforwarded\s+\#?(\d+)$/i) {
328 if (!length($s_forwarded)) {
329 &transcript("$gBug is not marked as having been forwarded.\n\n");
332 $action= "Removed annotation that $gBug had been forwarded to $s_forwarded.";
334 &addmaintainers($s_package);
336 } while (&getnextbug);
339 } elsif (m/^severity\s+\#?(\d+)\s+([-0-9a-z]+)$/i ||
340 m/^priority\s+\#?(\d+)\s+([-0-9a-z]+)$/i) {
344 if (!grep($_ eq $newseverity, @gSeverityList, "$gDefaultSeverity")) {
345 &transcript("Severity level \`$newseverity' is not known.\n".
346 "Recognized are: $gShowSeverities.\n\n");
348 $printseverity= $s_severity;
349 $printseverity= "$gDefaultSeverity" if $printseverity eq '';
350 $action= "Severity set to \`$newseverity'.";
352 # if ( &newseverity eq 'fixed' && length( $gDoneList ) > 0 && length( $gListDomain ) > 0 ) {
353 # &addccaddress("$gDoneList\@$gListDomain");
355 &addmaintainers($s_package);
356 $s_severity= $newseverity;
357 } while (&getnextbug);
359 } elsif (m/^tags\s+\#?(\d+)\s+(([=+-])\s+)?(\S.*)?$/) {
361 $ref= $1; $addsubcode= $3; $tags= $4;
363 $addsub = "sub" if ($addsubcode eq "-");
364 $addsub = "add" if ($addsubcode eq "+");
365 $addsub = "set" if ($addsubcode eq "=");
368 foreach my $t (split /[\s,]+/, $tags) {
369 if (!grep($_ eq $t, @gTags)) {
376 &transcript("Unknown tag/s: ".join(', ', @badtags).".\n".
377 "Recognized are: ".join(' ', @gTags).".\n\n");
380 if ($addsub eq "set") {
381 $action= "Tags set to: " . join(", ", @okaytags);
382 } elsif ($addsub eq "add") {
383 $action= "Tags added: " . join(", ", @okaytags);
384 } elsif ($addsub eq "sub") {
385 $action= "Tags removed: " . join(", ", @okaytags);
388 &addmaintainers($s_package);
389 $s_keywords = '' if ($addsub eq "set");
390 if ($addsub eq "sub") {
391 foreach my $t (@badtags) {
392 $s_keywords = join ' ', grep $_ ne $t,
393 split ' ', $s_keywords;
396 foreach my $t (@okaytags) {
397 $s_keywords = join ' ', grep $_ ne $t,
398 split ' ', $s_keywords;
399 $s_keywords = "$t $s_keywords" unless($addsub eq "sub");
401 $s_keywords =~ s/\s*$//;
402 } while (&getnextbug);
404 } elsif (m/^retitle\s+\#?(\d+)\s+(\S.*\S)\s*$/i) {
406 $ref= $1; $newtitle= $2;
409 &addmaintainers($s_package);
410 $s_subject= $newtitle;
411 $action= "Changed $gBug title.";
413 &transcript("$action\n");
414 if (length($s_done)) {
415 &transcript("(By the way, that $gBug is currently marked as done.)\n");
421 } elsif (m/^unmerge\s+\#?(\d+)$/i) {
425 if (!length($s_mergedwith)) {
426 &transcript("$gBug is not marked as being merged with any others.\n\n");
429 $mergelowstate eq 'locked' || die "$mergelowstate ?";
430 $action= "Disconnected #$ref from all other report(s).";
431 @newmergelist= split(/ /,$s_mergedwith);
434 &addmaintainers($s_package);
435 $s_mergedwith= ($ref == $discref) ? ''
436 : join(' ',grep($_ ne $ref,@newmergelist));
437 } while (&getnextbug);
440 } elsif (m/^merge\s+(\d+(\s+\d+)+)\s*$/i) {
442 @tomerge= sort { $a <=> $b } split(/\s+/,$1);
446 while (defined($ref= shift(@tomerge))) {
447 &transcript("D| checking merge $ref\n") if $dl;
449 next if grep($_ eq $ref,@newmergelist);
450 if (!&getbug) { ¬foundbug; @newmergelist=(); last }
452 &transcript("D| adding $ref ($s_mergedwith)\n") if $dl;
454 &checkmatch('package','m_package',$s_package);
455 &checkmatch('forwarded addr','m_forwarded',$s_forwarded);
456 $s_severity = '$gDefaultSeverity' if $s_severity eq '';
457 &checkmatch('severity','m_severity',$s_severity);
458 &checkmatch('done mark','m_done',length($s_done) ? 'done' : 'open');
459 foreach my $t (split /\s+/, $s_keywords) { $tags{$t} = 1; }
460 if (length($mismatch)) {
461 &transcript("Mismatch - only $gBugs in same state can be merged:\n".
463 &cancelbug; @newmergelist=(); last;
465 push(@newmergelist,$ref);
466 push(@tomerge,split(/ /,$s_mergedwith));
470 @newmergelist= sort { $a <=> $b } @newmergelist;
471 $action= "Merged @newmergelist.";
472 for $ref (@newmergelist) {
473 &getbug || die "huh ? $gBug $ref disappeared during merge";
474 &addmaintainers($s_package);
475 $s_mergedwith= join(' ',grep($_ ne $ref,@newmergelist));
476 $s_keywords= join(' ', keys %tags);
479 &transcript("$action\n\n");
483 &transcript("Unknown command or malformed arguments to command.\n\n");
484 if (++$unknowns >= 5) {
485 &transcript("Too many unknown commands, stopping here.\n\n");
490 if ($procline>$#msg) {
491 &transcript(">\nEnd of message, stopping processing here.\n\n");
494 &transcript("No commands successfully parsed; sending the help text(s).\n");
499 &transcript("MC\n") if $dl>1;
501 for $maint (keys %maintccreasons) {
502 &transcript("MM|$maint|\n") if $dl>1;
503 next if $maint eq $replyto;
505 $reasonsref= $maintccreasons{$maint};
506 &transcript("MY|$maint|\n") if $dl>2;
507 for $p (sort keys %$reasonsref) {
508 &transcript("MP|$p|\n") if $dl>2;
509 $reasonstring.= ', ' if length($reasonstring);
510 $reasonstring.= $p.' ' if length($p);
511 $reasonstring.= join(' ',map("#$_",sort keys %{$$reasonsref{$p}}));
513 $reasonstring = "" if (!defined($reasonstring));
514 push(@maintccs,"$maint ($reasonstring)");
515 push(@maintccaddrs,"$maint");
518 &transcript("MC|@maintccs|\n") if $dl>2;
519 $maintccs= "Cc: ".join(",\n ",@maintccs)."\n";
520 } else { $maintccs = ""; }
522 if (!defined $header{'subject'} || $header{'subject'} eq "") {
523 $header{'subject'} = "your mail";
527 From: $gMaintainerEmail ($gProject $gBug Tracking System)
529 ${maintccs}Subject: Processed: $header{'subject'}
530 In-Reply-To: $header{'message-id'}
531 References: $header{'message-id'}
532 Message-ID: <handler.s.$nn.transcript\@$gEmailDomain>
534 ${transcript}Please contact me if you need assistance.
537 (administrator, $gProject $gBugs database)
541 $repliedshow= join(', ',$replyto,@maintccaddrs);
542 &filelock("lock/-1");
543 open(AP,">>db/-1.log") || &quit("open db/-1.log: $!");
545 "\2\n$repliedshow\n\5\n$reply\n\3\n".
547 "<strong>Request received</strong> from <code>".
548 &sani($header{'from'})."</code>\n".
549 "to <code>".&sani($controlrequestaddr)."</code>\n".
551 "\7\n",@log,"\n\3\n") || &quit("writing db/-1.log: $!");
552 close(AP) || &quit("open db/-1.log: $!");
554 utime(time,time,"db");
556 &sendmailmessage($reply,$replyto,@maintccaddrs);
558 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
562 map { $_->address() }
563 map { Mail::Address->parse($_) } @_;
566 sub sendmailmessage {
567 local ($message,@recips) = @_;
568 print "mailing to >@recips<\n" if $debug;
570 defined($c) || &quit("mailing forking for sendmail: $!");
571 if (!$c) { # ie, we are the child process
572 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odi','-oem','-oi',get_addresses(@recips);
575 print(D $message) || &quit("writing to sendmail process: $!");
576 $!=0; close(D); $? && &quit("sendmail gave exit status $? ($!)");
581 &sendtxthelpraw("bug-log-mailserver.txt","instructions for request\@$gEmailDomain");
582 &sendtxthelpraw("bug-maint-mailcontrol.txt","instructions for control\@$gEmailDomain")
587 # &transcript("Sorry, command $_[0] not yet implemented.\n\n");
591 local ($string,$mvarname,$svarvalue) = @_;
594 eval "\$mvarvalue= \$$mvarname";
595 &transcript("D| checkmatch \`$string' /$mvarname/$mvarvalue/$svarvalue/\n")
598 "Values for \`$string' don't match:\n".
599 " #$newmergelist[0] has \`$mvarvalue';\n".
600 " #$ref has \`$svarvalue'\n"
601 if $mvarvalue ne $svarvalue;
603 &transcript("D| setupmatch \`$string' /$mvarname/$svarvalue/\n")
605 eval "\$$mvarname= \$svarvalue";
609 # High-level bug manipulation calls
610 # Do announcements themselves
612 # Possible calling sequences:
616 # &transcript(something)
620 # $action= (something)
622 # (modify s_* variables)
623 # } while (getnextbug);
626 &dlen("nochangebug");
627 $state eq 'single' || $state eq 'multiple' || die "$state ?";
629 &endmerge if $manybugs;
631 &dlex("nochangebug");
635 &dlen("setbug $ref");
636 $state eq 'idle' || die "$state ?";
639 &dlex("setbug => 0s");
642 @thisbugmergelist= split(/ /,$s_mergedwith);
643 if (!@thisbugmergelist) {
648 &dlex("setbug => 1s");
657 &dlex("setbug => 0mc");
661 $state= 'multiple'; $sref=$ref;
662 &dlex("setbug => 1m");
668 $state eq 'single' || $state eq 'multiple' || die "$state ?";
670 if (!$manybugs || !@thisbugmergelist) {
671 length($action) || die;
672 &transcript("$action\n$extramessage\n");
673 &endmerge if $manybugs;
675 &dlex("getnextbug => 0");
678 $ref= shift(@thisbugmergelist);
679 &getbug || die "bug $ref disappeared";
681 &dlex("getnextbug => 1");
685 # Low-level bug-manipulation calls
686 # Do no announcements
694 # $action= (something)
699 # [getbug (returns 0)]
700 # &transcript("$action\n\n")
703 sub notfoundbug { &transcript("$gBug number $ref not found.\n\n"); }
704 sub foundbug { &transcript("$gBug#$ref: $s_subject\n"); }
708 $mergelowstate eq 'idle' || die "$mergelowstate ?";
709 &filelock('lock/merge');
710 $mergelowstate='locked';
716 $mergelowstate eq 'locked' || die "$mergelowstate ?";
718 $mergelowstate='idle';
723 &dlen("getbug $ref");
724 $lowstate eq 'idle' || die "$state ?";
725 if (&lockreadbug($ref)) {
728 &dlex("getbug => 1");
733 &dlex("getbug => 0");
739 $lowstate eq 'open' || die "$state ?";
746 &dlen("savebug $ref");
747 $lowstate eq 'open' || die "$lowstate ?";
748 length($action) || die;
749 $ref == $sref || die "read $sref but saving $ref ?";
750 open(L,">>db/$ref.log") || &quit("opening db/$ref.log: $!");
753 "<strong>".&sani($action)."</strong>\n".
754 "Request was from <code>".&sani($header{'from'})."</code>\n".
755 "to <code>".&sani($controlrequestaddr)."</code>. \n".
757 "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log: $!");
758 close(L) || &quit("closing db/$ref.log: $!");
759 open(S,">db/$ref.status.new") || &quit("opening db/$ref.status.new: $!");
770 "$s_severity\n") || &quit("writing db/$ref.status.new: $!");
771 close(S) || &quit("closing db/$ref.status.new: $!");
772 rename("db/$ref.status.new","db/$ref.status") ||
773 &quit("installing new db/$ref.status: $!");
781 &transcript("C> @_ ($state $lowstate $mergelowstate)\n");
786 &transcript("R> @_ ($state $lowstate $mergelowstate)\n");
790 print $_[0] if $debug;
807 local ($relpath,$description) = @_;
809 open(D,"$gDocDir/$relpath") || &quit("open doc file $relpath: $!");
810 while(<D>) { $doc.=$_; }
812 &transcript("Sending $description in separate message.\n");
813 &sendmailmessage(<<END.$doc,$replyto);
814 From: $gMaintainerEmail ($gProject $gBug Tracking System)
816 Subject: $gProject $gBug help: $description
817 References: $header{'message-id'}
818 In-Reply-To: $header{'message-id'}
819 Message-ID: <handler.s.$nn.help.$midix\@$gEmailDomain>
826 local ($relpath,$description) = @_;
827 # check for crap in $relpath
828 if ($relpath =~ m/^\./ || $relpath !~ m/^[\d\w-+.@]+$/) {
829 &transcript("Invalid request $relpath!\n");
833 open(L,"lynx -nolist -dump http://$gWebDomain/$relpath 2>&1 |") || &quit("fork for lynx: $!");
834 while(<L>) { $doc.=$_; }
836 if ($? == 255 && $doc =~ m/^\n*lynx: Can\'t access start file/) {
837 &transcript("Information ($description) is not available -\n".
838 "perhaps the $gBug does not exist or is not on the WWW yet.\n");
841 &transcript("Error getting $description (code $? $!):\n$doc\n");
843 &transcript("Sending $description.\n");
844 &sendmailmessage(<<END.$doc,$replyto);
845 From: $gMaintainerEmail ($gProject $gBug Tracking System)
847 Subject: $gProject $gBugs information: $description
848 References: $header{'message-id'}
849 In-Reply-To: $header{'message-id'}
850 Message-ID: <handler.s.$nn.info.$midix\@$gEmailDomain>
859 $maintccreasons{$cca}{''}{$ref}= 1;
863 { # Data structure is:
864 # maintainer email address &c -> assoc of packages -> assoc of bug#'s
865 my ($p, $addmaint, $pshow);
866 &ensuremaintainersloaded;
867 $anymaintfound=0; $anymaintnotfound=0;
868 for $p (split(m/[ \t?,()]+/,$_[0]))
870 $pshow= ($p =~ m/[-+.a-z0-9]+/ ? $& : '');
871 if (defined($maintainerof{$p}))
872 { $addmaint= $maintainerof{$p};
873 &transcript("MR|$addmaint|$p|$ref|\n") if $dl>2;
874 $maintccreasons{$addmaint}{$p}{$ref}= 1;
875 print "maintainer add >$p|$addmaint<\n" if $debug;
876 } else { print "maintainer none >$p<\n" if $debug; }
880 sub ensuremaintainersloaded {
882 return if $maintainersloaded++;
883 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
887 m/^(\S+)\s+(\S.*\S)\n$/ || &quit("maintainers bogus \`$_'");
888 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
889 $maintainerof{$1}= $2;