2 # $Id: process.in,v 1.16 2000/10/07 17:27:13 joy Exp $
8 require( '/etc/debbugs/config' );
9 require( '/usr/lib/debbugs/errorlib' );
10 chdir( "$gSpoolDir" ) || die 'chdir spool: $!\n';
12 #open(DEBUG,"> /tmp/debbugs.debug");
14 defined( $intdate= time ) || &quit( "failed to get time: $!" );
17 m/^([BMQFDU])(\d*)\.\d+$/ || &quit("bad argument");
19 $tryref= length($2) ? $2+0 : -1;
22 if (!rename("incoming/G$nn","incoming/P$nn"))
23 { $_=$!.''; m/no such file or directory/i && exit 0;
24 &quit("renaming to lock: $!");
27 $baddress= 'bugs' if $codeletter eq 'B';
28 $baddress= 'maintonly' if $codeletter eq 'M';
29 $baddress= 'quiet' if $codeletter eq 'Q';
30 $baddress= 'forwarded' if $codeletter eq 'F';
31 $baddress= 'done' if $codeletter eq 'D';
32 $baddress= 'submitter' if $codeletter eq 'U';
33 $baddress || &quit("bad codeletter $codeletter");
34 $baddressroot= $baddress;
35 $baddress= "$tryref-$baddress" if $tryref>=0;
37 open(M,"incoming/P$nn");
44 print DEBUG "###\n",join("##\n",@msg),"\n###\n";
46 chop($tdate= `date -u '+%a, %d %h %Y %T GMT'`);
48 X-Loop: $gMaintainerEmail
49 Received: via spool by $baddress\@$gEmailDomain id=$nn
50 (code $codeletter ref $tryref); $tdate
53 # Process the message's mail headers
54 for ($i=0; $i<=$#msg; $i++) {
56 last unless length($_);
57 &quit("looping detected") if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
58 $ins= !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i
59 && !m/^From / && !m/^X-Debbugs-CC:/i && !m/^received:/i;
60 $fwd .= $_."\n" if $ins;
61 while ($msg[$i+1] =~ m/^\s/) {
63 $fwd .= $msg[$i]."\n" if $ins;
66 # print DEBUG ">$_<\n";
68 $v= $1; $v =~ y/A-Z/a-z/;
69 print DEBUG ">$v=$_<\n";
72 print DEBUG "!>$_<\n";
77 while ($i <= $#msg && !length($msg[$i])) { $fwd .= "\n"; $i++; }
79 #skips the "this is mime" message and any blank space after it
80 if ( $msg[$i] =~ /^This is a multi-part message in MIME format./ )
82 while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; }
83 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
85 #if the lines starts with -- or is nothing but blank space...
86 #skip to the next blank line(s) then skip past the blank line(s)
87 if ( $msg[$i] =~ /^--/ || $msg[$i] =~ /^\s*$/ )
89 while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; }
90 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
93 while (defined ($msg[$i] ) )
95 last if ( $msg[$i] !~ m/^([\w]+):\s*(\S+)(.*)/ );
98 print DEBUG ">$fn|$'|\n";
99 $fwd .= $fn.': '.$fv."\n";
103 $pfullheader{$fn}= $2.$3;
104 print DEBUG ">$fn~$fv<\n";
108 $fwd .= join("\n",@msg[$i..$#msg]);
110 print DEBUG "***\n$fwd\n***\n";
112 defined($header{'from'}) || &quit("no From header");
113 $replyto= defined($header{'reply-to'}) ? $header{'reply-to'} : $header{'from'};
116 $_= "$2 <$1>" if m/^([^\<\> \t\n\(\)]+) \(([^\(\)\<\>]+)\)$/;
118 print DEBUG "replytocompare >$replytocompare<\n";
120 if (!defined($header{'subject'}))
121 { $brokenness.= <<END;
123 Your message did not contain a Subject field. This is broken, I am
124 afraid - the Subject: line is a Required Header according to RFC822.
125 Please remember to include a Subject field in your messages in future.
126 If you did so the fact that it got lost probably indicates a poorly
127 configured mail system at your site or an intervening one.
129 $subject= '(no subject)';
130 } else { $subject= $header{'subject'}; }
133 $subject =~ s/^Re:\s*//i; $_= $subject."\n";
134 if ($tryref < 0 && m/^Bug ?\#(\d+)\D/i) { $tryref= $1+0; }
137 { $bfound= &lockreadbugmerge($tryref);
138 if ($bfound) { $ref= $tryref; }
140 { &htmllog("Reply","sent", $replyto,"Unknown problem report number <code>$tryref</code>.");
141 &sendmessage(<<END, '');
142 From: $gMaintainerEmail ($gProject $gBug Tracking System)
144 Subject: Unknown problem report $gBug#$tryref ($subject)
145 Message-ID: <handler.x.$nn.unknown\@$gEmailDomain>
146 In-Reply-To: $header{'message-id'}
147 References: $header{'message-id'} $s_msgid
148 X-$gProject-PR-Message: error
150 You sent a message to the $gBug tracking system which gave (in the
151 Subject line or encoded into the recipient at $gEmailDomain),
152 the number of a nonexistent $gBug report (#$tryref).
154 This may be because that $gBug report has been resolved for more than $gRemoveAge
155 days, and the record of it has been expunged, or because you mistyped
156 the $gBug report number.
158 Your message was dated $header{'date'} and was sent to
159 $baddress\@$gEmailDomain. It had
160 Message-ID $header{'message-id'}
161 and Subject $subject.
163 It has been filed (under junk) but otherwise ignored.
165 Please consult your records to find the correct $gBug report number, or
166 contact me, the system administrator, for assistance.
169 (administrator, $gProject $gBugs database)
171 (NB: If you are a system administrator and have no idea what I am
172 talking about this indicates a serious mail system misconfiguration
173 somewhere. Please contact me immediately.)
179 } else { &filelock('lock/-1'); }
181 if ($codeletter eq 'D' || $codeletter eq 'F')
182 { if ($replyto =~ m/$gBounceFroms/o ||
183 $header{'from'} =~ m/$gBounceFroms/o)
184 { &quit("bounce detected ! Mwaap! Mwaap!"); }
185 $markedby= $header{'from'} eq $replyto ? $replyto :
186 "$header{'from'} (reply to $replyto)";
187 if ($codeletter eq 'F')
188 { (&appendlog,&finish) if length($s_forwarded);
189 $receivedat= "forwarded\@$gEmailDomain";
190 $markaswhat= 'forwarded';
191 $set_forwarded= $header{'to'};
192 if ( length( $gListDomain ) > 0 && length( $gFowardList ) > 0 )
193 { $generalcc= "$gFowardList\@$gListDomain"; }
194 else { $generalcc=''; }
196 { (&appendlog,&finish) if length($s_done);
197 $receivedat= "done\@$gEmailDomain";
199 $set_done= $header{'from'};
200 if ( length( $gListDomain ) > 0 && length( $gDoneList ) > 0 )
201 { $generalcc= "$gDoneList\@$gListDomain"; }
202 else { $generalcc=''; }
205 { &htmllog("Warning","sent",$replyto,"Message ignored.");
206 &sendmessage(<<END, '');
207 From: $gMaintainerEmail ($gProject $gBug Tracking System)
209 Subject: Message with no $gBug number ignored by $receivedat
211 Message-ID: <header.x.$nn.warnignore\@$gEmailDomain>
212 In-Reply-To: $header{'message-id'}
213 References: $header{'message-id'} $s_msgid
214 X-$gProject-PR-Message: error
216 You sent a message to the $gProject $gBug tracking system old-style
217 unified mark as $markaswhat address ($receivedat),
218 without a recognisable $gBug number in the Subject.
219 Your message has been filed under junk but otherwise ignored.
221 If you don't know what I'm talking about then probably either:
223 (a) you unwittingly sent a message to done\@$gEmailDomain
224 because you replied to all recipients of the message a developer used
225 to mark a $gBug as done and you modified the Subject. In this case,
226 please do not be alarmed. To avoid confusion do not do it again, but
227 there is no need to apologise or mail anyone asking for an explanation.
229 (b) you are a system administrator, reading this because the $gBug
230 tracking system is responding to a misdirected bounce message. In this
231 case there is a serious mail system misconfiguration somewhere - please
232 contact me immediately.
234 Your message was dated $header{'date'} and had
235 message-id $header{'message-id'}
236 and subject $subject.
238 If you need any assistance or explanation please contact me.
241 (administrator, $gProject $gBugs database)
248 $noticeccval.= join(', ', grep($_ ne $replyto,@maintaddrs));
249 $noticeccval =~ s/\s+\n\s+/ /g; $noticeccval =~ s/^\s+/ /; $noticeccval =~ s/\s+$//;
250 if (length($noticeccval)) { $noticecc= "Cc: $noticeccval\n"; }
251 if (length($generalcc)) { $noticecc.= "Bcc: $generalcc\n"; }
252 @process= ($ref,split(/ /,$s_mergedwith));
255 { if ($ref != $orgref)
257 &lockreadbug($ref) || die "huh ? $ref from $orgref out of @process";
259 $s_done= $set_done if defined($set_done);
260 $s_forwarded= $set_forwarded if defined($set_forwarded);
261 &overwrite("db/$ref.status",
262 "$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
263 "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
264 open(O,"db/$ref.report") || &quit("read original report: $!");
265 $x= join('',<O>); close(O);
266 if ($codeletter eq 'F')
267 { &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded.");
268 &sendmessage(<<END, '');
269 From: $gMaintainerEmail ($gProject $gBug Tracking System)
271 ${noticecc}Subject: $gBug#$ref: marked as forwarded ($s_subject)
272 Message-ID: <header.$ref.$nn.ackfwdd\@$gEmailDomain>
273 In-Reply-To: $header{'message-id'}
274 References: $header{'message-id'} $s_msgid
275 X-$gProject-PR-Message: forwarded $ref
277 Your message dated $header{'date'}
278 with message-id $header{'message-id'}
279 and subject line $subject
280 has caused the $gProject $gBug report #$ref,
282 to be marked as having been forwarded to the upstream software
283 author(s) $s_forwarded.
285 (NB: If you are a system administrator and have no idea what I am
286 talking about this indicates a serious mail system misconfiguration
287 somewhere. Please contact me immediately.)
290 (administrator, $gProject $gBugs database)
294 { &htmllog("Reply","sent",$replyto,"You have taken responsibility.");
295 &sendmessage(<<END."--------------------------------------\n".$x."---------------------------------------\n".join( "\n", @msg ), '');
296 From: $gMaintainerEmail ($gProject $gBug Tracking System)
298 ${noticecc}Subject: $gBug#$ref: marked as done ($s_subject)
299 Message-ID: <handler.$ref.$nn.ackdone\@$gEmailDomain>
300 In-Reply-To: $header{'message-id'}
301 References: $header{'message-id'} $s_msgid
302 X-$gProject-PR-Message: closed $ref
304 Your message dated $header{'date'}
305 with message-id $header{'message-id'}
306 and subject line $subject
307 has caused the attached $gBug report to be marked as done.
309 This means that you claim that the problem has been dealt with.
310 If this is not the case it is now your responsibility to reopen the
311 $gBug report if necessary, and/or fix the problem forthwith.
313 (NB: If you are a system administrator and have no idea what I am
314 talking about this indicates a serious mail system misconfiguration
315 somewhere. Please contact me immediately.)
318 (administrator, $gProject $gBugs database)
321 &htmllog("Notification","sent",$s_originator,
322 "$gBug acknowledged by developer.");
323 &sendmessage(<<END.join("\n",@msg),'');
324 From: $gMaintainerEmail ($gProject $gBug Tracking System)
326 Subject: $gBug#$ref acknowledged by developer ($s_subject)
327 Message-ID: <handler.$ref.$nn.notifdone\@$gEmailDomain>
328 In-Reply-To: $s_msgid
329 References: $header{'message-id'} $s_msgid
330 X-$gProject-PR-Message: they-closed $ref
332 This is an automatic notification regarding your $gBug report.
334 It has been closed by one of the developers, namely
337 Their explanation is attached below. If this explanation is
338 unsatisfactory and you have not received a better one in a separate
339 message then please contact the developer directly, or email
340 $ref\@$gEmailDomain or me.
343 (administrator, $gProject $gBugs database)
353 { if ($codeletter eq 'U')
354 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
355 &sendmessage(<<END, '');
356 From: $gMaintainerEmail ($gProject $gBug Tracking System)
358 Subject: Message with no $gBug number cannot be sent to submitter !
360 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
361 In-Reply-To: $header{'message-id'}
362 References: $header{'message-id'} $s_msgid
363 X-$gProject-PR-Message: error
365 You sent a message to the $gProject $gBug tracking system send to $gBug
366 report submitter address $baddress\@$gEmailDomain, without a
367 recognisable $gBug number in the Subject. Your message has been filed
368 under junk but otherwise ignored.
370 If you don't know what I'm talking about then probably either:
372 (a) you unwittingly sent a message to $baddress\@$gEmailDomain
373 because you replied to all recipients of the message a developer sent
374 to a $gBug's submitter and you modified the Subject. In this case,
375 please do not be alarmed. To avoid confusion do not do it again, but
376 there is no need to apologise or mail anyone asking for an
379 (b) you are a system administrator, reading this because the $gBug
380 tracking system is responding to a misdirected bounce message. In this
381 case there is a serious mail system misconfiguration somewhere - please
382 contact me immediately.
384 Your message was dated $header{'date'} and had
385 message-id $header{'message-id'}
386 and subject $subject.
388 If you need any assistance or explanation please contact me.
391 (administrator, $gProject $gBugs database)
397 if (!defined($pheader{'package'}))
398 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
399 &sendmessage(<<END, '');
400 From: $gMaintainerEmail ($gProject $gBug Tracking System)
402 Subject: Message with no Package: tag cannot be processed!
404 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
405 In-Reply-To: $header{'message-id'}
406 References: $header{'message-id'} $s_msgid
407 X-$gProject-PR-Message: error
409 Your message didn't have a Package: line at the start (in the
410 pseudo-header following the real mail header), or didn't have a
411 pseudo-header at all.
413 This makes it much harder for us to categorise and deal with your
414 problem report. Please resubmit your report and tell us which package the
415 report is on. For help, check out http://$gWebDomain/Reporting.html.
417 Your message was dated $header{'date'} and had
418 message-id $header{'message-id'}
419 and subject $subject.
421 If you need any assistance or explanation please contact me.
424 (administrator, $gProject $gBugs database)
429 } else { $s_package= $pheader{'package'}; }
430 if (defined($pheader{'keywords'})) {
431 $s_keywords= $pfullheader{'keywords'};
434 if (defined($pheader{'severity'}) || defined($pheader{'priority'}))
435 { $s_severity= $pheader{'severity'};
436 $s_severity= $pheader{'priority'} unless ($s_severity);
438 if (!grep($_ eq $s_severity, @severities, "$gDefaultSeverity")) {
441 Your message specified a Severity: in the pseudo-header, but
442 the severity value $s_severity was not recognised.
443 The default severity $gDefaultSeverity is being used instead.
444 The recognised values are: @gSeverityList.
449 &filelock("nextnumber.lock");
450 open(N,"nextnumber") || &quit("nextnumber: read: $!");
451 $v=<N>; $v =~ s/\n$// || &quit("nextnumber bad format");
452 $ref= $v+0; $v += 1; $newref=1;
453 &overwrite('nextnumber', "$v\n");
455 &overwrite("db/$ref.log",'');
456 &overwrite("db/$ref.status",
457 "$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
458 "$s_package\n$s_keywords\n\n\n\n$s_severity\n");
459 &overwrite("db/$ref.report",
460 join("\n",@msg)."\n");
465 print DEBUG "maintainers >@maintaddrs<\n";
467 $orgsender= defined($header{'sender'}) ? "Orignal-Sender: $header{'sender'}\n" : '';
468 $newsubject= $subject; $newsubject =~ s/^$gBug#$ref\W*\s*//;
470 $xcchdr= $header{ 'x-debbugs-cc' };
471 if ($xcchdr =~ m/\S/) {
472 push(@resentccs,$xcchdr);
473 $resentccexplain.= <<END;
475 As you requested using X-Debbugs-CC, your message was also forwarded to
477 (after having been given a $gBug report number, if it did not have one).
481 if (@maintaddrs && ($codeletter eq 'B' || $codeletter eq 'M')) {
482 push(@resentccs,@maintaddrs);
483 $resentccexplain.= <<END." ".join("\n ",@maintaddrs)."\n";
485 Your message has been sent to the package maintainer(s):
489 $veryquiet= $codeletter eq 'Q';
490 if ($codeletter eq 'M' && !@maintaddrs) {
494 You requested that the message be sent to the package maintainer(s)
495 but either the $gBug report is not associated with any package (probably
496 because of a missing Package pseudo-header field in the original $gBug
497 report), or the package(s) specified do not have any maintainer(s).
499 Your message has *not* been sent to any package maintainers; it has
500 merely been filed in the $gBug tracking system. If you require assistance
501 please contact $gMaintainerEmail quoting the $gBug number $ref.
505 $resentccval.= join(', ',@resentccs);
506 $resentccval =~ s/\s+\n\s+/ /g; $resentccval =~ s/^\s+/ /; $resentccval =~ s/\s+$//;
507 if (length($resentccval)) { $resentcc= "Resent-CC: $resentccval\n"; }
509 if ($codeletter eq 'U') {
510 &htmllog("Message", "sent on", $s_originator, "$gBug#$ref.");
511 &sendmessage(<<END,$s_originator,@resentccs);
512 Subject: $gBug#$ref: $newsubject
513 Reply-To: $replyto, $ref-quiet\@$gEmailDomain
514 ${orgsender}Resent-To: $s_originator
515 ${resentcc}Resent-Date: $tdate
516 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
517 Resent-Sender: $gMaintainerEmail
518 X-$gProject-PR-Message: report $ref
519 X-$gProject-PR-Package: $s_package
520 X-$gProject-PR-Keywords: $s_keywords
523 } elsif ($codeletter eq 'B') {
524 &htmllog($newref ? "Report" : "Information", "forwarded",
525 join(', ',"$gSubmitList\@$gListDomain",@resentccs),
526 "<code>$gBug#$ref</code>".
527 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
528 (length($s_keywords)? "; Keywords <code>".&sani($s_keywords)."</code>":'').
530 &sendmessage(<<END,"$gSubmitList\@$gListDomain",@resentccs);
531 Subject: $gBug#$ref: $newsubject
532 Reply-To: $replyto, $ref\@$gEmailDomain
533 Resent-From: $header{'from'}
534 ${orgsender}Resent-To: $gSubmitList\@$gListDomain
535 ${resentcc}Resent-Date: $tdate
536 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
537 Resent-Sender: $gMaintainerEmail
538 X-$gProject-PR-Message: report $ref
539 X-$gProject-PR-Package: $s_package
540 X-$gProject-PR-Keywords: $s_keywords
543 } elsif (@resentccs) {
544 # D and F done far earlier; B just done - so this must be M or Q
545 # We preserve whichever it was in the Reply-To (possibly adding
547 &htmllog($newref ? "Report" : "Information", "forwarded",
549 "<code>$gBug#$ref</code>".
550 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
551 (length($s_keywords)? "; Keywords <code>".&sani($s_keywords)."</code>":'').
553 &sendmessage(<<END,@resentccs);
554 Subject: $gBug#$ref: $newsubject
555 Reply-To: $replyto, $ref-$baddressroot\@$gEmailDomain
556 Resent-From: $header{'from'}
557 ${orgsender}Resent-To: $resentccval
559 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
560 Resent-Sender: $gMaintainerEmail
561 X-$gProject-PR-Message: report $ref
562 X-$gProject-PR-Package: $s_package
563 X-$gProject-PR-Keywords: $s_keywords
568 $htmlbreak= length($brokenness) ? "<p>\n".&sani($brokenness)."\n<p>\n" : '';
569 $htmlbreak =~ s/\n\n/\n<P>\n\n/g;
570 if (length($resentccval)) {
572 " Copy sent to <code>".&sani($resentccval)."</code>.".
576 &htmllog("Acknowledgement","sent",$replyto,
578 "New $gBug report received and filed, but not forwarded." :
579 "New $gBug report received and forwarded."). $htmlbreak);
580 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
581 From: $gMaintainerEmail ($gProject $gBug Tracking System)
583 Subject: $gBug#$ref: Acknowledgement of QUIET report
585 Message-ID: <handler.$ref.$nn.ackquiet\@$gEmailDomain>
586 In-Reply-To: $header{'message-id'}
587 References: $header{'message-id'}
588 X-$gProject-PR-Message: ack-quiet $ref
590 Thank you for the problem report you have sent regarding $gProject.
591 This is an automatically generated reply, to let you know your message
592 has been received. It has not been forwarded to the developers or
593 their mailing list; you should ensure that the developers are aware of
594 the problem you have entered into the system - preferably quoting the
595 $gBug reference number, #$ref.
597 If you wish to submit further information on your problem, please send it
598 to $ref-$baddressroot\@$gEmailDomain (and *not*
599 to $baddress\@$gEmailDomain).
601 Please do not reply to the address at the top of this message,
602 unless you wish to report a problem with the $gBug-tracking system.
605 (administrator, $gProject $gBugs database)
607 From: $gMaintainerEmail ($gProject $gBug Tracking System)
609 Subject: $gBug#$ref: Acknowledgement of maintainer-only report
611 Message-ID: <handler.$ref.$nn.ackmaint\@$gEmailDomain>
612 In-Reply-To: $header{'message-id'}
613 References: $header{'message-id'}
614 X-$gProject-PR-Message: ack-maintonly $ref
616 Thank you for the problem report you have sent regarding $gProject.
617 This is an automatically generated reply, to let you know your message has
618 been received. It is being forwarded to the developers (but not the mailing
619 list, as you requested) for their attention; they will reply in due course.
621 If you wish to submit further information on your problem, please send
622 it to $ref-$baddressroot\@$gEmailDomain (and *not*
623 to $baddress\@$gEmailDomain).
625 Please do not reply to the address at the top of this message,
626 unless you wish to report a problem with the $gBug-tracking system.
629 (administrator, $gProject $gBugs database)
631 From: $gMaintainerEmail ($gProject $gBug Tracking System)
633 Subject: $gBug#$ref: Acknowledgement ($subject)
634 Message-ID: <handler.$ref.$nn.ack\@$gEmailDomain>
635 In-Reply-To: $header{'message-id'}
636 References: $header{'message-id'}
637 X-$gProject-PR-Message: ack $ref
639 Thank you for the problem report you have sent regarding $gProject.
640 This is an automatically generated reply, to let you know your message has
641 been received. It is being forwarded to the developers mailing list for
642 their attention; they will reply in due course.
644 If you wish to submit further information on your problem, please send
645 it to $ref\@$gEmailDomain (and *not* to
646 $baddress\@$gEmailDomain).
648 Please do not reply to the address at the top of this message,
649 unless you wish to report a problem with the $gBug-tracking system.
652 (administrator, $gProject $gBugs database)
654 } elsif ($codeletter ne 'U') {
655 &htmllog("Acknowledgement","sent",$replyto,
656 ($veryquiet ? "Extra info received and filed, but not forwarded." :
657 $codeletter eq 'M' ? "Extra info received and forwarded to maintainer." :
658 "Extra info received and forwarded to list."). $htmlbreak);
659 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
660 From: $gMaintainerEmail ($gProject $gBug Tracking System)
662 Subject: $gBug#$ref: Info received and FILED only
664 Message-ID: <handler.$ref.$nn.ackinfoquiet\@$gEmailDomain>
665 In-Reply-To: $header{'message-id'}
666 References: $header{'message-id'}
667 X-$gProject-PR-Message: ack-info-quiet $ref
669 Thank you for the additional information you have supplied regarding
670 this problem report. It has NOT been forwarded to the developers, but
671 will accompany the original report in the $gBug tracking system. Please
672 ensure that you yourself have sent a copy of the additional
673 information to any relevant developers or mailing lists.
675 If you wish to continue to submit further information on your problem,
676 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
678 Please do not reply to the address at the top of this message,
679 unless you wish to report a problem with the $gBug-tracking system.
682 (administrator, $gProject $gBugs database)
684 From: $gMaintainerEmail ($gProject $gBug Tracking System)
686 Subject: $gBug#$ref: Info received for maintainer only
688 Message-ID: <handler.$ref.$nn.ackinfomaint\@$gEmailDomain>
689 In-Reply-To: $header{'message-id'}
690 References: $header{'message-id'}
691 X-$gProject-PR-Message: ack-info $ref
693 Thank you for the additional information you have supplied regarding
694 this problem report. It has been forwarded to the developer(s) (but
695 not to the mailing list) to accompany the original report.
697 If you wish to continue to submit further information on your problem,
698 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
700 Please do not reply to the address at the top of this message,
701 unless you wish to report a problem with the $gBug-tracking system.
704 (administrator, $gProject $gBugs database)
706 From: $gMaintainerEmail ($gProject $gBug Tracking System)
708 Subject: $gBug#$ref: Info received (was $subject)
709 Message-ID: <handler.$ref.$nn.ackinfo\@$gEmailDomain>
710 In-Reply-To: $header{'message-id'}
711 References: $header{'message-id'}
712 X-$gProject-PR-Message: ack-info-maintonly $ref
714 Thank you for the additional information you have supplied regarding
715 this problem report. It has been forwarded to the developer(s) and
716 to the developers mailing list to accompany the original report.
718 If you wish to continue to submit further information on your problem,
719 please send it to $ref\@$gEmailDomain, as before.
721 Please do not reply to the address at the top of this message,
722 unless you wish to report a problem with the $gBug-tracking system.
725 (administrator, $gProject $gBugs database)
734 open(NEW,">$f.new") || &quit("$f.new: create: $!");
735 print(NEW "$v") || &quit("$f.new: write: $!");
736 close(NEW) || &quit("$f.new: close: $!");
737 rename("$f.new","$f") || &quit("rename $f.new to $f: $!");
741 if (!open(AP,">>db/$ref.log")) {
742 print DEBUG "failed open log<\n";
743 print DEBUG "failed open log err $!<\n";
744 &quit("opening db/$ref.log (li): $!");
746 print(AP "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log (li): $!");
747 close(AP) || &quit("closing db/$ref.log (li): $!");
751 utime(time,time,"db");
753 while ($u= $cleanups[$#cleanups]) { &$u; }
754 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
758 &quit("wot no exit");
760 sub chldhandle { $chldexit = 'yes'; }
763 local ($whatobj,$whatverb,$where,$desc) = @_;
764 open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lh): $!");
767 "<strong>$whatobj $whatverb</strong> to <code>".&sani($where).
768 "</code>:<br>\n". $desc.
769 "\n\3\n") || &quit("writing db/$ref.log (lh): $!");
770 close(AP) || &quit("closing db/$ref.log (lh): $!");
775 map { $_->address() }
776 map { Mail::Address->parse($_) } @_;
781 local ($msg,@recips) = @_;
782 if ($recips[0] eq '' && $#recips == 0) { @recips= ('-t'); }
784 #save email to the log
785 open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lo): $!");
786 print(AP "\2\n",join("\4",@recips),"\n\5\n$msg\n\3\n") ||
787 &quit("writing db/$ref.log (lo): $!");
788 close(AP) || &quit("closing db/$ref.log (lo): $!");
790 #if debbuging.. save email to a log
791 # open AP, ">>debug";
792 # print AP join( '|', @recips )."\n>>";
793 # print AP get_addresses( @recips );
794 # print AP "<<\n".$msg;
795 # print AP "\n--------------------------------------------------------\n";
800 $SIG{'CHLD'}='chldhandle';
801 #print DEBUG "mailing sigchild set up<\n";
804 #print DEBUG "mailing opened pipe fork<\n";
805 defined($c) || die $!;
806 #print DEBUG "mailing opened pipe fork ok $c<\n";
807 if (!$c) { # ie, we are in the child process
808 #print DEBUG "mailing child<\n";
809 unless (open(STDERR,">&STDOUT")) {
810 #print DEBUG "mailing child opened stderr<\n";
811 print STDOUT "redirect stderr: $!\n";
812 #print DEBUG "mailing child opened stderr fail<\n";
814 #print DEBUG "mailing child opened stderr fail exit !?<\n";
816 #print DEBUG "mailing child opened stderr ok<\n";
818 #print DEBUG "mailing child forked again<\n";
819 defined($c) || die $!;
820 #print DEBUG "mailing child forked again ok $c<\n";
821 if (!$c) { # ie, we are the child process
822 #print DEBUG "mailing grandchild<\n";
823 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odi','-oem','-oi',get_addresses(@recips);
824 #print DEBUG "mailing grandchild exec failed<\n";
826 #print DEBUG "mailing grandchild died !?<\n";
828 #print DEBUG "mailing child not grandchild<\n";
829 print(D $msg) || die $!;
830 #print DEBUG "mailing child printed msg<\n";
832 #print DEBUG "mailing child closed pipe<\n";
833 die "\n*** command returned exit status $?\n" if $?;
834 #print DEBUG "mailing child exit status ok<\n";
836 #print DEBUG "mailing child exited ?!<\n";
838 #print DEBUG "mailing parent<\n";
840 #print DEBUG "mailing parent results emptied<\n";
841 while( $chldexit eq 'no' ) { $results.= $_; }
842 #print DEBUG "mailing parent results read >$results<\n";
844 #print DEBUG "mailing parent results closed<\n";
845 $results.= "\n*** child returned exit status $?\n" if $?;
846 #print DEBUG "mailing parent exit status ok<\n";
847 $SIG{'CHLD'}='DEFAULT';
848 #print DEBUG "mailing parent sigchild default<\n";
849 if (length($results)) { &quit("running sendmail: $results"); }
850 #print DEBUG "mailing parent results ok<\n";
853 sub checkmaintainers {
854 return if $maintainerschecked++;
855 return if !length($s_package);
856 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
860 m/^(\S+)\s+(\S.*\S)\n$/ || &quit("maintainers bogus \`$_'");
861 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
862 $maintainerof{$1}= $2;
865 $anymaintfound=0; $anymaintnotfound=0;
866 for $p (split(m/[ \t?,()]+/,$s_package)) {
868 if (defined($maintainerof{$p})) {
869 print DEBUG "maintainer add >$p|$maintainerof{$p}<\n";
870 $addmaint= $maintainerof{$p};
871 push(@maintaddrs,$addmaint) unless
872 $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs);
875 print DEBUG "maintainer none >$p<\n";