2 # $Id: process.in,v 1.11 1999/12/17 19:44:08 gecko 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 for ($i=0; $i<=$#msg; $i++) {
55 last unless length($_);
56 &quit("looping detected") if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
57 $ins= !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i
58 && !m/^From / && !m/^X-Debbugs-CC:/i && !m/^received:/i;
59 $fwd .= $_."\n" if $ins;
60 while ($msg[$i+1] =~ m/^\s/) {
62 $fwd .= $msg[$i]."\n" if $ins;
65 # print DEBUG ">$_<\n";
67 $v= $1; $v =~ y/A-Z/a-z/;
68 print DEBUG ">$v=$_<\n";
71 print DEBUG "!>$_<\n";
76 while ($i <= $#msg && !length($msg[$i])) { $fwd .= "\n"; $i++; }
78 #skips the "this is mime" message and any blank space after it
79 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 the lines starts with -- or is nothing but blank space...
85 #skip to the next blank line(s) then skip past the blank line(s)
86 if ( $msg[$i] =~ /^--/ || $msg[$i] =~ /^\s*$/ )
88 while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; }
89 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
92 while (defined ($msg[$i] ) )
94 last if ( $msg[$i] !~ m/^([\w]+):\s*(\S+)/ );
97 print DEBUG ">$fn|$'|\n";
98 $fwd .= $fn.': '.$fv."\n";
102 print DEBUG ">$fn~$fv<\n";
106 $fwd .= join("\n",@msg[$i..$#msg]);
108 print DEBUG "***\n$fwd\n***\n";
110 defined($header{'from'}) || &quit("no From header");
111 $replyto= defined($header{'reply-to'}) ? $header{'reply-to'} : $header{'from'};
114 $_= "$2 <$1>" if m/^([^\<\> \t\n\(\)]+) \(([^\(\)\<\>]+)\)$/;
116 print DEBUG "replytocompare >$replytocompare<\n";
118 if (!defined($header{'subject'}))
119 { $brokenness.= <<END;
121 Your message did not contain a Subject field. This is broken, I am
122 afraid - the Subject: line is a Required Header according to RFC822.
123 Please remember to include a Subject field in your messages in future.
124 If you did so the fact that it got lost probably indicates a poorly
125 configured mail system at your site or an intervening one.
127 $subject= '(no subject)';
128 } else { $subject= $header{'subject'}; }
131 $subject =~ s/^Re:\s*//i; $_= $subject."\n";
132 if ($tryref < 0 && m/^Bug ?\#(\d+)\D/i) { $tryref= $1+0; }
135 { $bfound= &lockreadbugmerge($tryref);
136 if ($bfound) { $ref= $tryref; }
138 { &htmllog("Reply","sent", $replyto,"Unknown problem report number <code>$tryref</code>.");
139 &sendmessage(<<END, '');
140 From: $gMaintainerEmail ($gProject $gBug Tracking System)
142 Subject: Unknown problem report $gBug#$tryref ($subject)
143 Message-ID: <handler.x.$nn.unknown\@$gEmailDomain>
144 In-Reply-To: $header{'message-id'}
145 References: $header{'message-id'} $s_msgid
146 X-$gProject-PR-Message: error
148 You sent a message to the $gBug tracking system which gave (in the
149 Subject line or encoded into the recipient at $gEmailDomain),
150 the number of a nonexistent $gBug report (#$tryref).
152 This may be because that $gBug report has been resolved for more than $gRemoveAge
153 days, and the record of it has been expunged, or because you mistyped
154 the $gBug report number.
156 Your message was dated $header{'date'} and was sent to
157 $baddress\@$gEmailDomain. It had
158 Message-ID $header{'message-id'}
159 and Subject $subject.
161 It has been filed (under junk) but otherwise ignored.
163 Please consult your records to find the correct $gBug report number, or
164 contact me, the system administrator, for assistance.
167 (administrator, $gProject $gBugs database)
169 (NB: If you are a system administrator and have no idea what I am
170 talking about this indicates a serious mail system misconfiguration
171 somewhere. Please contact me immediately.)
177 } else { &filelock('lock/-1'); }
179 if ($codeletter eq 'D' || $codeletter eq 'F')
180 { if ($replyto =~ m/$gBounceFroms/o ||
181 $header{'from'} =~ m/$gBounceFroms/o)
182 { &quit("bounce detected ! Mwaap! Mwaap!"); }
183 $markedby= $header{'from'} eq $replyto ? $replyto :
184 "$header{'from'} (reply to $replyto)";
185 if ($codeletter eq 'F')
186 { (&appendlog,&finish) if length($s_forwarded);
187 $receivedat= "forwarded\@$gEmailDomain";
188 $markaswhat= 'forwarded';
189 $set_forwarded= $header{'to'};
190 if ( length( $gListDomain ) > 0 && length( $gFowardList ) > 0 )
191 { $generalcc= "$gFowardList\@$gListDomain"; }
192 else { $generalcc=''; }
194 { (&appendlog,&finish) if length($s_done);
195 $receivedat= "done\@$gEmailDomain";
197 $set_done= $header{'from'};
198 if ( length( $gListDomain ) > 0 && length( $gDoneList ) > 0 )
199 { $generalcc= "$gDoneList\@$gListDomain"; }
200 else { $generalcc=''; }
203 { &htmllog("Warning","sent",$replyto,"Message ignored.");
204 &sendmessage(<<END, '');
205 From: $gMaintainerEmail ($gProject $gBug Tracking System)
207 Subject: Message with no $gBug number ignored by $receivedat
209 Message-ID: <header.x.$nn.warnignore\@$gEmailDomain>
210 In-Reply-To: $header{'message-id'}
211 References: $header{'message-id'} $s_msgid
212 X-$gProject-PR-Message: error
214 You sent a message to the $gProject $gBug tracking system old-style
215 unified mark as $markaswhat address ($receivedat),
216 without a recognisable $gBug number in the Subject.
217 Your message has been filed under junk but otherwise ignored.
219 If you don't know what I'm talking about then probably either:
221 (a) you unwittingly sent a message to done\@$gEmailDomain
222 because you replied to all recipients of the message a developer used
223 to mark a $gBug as done and you modified the Subject. In this case,
224 please do not be alarmed. To avoid confusion do not do it again, but
225 there is no need to apologise or mail anyone asking for an explanation.
227 (b) you are a system administrator, reading this because the $gBug
228 tracking system is responding to a misdirected bounce message. In this
229 case there is a serious mail system misconfiguration somewhere - please
230 contact me immediately.
232 Your message was dated $header{'date'} and had
233 message-id $header{'message-id'}
234 and subject $subject.
236 If you need any assistance or explanation please contact me.
239 (administrator, $gProject $gBugs database)
246 $noticeccval.= join(', ', grep($_ ne $replyto,@maintaddrs));
247 $noticeccval =~ s/\s+\n\s+/ /g; $noticeccval =~ s/^\s+/ /; $noticeccval =~ s/\s+$//;
248 if (length($noticeccval)) { $noticecc= "Cc: $noticeccval\n"; }
249 if (length($generalcc)) { $noticecc.= "Bcc: $generalcc\n"; }
250 @process= ($ref,split(/ /,$s_mergedwith));
253 { if ($ref != $orgref)
255 &lockreadbug($ref) || die "huh ? $ref from $orgref out of @process";
257 $s_done= $set_done if defined($set_done);
258 $s_forwarded= $set_forwarded if defined($set_forwarded);
259 &overwrite("db/$ref.status",
260 "$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
261 "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
262 open(O,"db/$ref.report") || &quit("read original report: $!");
263 $x= join('',<O>); close(O);
264 if ($codeletter eq 'F')
265 { &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded.");
266 &sendmessage(<<END.$x, '');
267 From: $gMaintainerEmail ($gProject $gBug Tracking System)
269 ${noticecc}Subject: $gBug#$ref: marked as forwarded ($s_subject)
270 Message-ID: <header.$ref.$nn.ackfwdd\@$gEmailDomain>
271 In-Reply-To: $header{'message-id'}
272 References: $header{'message-id'} $s_msgid
273 X-$gProject-PR-Message: forwarded $ref
275 Your message dated $header{'date'}
276 with message-id $header{'message-id'}
277 and subject line $subject
278 has caused the $gProject $gBug report #$ref,
280 to be marked as having been forwarded to the upstream software
281 author(s) $s_forwarded.
283 (NB: If you are a system administrator and have no idea what I am
284 talking about this indicates a serious mail system misconfiguration
285 somewhere. Please contact me immediately.)
288 (administrator, $gProject $gBugs database)
292 { &htmllog("Reply","sent",$replyto,"You have taken responsibility.");
293 &sendmessage(<<END."--------------------------------------\n".$x."---------------------------------------\n".join( "\n", @msg ), '');
294 From: $gMaintainerEmail ($gProject $gBug Tracking System)
296 ${noticecc}Subject: $gBug#$ref: marked as done ($s_subject)
297 Message-ID: <handler.$ref.$nn.ackdone\@$gEmailDomain>
298 In-Reply-To: $header{'message-id'}
299 References: $header{'message-id'} $s_msgid
300 X-$gProject-PR-Message: closed $ref
302 Your message dated $header{'date'}
303 with message-id $header{'message-id'}
304 and subject line $subject
305 has caused the attached $gBug report to be marked as done.
307 This means that you claim that the problem has been dealt with.
308 If this is not the case it is now your responsibility to reopen the
309 $gBug report if necessary, and/or fix the problem forthwith.
311 (NB: If you are a system administrator and have no idea what I am
312 talking about this indicates a serious mail system misconfiguration
313 somewhere. Please contact me immediately.)
316 (administrator, $gProject $gBugs database)
319 &htmllog("Notification","sent",$s_originator,
320 "$gBug acknowledged by developer.");
321 &sendmessage(<<END.join("\n",@msg),'');
322 From: $gMaintainerEmail ($gProject $gBug Tracking System)
324 Subject: $gBug#$ref acknowledged by developer ($s_subject)
325 Message-ID: <handler.$ref.$nn.notifdone\@$gEmailDomain>
326 In-Reply-To: $s_msgid
327 References: $header{'message-id'} $s_msgid
328 X-$gProject-PR-Message: they-closed $ref
330 This is an automatic notification regarding your $gBug report.
332 It has been closed by one of the developers, namely
335 Their explanation is attached below. If this explanation is
336 unsatisfactory and you have not received a better one in a separate
337 message then please contact the developer directly, or email
338 submit\@$gEmailDomain or me.
341 (administrator, $gProject $gBugs database)
351 { if ($codeletter eq 'U')
352 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
353 &sendmessage(<<END, '');
354 From: $gMaintainerEmail ($gProject $gBug Tracking System)
356 Subject: Message with no $gBug number cannot be sent to submitter !
358 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
359 In-Reply-To: $header{'message-id'}
360 References: $header{'message-id'} $s_msgid
361 X-$gProject-PR-Message: error
363 You sent a message to the $gProject $gBug tracking system send to $gBug
364 report submitter address $baddress\@$gEmailDomain, without a
365 recognisable $gBug number in the Subject. Your message has been filed
366 under junk but otherwise ignored.
368 If you don't know what I'm talking about then probably either:
370 (a) you unwittingly sent a message to $baddress\@$gEmailDomain
371 because you replied to all recipients of the message a developer sent
372 to a $gBug's submitter and you modified the Subject. In this case,
373 please do not be alarmed. To avoid confusion do not do it again, but
374 there is no need to apologise or mail anyone asking for an
377 (b) you are a system administrator, reading this because the $gBug
378 tracking system is responding to a misdirected bounce message. In this
379 case there is a serious mail system misconfiguration somewhere - please
380 contact me immediately.
382 Your message was dated $header{'date'} and had
383 message-id $header{'message-id'}
384 and subject $subject.
386 If you need any assistance or explanation please contact me.
389 (administrator, $gProject $gBugs database)
395 if (!defined($pheader{'package'}))
396 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
397 &sendmessage(<<END, '');
398 From: $gMaintainerEmail ($gProject $gBug Tracking System)
400 Subject: Message with no Package: tag cannot be processed!
402 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
403 In-Reply-To: $header{'message-id'}
404 References: $header{'message-id'} $s_msgid
405 X-$gProject-PR-Message: error
407 Your message didn't have a Package: line at the start (in the
408 pseudo-header following the real mail header), or didn't have a
409 pseudo-header at all.
411 This makes it much harder for us to categorise and deal with your
412 problem report. Please resubmit your report and tell us which package the
413 report is on. For help, check out http://$gWebDomain/Reporting.html.
415 Your message was dated $header{'date'} and had
416 message-id $header{'message-id'}
417 and subject $subject.
419 If you need any assistance or explanation please contact me.
422 (administrator, $gProject $gBugs database)
427 } else { $s_package= $pheader{'package'}; }
428 if (defined($pheader{'keywords'})) {
429 $s_keywords= $pheader{'keywords'};
432 if (defined($pheader{'severity'}) || defined($pheader{'priority'}))
433 { $s_severity= $pheader{'severity'};
434 $s_severity= $pheader{'priority'} unless ($s_severity);
436 if (!grep($_ eq $s_severity, @severities, "$gDefaultSeverity")) {
439 Your message specified a Severity: in the pseudo-header, but
440 the severity value $s_severity was not recognised.
441 The default severity $gDefaultSeverity is being used instead.
442 The recognised values are: @gSeverityList.
447 &filelock("nextnumber.lock");
448 open(N,"nextnumber") || &quit("nextnumber: read: $!");
449 $v=<N>; $v =~ s/\n$// || &quit("nextnumber bad format");
450 $ref= $v+0; $v += 1; $newref=1;
451 &overwrite('nextnumber', "$v\n");
453 &overwrite("db/$ref.log",'');
454 &overwrite("db/$ref.status",
455 "$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
456 "$s_package\n$s_keywords\n\n\n\n$s_severity\n");
457 &overwrite("db/$ref.report",
458 join("\n",@msg)."\n");
463 print DEBUG "maintainers >@maintaddrs<\n";
465 $orgsender= defined($header{'sender'}) ? "Orignal-Sender: $header{'sender'}\n" : '';
466 $newsubject= $subject; $newsubject =~ s/^$gBug#$ref\W*\s*//;
468 $xcchdr= $header{ 'x-debbugs-cc' };
469 if ($xcchdr =~ m/\S/) {
470 push(@resentccs,$xcchdr);
471 $resentccexplain.= <<END;
473 As you requested using X-Debbugs-CC, your message was also forwarded to
475 (after having been given a $gBug report number, if it did not have one).
479 if (@maintaddrs && ($codeletter eq 'B' || $codeletter eq 'M')) {
480 push(@resentccs,@maintaddrs);
481 $resentccexplain.= <<END." ".join("\n ",@maintaddrs)."\n";
483 Your message has been sent to the package maintainer(s):
487 $veryquiet= $codeletter eq 'Q';
488 if ($codeletter eq 'M' && !@maintaddrs) {
492 You requested that the message be sent to the package maintainer(s)
493 but either the $gBug report is not associated with any package (probably
494 because of a missing Package pseudo-header field in the original $gBug
495 report), or the package(s) specified do not have any maintainer(s).
497 Your message has *not* been sent to any package maintainers; it has
498 merely been filed in the $gBug tracking system. If you require assistance
499 please contact $gMaintainerEmail quoting the $gBug number $ref.
503 $resentccval.= join(', ',@resentccs);
504 $resentccval =~ s/\s+\n\s+/ /g; $resentccval =~ s/^\s+/ /; $resentccval =~ s/\s+$//;
505 if (length($resentccval)) { $resentcc= "Resent-CC: $resentccval\n"; }
507 if ($codeletter eq 'U') {
508 &htmllog("Message", "sent on", $s_originator, "$gBug#$ref.");
509 &sendmessage(<<END,$s_originator,@resentccs);
510 Subject: $gBug#$ref: $newsubject
511 Reply-To: $replyto, $ref-quiet\@$gEmailDomain
512 ${orgsender}Resent-To: $s_originator
513 ${resentcc}Resent-Date: $tdate
514 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
515 Resent-Sender: $gMaintainerEmail
516 X-$gProject-PR-Message: report $ref
517 X-$gProject-PR-Package: $s_package
518 X-$gProject-PR-Keywords: $s_keywords
521 } elsif ($codeletter eq 'B') {
522 &htmllog($newref ? "Report" : "Information", "forwarded",
523 join(', ',"$gSubmitList\@$gListDomain",@resentccs),
524 "<code>$gBug#$ref</code>".
525 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
526 (length($s_keywords)? "; Keywords <code>".&sani($s_keywords)."</code>":'').
528 &sendmessage(<<END,"$gSubmitList\@$gListDomain",@resentccs);
529 Subject: $gBug#$ref: $newsubject
530 Reply-To: $replyto, $ref\@$gEmailDomain
531 Resent-From: $header{'from'}
532 ${orgsender}Resent-To: $gSubmitList\@$gListDomain
533 ${resentcc}Resent-Date: $tdate
534 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
535 Resent-Sender: $gMaintainerEmail
536 X-$gProject-PR-Message: report $ref
537 X-$gProject-PR-Package: $s_package
538 X-$gProject-PR-Keywords: $s_keywords
541 } elsif (@resentccs) {
542 # D and F done far earlier; B just done - so this must be M or Q
543 # We preserve whichever it was in the Reply-To (possibly adding
545 &htmllog($newref ? "Report" : "Information", "forwarded",
547 "<code>$gBug#$ref</code>".
548 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
549 (length($s_keywords)? "; Keywords <code>".&sani($s_keywords)."</code>":'').
551 &sendmessage(<<END,@resentccs);
552 Subject: $gBug#$ref: $newsubject
553 Reply-To: $replyto, $ref-$baddressroot\@$gEmailDomain
554 Resent-From: $header{'from'}
555 ${orgsender}Resent-To: $resentccval
557 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
558 Resent-Sender: $gMaintainerEmail
559 X-$gProject-PR-Message: report $ref
560 X-$gProject-PR-Package: $s_package
561 X-$gProject-PR-Keywords: $s_keywords
566 $htmlbreak= length($brokenness) ? "<p>\n".&sani($brokenness)."\n<p>\n" : '';
567 $htmlbreak =~ s/\n\n/\n<P>\n\n/g;
568 if (length($resentccval)) {
570 " Copy sent to <code>".&sani($resentccval)."</code>.".
574 &htmllog("Acknowledgement","sent",$replyto,
576 "New $gBug report received and filed, but not forwarded." :
577 "New $gBug report received and forwarded."). $htmlbreak);
578 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
579 From: $gMaintainerEmail ($gProject $gBug Tracking System)
581 Subject: $gBug#$ref: Acknowledgement of QUIET report
583 Message-ID: <handler.$ref.$nn.ackquiet\@$gEmailDomain>
584 In-Reply-To: $header{'message-id'}
585 References: $header{'message-id'}
586 X-$gProject-PR-Message: ack-quiet $ref
588 Thank you for the problem report you have sent regarding $gProject.
589 This is an automatically generated reply, to let you know your message
590 has been received. It has not been forwarded to the developers or
591 their mailing list; you should ensure that the developers are aware of
592 the problem you have entered into the system - preferably quoting the
593 $gBug reference number, #$ref.
595 If you wish to submit further information on your problem, please send it
596 to $ref-$baddressroot\@$gEmailDomain (and *not*
597 to $baddress\@$gEmailDomain).
599 Please do not reply to the address at the top of this message,
600 unless you wish to report a problem with the $gBug-tracking system.
603 (administrator, $gProject $gBugs database)
605 From: $gMaintainerEmail ($gProject $gBug Tracking System)
607 Subject: $gBug#$ref: Acknowledgement of maintainer-only report
609 Message-ID: <handler.$ref.$nn.ackmaint\@$gEmailDomain>
610 In-Reply-To: $header{'message-id'}
611 References: $header{'message-id'}
612 X-$gProject-PR-Message: ack-maintonly $ref
614 Thank you for the problem report you have sent regarding $gProject.
615 This is an automatically generated reply, to let you know your message has
616 been received. It is being forwarded to the developers (but not the mailing
617 list, as you requested) for their attention; they will reply in due course.
619 If you wish to submit further information on your problem, please send
620 it to $ref-$baddressroot\@$gEmailDomain (and *not*
621 to $baddress\@$gEmailDomain).
623 Please do not reply to the address at the top of this message,
624 unless you wish to report a problem with the $gBug-tracking system.
627 (administrator, $gProject $gBugs database)
629 From: $gMaintainerEmail ($gProject $gBug Tracking System)
631 Subject: $gBug#$ref: Acknowledgement ($subject)
632 Message-ID: <handler.$ref.$nn.ack\@$gEmailDomain>
633 In-Reply-To: $header{'message-id'}
634 References: $header{'message-id'}
635 X-$gProject-PR-Message: ack $ref
637 Thank you for the problem report you have sent regarding $gProject.
638 This is an automatically generated reply, to let you know your message has
639 been received. It is being forwarded to the developers mailing list for
640 their attention; they will reply in due course.
642 If you wish to submit further information on your problem, please send
643 it to $ref\@$gEmailDomain (and *not* to
644 $baddress\@$gEmailDomain).
646 Please do not reply to the address at the top of this message,
647 unless you wish to report a problem with the $gBug-tracking system.
650 (administrator, $gProject $gBugs database)
652 } elsif ($codeletter ne 'U') {
653 &htmllog("Acknowledgement","sent",$replyto,
654 ($veryquiet ? "Extra info received and filed, but not forwarded." :
655 $codeletter eq 'M' ? "Extra info received and forwarded to maintainer." :
656 "Extra info received and forwarded to list."). $htmlbreak);
657 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
658 From: $gMaintainerEmail ($gProject $gBug Tracking System)
660 Subject: $gBug#$ref: Info received and FILED only
662 Message-ID: <handler.$ref.$nn.ackinfoquiet\@$gEmailDomain>
663 In-Reply-To: $header{'message-id'}
664 References: $header{'message-id'}
665 X-$gProject-PR-Message: ack-info-quiet $ref
667 Thank you for the additional information you have supplied regarding
668 this problem report. It has NOT been forwarded to the developers, but
669 will accompany the original report in the $gBug tracking system. Please
670 ensure that you yourself have sent a copy of the additional
671 information to any relevant developers or mailing lists.
673 If you wish to continue to submit further information on your problem,
674 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
676 Please do not reply to the address at the top of this message,
677 unless you wish to report a problem with the $gBug-tracking system.
680 (administrator, $gProject $gBugs database)
682 From: $gMaintainerEmail ($gProject $gBug Tracking System)
684 Subject: $gBug#$ref: Info received for maintainer only
686 Message-ID: <handler.$ref.$nn.ackinfomaint\@$gEmailDomain>
687 In-Reply-To: $header{'message-id'}
688 References: $header{'message-id'}
689 X-$gProject-PR-Message: ack-info $ref
691 Thank you for the additional information you have supplied regarding
692 this problem report. It has been forwarded to the developer(s) (but
693 not to the mailing list) to accompany the original report.
695 If you wish to continue to submit further information on your problem,
696 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
698 Please do not reply to the address at the top of this message,
699 unless you wish to report a problem with the $gBug-tracking system.
702 (administrator, $gProject $gBugs database)
704 From: $gMaintainerEmail ($gProject $gBug Tracking System)
706 Subject: $gBug#$ref: Info received (was $subject)
707 Message-ID: <handler.$ref.$nn.ackinfo\@$gEmailDomain>
708 In-Reply-To: $header{'message-id'}
709 References: $header{'message-id'}
710 X-$gProject-PR-Message: ack-info-maintonly $ref
712 Thank you for the additional information you have supplied regarding
713 this problem report. It has been forwarded to the developer(s) and
714 to the developers mailing list to accompany the original report.
716 If you wish to continue to submit further information on your problem,
717 please send it to $ref\@$gEmailDomain, as before.
719 Please do not reply to the address at the top of this message,
720 unless you wish to report a problem with the $gBug-tracking system.
723 (administrator, $gProject $gBugs database)
732 open(NEW,">$f.new") || &quit("$f.new: create: $!");
733 print(NEW "$v") || &quit("$f.new: write: $!");
734 close(NEW) || &quit("$f.new: close: $!");
735 rename("$f.new","$f") || &quit("rename $f.new to $f: $!");
739 if (!open(AP,">>db/$ref.log")) {
740 print DEBUG "failed open log<\n";
741 print DEBUG "failed open log err $!<\n";
742 &quit("opening db/$ref.log (li): $!");
744 print(AP "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log (li): $!");
745 close(AP) || &quit("closing db/$ref.log (li): $!");
749 utime(time,time,"db");
751 while ($u= $cleanups[$#cleanups]) { &$u; }
752 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
756 &quit("wot no exit");
758 sub chldhandle { $chldexit = 'yes'; }
761 local ($whatobj,$whatverb,$where,$desc) = @_;
762 open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lh): $!");
765 "<strong>$whatobj $whatverb</strong> to <code>".&sani($where).
766 "</code>:<br>\n". $desc.
767 "\n\3\n") || &quit("writing db/$ref.log (lh): $!");
768 close(AP) || &quit("closing db/$ref.log (lh): $!");
773 map { $_->address() }
774 map { Mail::Address->parse($_) } @_;
779 local ($msg,@recips) = @_;
780 if ($recips[0] eq '' && $#recips == 0) { @recips= ('-t'); }
782 #save email to the log
783 open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lo): $!");
784 print(AP "\2\n",join("\4",@recips),"\n\5\n$msg\n\3\n") ||
785 &quit("writing db/$ref.log (lo): $!");
786 close(AP) || &quit("closing db/$ref.log (lo): $!");
788 #if debbuging.. save email to a log
789 # open AP, ">>debug";
790 # print AP join( '|', @recips )."\n>>";
791 # print AP get_addresses( @recips );
792 # print AP "<<\n".$msg;
793 # print AP "\n--------------------------------------------------------\n";
798 $SIG{'CHLD'}='chldhandle';
799 #print DEBUG "mailing sigchild set up<\n";
802 #print DEBUG "mailing opened pipe fork<\n";
803 defined($c) || die $!;
804 #print DEBUG "mailing opened pipe fork ok $c<\n";
805 if (!$c) { # ie, we are in the child process
806 #print DEBUG "mailing child<\n";
807 unless (open(STDERR,">&STDOUT")) {
808 #print DEBUG "mailing child opened stderr<\n";
809 print STDOUT "redirect stderr: $!\n";
810 #print DEBUG "mailing child opened stderr fail<\n";
812 #print DEBUG "mailing child opened stderr fail exit !?<\n";
814 #print DEBUG "mailing child opened stderr ok<\n";
816 #print DEBUG "mailing child forked again<\n";
817 defined($c) || die $!;
818 #print DEBUG "mailing child forked again ok $c<\n";
819 if (!$c) { # ie, we are the child process
820 #print DEBUG "mailing grandchild<\n";
821 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odi','-oem','-oi',get_addresses(@recips);
822 #print DEBUG "mailing grandchild exec failed<\n";
824 #print DEBUG "mailing grandchild died !?<\n";
826 #print DEBUG "mailing child not grandchild<\n";
827 print(D $msg) || die $!;
828 #print DEBUG "mailing child printed msg<\n";
830 #print DEBUG "mailing child closed pipe<\n";
831 die "\n*** command returned exit status $?\n" if $?;
832 #print DEBUG "mailing child exit status ok<\n";
834 #print DEBUG "mailing child exited ?!<\n";
836 #print DEBUG "mailing parent<\n";
838 #print DEBUG "mailing parent results emptied<\n";
839 while( $chldexit eq 'no' ) { $results.= $_; }
840 #print DEBUG "mailing parent results read >$results<\n";
842 #print DEBUG "mailing parent results closed<\n";
843 $results.= "\n*** child returned exit status $?\n" if $?;
844 #print DEBUG "mailing parent exit status ok<\n";
845 $SIG{'CHLD'}='DEFAULT';
846 #print DEBUG "mailing parent sigchild default<\n";
847 if (length($results)) { &quit("running sendmail: $results"); }
848 #print DEBUG "mailing parent results ok<\n";
851 sub checkmaintainers {
852 return if $maintainerschecked++;
853 return if !length($s_package);
854 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
856 m/^(\S+)\s+(\S.*\S)\n$/ || &quit("maintainers bogus \`$_'");
857 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
858 $maintainerof{$1}= $2;
861 $anymaintfound=0; $anymaintnotfound=0;
862 for $p (split(m/[ \t?,()]+/,$s_package)) {
864 if (defined($maintainerof{$p})) {
865 print DEBUG "maintainer add >$p|$maintainerof{$p}<\n";
866 $addmaint= $maintainerof{$p};
867 push(@maintaddrs,$addmaint) unless
868 $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs);
871 print DEBUG "maintainer none >$p<\n";