2 # $Id: process.in,v 1.9 1999/10/14 19:56:58 gecko Exp $
8 require( '/etc/debbugs/config' );
9 require( '/usr/lib/debbugs/errorlib' );
10 chdir( "$gSpoolDir" ) || die 'chdir spool: $!\n';
13 #open(DEBUG,"> /tmp/debbugs.debug");
15 defined( $intdate= time ) || &quit( "failed to get time: $!" );
18 m/^([BMQFDU])(\d*)\.\d+$/ || &quit("bad argument");
20 $tryref= length($2) ? $2+0 : -1;
23 if (!rename("incoming/G$nn","incoming/P$nn"))
24 { $_=$!.''; m/no such file or directory/i && exit 0;
25 &quit("renaming to lock: $!");
28 $baddress= 'bugs' if $codeletter eq 'B';
29 $baddress= 'maintonly' if $codeletter eq 'M';
30 $baddress= 'quiet' if $codeletter eq 'Q';
31 $baddress= 'forwarded' if $codeletter eq 'F';
32 $baddress= 'done' if $codeletter eq 'D';
33 $baddress= 'submitter' if $codeletter eq 'U';
34 $baddress || &quit("bad codeletter $codeletter");
35 $baddressroot= $baddress;
36 $baddress= "$tryref-$baddress" if $tryref>=0;
38 open(M,"incoming/P$nn");
45 print DEBUG "###\n",join("##\n",@msg),"\n###\n";
47 chop($tdate= `date -u '+%a, %d %h %Y %T GMT'`);
49 X-Loop: $gMaintainerEmail
50 Received: via spool by $baddress\@$gEmailDomain id=$nn
51 (code $codeletter ref $tryref); $tdate
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 print DEBUG ">$fn~$fv<\n";
107 $fwd .= join("\n",@msg[$i..$#msg]);
109 print DEBUG "***\n$fwd\n***\n";
111 defined($header{'from'}) || &quit("no From header");
112 $replyto= defined($header{'reply-to'}) ? $header{'reply-to'} : $header{'from'};
115 $_= "$2 <$1>" if m/^([^\<\> \t\n\(\)]+) \(([^\(\)\<\>]+)\)$/;
117 print DEBUG "replytocompare >$replytocompare<\n";
119 if (!defined($header{'subject'}))
120 { $brokenness.= <<END;
122 Your message did not contain a Subject field. This is broken, I am
123 afraid - the Subject: line is a Required Header according to RFC822.
124 Please remember to include a Subject field in your messages in future.
125 If you did so the fact that it got lost probably indicates a poorly
126 configured mail system at your site or an intervening one.
128 $subject= '(no subject)';
129 } else { $subject= $header{'subject'}; }
132 $subject =~ s/^Re:\s*//i; $_= $subject."\n";
133 if ($tryref < 0 && m/^Bug ?\#(\d+)\D/i) { $tryref= $1+0; }
136 { $bfound= &lockreadbugmerge($tryref);
137 if ($bfound) { $ref= $tryref; }
139 { &htmllog("Reply","sent", $replyto,"Unknown problem report number <code>$tryref</code>.");
140 &sendmessage(<<END, '');
141 From: $gMaintainerEmail ($gProject $gBug Tracking System)
143 Subject: Unknown problem report $gBug#$tryref ($subject)
144 Message-ID: <handler.x.$nn.unknown\@$gEmailDomain>
145 In-Reply-To: $header{'message-id'}
146 References: $header{'message-id'} $s_msgid
147 X-$gProject-PR-Message: error
149 You sent a message to the $gBug tracking system which gave (in the
150 Subject line or encoded into the recipient at $gEmailDomain),
151 the number of a nonexistent $gBug report (#$tryref).
153 This may be because that $gBug report has been resolved for more than $gRemoveAge
154 days, and the record of it has been expunged, or because you mistyped
155 the $gBug report number.
157 Your message was dated $header{'date'} and was sent to
158 $baddress\@$gEmailDomain. It had
159 Message-ID $header{'message-id'}
160 and Subject $subject.
162 It has been filed (under junk) but otherwise ignored.
164 Please consult your records to find the correct $gBug report number, or
165 contact me, the system administrator, for assistance.
168 (administrator, $gProject $gBugs database)
170 (NB: If you are a system administrator and have no idea what I am
171 talking about this indicates a serious mail system misconfiguration
172 somewhere. Please contact me immediately.)
178 } else { &filelock('lock/-1'); }
180 if ($codeletter eq 'D' || $codeletter eq 'F')
181 { if ($replyto =~ m/$gBounceFroms/o ||
182 $header{'from'} =~ m/$gBounceFroms/o)
183 { &quit("bounce detected ! Mwaap! Mwaap!"); }
184 $markedby= $header{'from'} eq $replyto ? $replyto :
185 "$header{'from'} (reply to $replyto)";
186 if ($codeletter eq 'F')
187 { (&appendlog,&finish) if length($s_forwarded);
188 $receivedat= "forwarded\@$gEmailDomain";
189 $markaswhat= 'forwarded';
190 $set_forwarded= $header{'to'};
191 if ( length( $gListDomain ) > 0 && length( $gFowardList ) > 0 )
192 { $generalcc= "$gFowardList\@$gListDomain"; }
193 else { $generalcc=''; }
195 { (&appendlog,&finish) if length($s_done);
196 $receivedat= "done\@$gEmailDomain";
198 $set_done= $header{'from'};
199 if ( length( $gListDomain ) > 0 && length( $gDoneList ) > 0 )
200 { $generalcc= "$gDoneList\@$gListDomain"; }
201 else { $generalcc=''; }
204 { &htmllog("Warning","sent",$replyto,"Message ignored.");
205 &sendmessage(<<END, '');
206 From: $gMaintainerEmail ($gProject $gBug Tracking System)
208 Subject: Message with no $gBug number ignored by $receivedat
210 Message-ID: <header.x.$nn.warnignore\@$gEmailDomain>
211 In-Reply-To: $header{'message-id'}
212 References: $header{'message-id'} $s_msgid
213 X-$gProject-PR-Message: error
215 You sent a message to the $gProject $gBug tracking system old-style
216 unified mark as $markaswhat address ($receivedat),
217 without a recognisable $gBug number in the Subject.
218 Your message has been filed under junk but otherwise ignored.
220 If you don't know what I'm talking about then probably either:
222 (a) you unwittingly sent a message to done\@$gEmailDomain
223 because you replied to all recipients of the message a developer used
224 to mark a $gBug as done and you modified the Subject. In this case,
225 please do not be alarmed. To avoid confusion do not do it again, but
226 there is no need to apologise or mail anyone asking for an explanation.
228 (b) you are a system administrator, reading this because the $gBug
229 tracking system is responding to a misdirected bounce message. In this
230 case there is a serious mail system misconfiguration somewhere - please
231 contact me immediately.
233 Your message was dated $header{'date'} and had
234 message-id $header{'message-id'}
235 and subject $subject.
237 If you need any assistance or explanation please contact me.
240 (administrator, $gProject $gBugs database)
247 $noticeccval.= join(', ', grep($_ ne $replyto,@maintaddrs));
248 $noticeccval =~ s/\s+\n\s+/ /g; $noticeccval =~ s/^\s+/ /; $noticeccval =~ s/\s+$//;
249 if (length($noticeccval)) { $noticecc= "Cc: $noticeccval\n"; }
250 if (length($generalcc)) { $noticecc.= "Bcc: $generalcc\n"; }
251 @process= ($ref,split(/ /,$s_mergedwith));
254 { if ($ref != $orgref)
256 &lockreadbug($ref) || die "huh ? $ref from $orgref out of @process";
258 $s_done= $set_done if defined($set_done);
259 $s_forwarded= $set_forwarded if defined($set_forwarded);
260 &overwrite("db/$ref.status",
261 "$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
262 "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
263 open(O,"db/$ref.report") || &quit("read original report: $!");
264 $x= join('',<O>); close(O);
265 if ($codeletter eq 'F')
266 { &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded.");
267 &sendmessage(<<END.$x, '');
268 From: $gMaintainerEmail ($gProject $gBug Tracking System)
270 ${noticecc}Subject: $gBug#$ref: marked as forwarded ($s_subject)
271 Message-ID: <header.$ref.$nn.ackfwdd\@$gEmailDomain>
272 In-Reply-To: $header{'message-id'}
273 References: $header{'message-id'} $s_msgid
274 X-$gProject-PR-Message: forwarded $ref
276 Your message dated $header{'date'}
277 with message-id $header{'message-id'}
278 and subject line $subject
279 has caused the $gProject $gBug report #$ref,
281 to be marked as having been forwarded to the upstream software
282 author(s) $s_forwarded.
284 (NB: If you are a system administrator and have no idea what I am
285 talking about this indicates a serious mail system misconfiguration
286 somewhere. Please contact me immediately.)
289 (administrator, $gProject $gBugs database)
293 { &htmllog("Reply","sent",$replyto,"You have taken responsibility.");
294 &sendmessage(<<END."--------------------------------------\n".$x."---------------------------------------\n".join( "\n", @msg ), '');
295 From: $gMaintainerEmail ($gProject $gBug Tracking System)
297 ${noticecc}Subject: $gBug#$ref: marked as done ($s_subject)
298 Message-ID: <handler.$ref.$nn.ackdone\@$gEmailDomain>
299 In-Reply-To: $header{'message-id'}
300 References: $header{'message-id'} $s_msgid
301 X-$gProject-PR-Message: closed $ref
303 Your message dated $header{'date'}
304 with message-id $header{'message-id'}
305 and subject line $subject
306 has caused the attached $gBug report to be marked as done.
308 This means that you claim that the problem has been dealt with.
309 If this is not the case it is now your responsibility to reopen the
310 $gBug report if necessary, and/or fix the problem forthwith.
312 (NB: If you are a system administrator and have no idea what I am
313 talking about this indicates a serious mail system misconfiguration
314 somewhere. Please contact me immediately.)
317 (administrator, $gProject $gBugs database)
320 &htmllog("Notification","sent",$s_originator,
321 "$gBug acknowledged by developer.");
322 &sendmessage(<<END.join("\n",@msg),'');
323 From: $gMaintainerEmail ($gProject $gBug Tracking System)
325 Subject: $gBug#$ref acknowledged by developer ($s_subject)
326 Message-ID: <handler.$ref.$nn.notifdone\@$gEmailDomain>
327 In-Reply-To: $s_msgid
328 References: $header{'message-id'} $s_msgid
329 X-$gProject-PR-Message: they-closed $ref
331 This is an automatic notification regarding your $gBug report.
333 It has been closed by one of the developers, namely
336 Their explanation is attached below. If this explanation is
337 unsatisfactory and you have not received a better one in a separate
338 message then please contact the developer directly, or email
339 submit\@$gEmailDomain or me.
342 (administrator, $gProject $gBugs database)
352 { if ($codeletter eq 'U')
353 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
354 &sendmessage(<<END, '');
355 From: $gMaintainerEmail ($gProject $gBug Tracking System)
357 Subject: Message with no $gBug number cannot be sent to submitter !
359 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
360 In-Reply-To: $header{'message-id'}
361 References: $header{'message-id'} $s_msgid
362 X-$gProject-PR-Message: error
364 You sent a message to the $gProject $gBug tracking system send to $gBug
365 report submitter address $baddress\@$gEmailDomain, without a
366 recognisable $gBug number in the Subject. Your message has been filed
367 under junk but otherwise ignored.
369 If you don't know what I'm talking about then probably either:
371 (a) you unwittingly sent a message to $baddress\@$gEmailDomain
372 because you replied to all recipients of the message a developer sent
373 to a $gBug's submitter and you modified the Subject. In this case,
374 please do not be alarmed. To avoid confusion do not do it again, but
375 there is no need to apologise or mail anyone asking for an
378 (b) you are a system administrator, reading this because the $gBug
379 tracking system is responding to a misdirected bounce message. In this
380 case there is a serious mail system misconfiguration somewhere - please
381 contact me immediately.
383 Your message was dated $header{'date'} and had
384 message-id $header{'message-id'}
385 and subject $subject.
387 If you need any assistance or explanation please contact me.
390 (administrator, $gProject $gBugs database)
396 if (!defined($pheader{'package'}))
397 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
398 print " sending no package header msg\n";
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 psuedo-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)
427 print " append log\n";
432 } else { $s_package= $pheader{'package'}; }
433 if (defined($pheader{'keywords'})) {
434 $s_keywords= $pheader{'keywords'};
437 if (defined($pheader{'severity'})) {
438 $s_severity= $pheader{'severity'};
439 if (!grep($_ eq $s_severity, @severities, "$gDefaultSeverity")) {
442 Your message specified a Severity: in the psuedo-header, but
443 the severity value $s_severity was not recognised.
444 The default severity $gDefaultSeverity is being used instead.
445 The recognised values are: @showseverities.
450 &filelock("nextnumber.lock");
451 open(N,"nextnumber") || &quit("nextnumber: read: $!");
452 $v=<N>; $v =~ s/\n$// || &quit("nextnumber bad format");
453 $ref= $v+0; $v += 1; $newref=1;
454 &overwrite('nextnumber', "$v\n");
456 &overwrite("db/$ref.log",'');
457 &overwrite("db/$ref.status",
458 "$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
459 "$s_package\n$s_keywords\n\n\n\n$s_severity\n");
460 &overwrite("db/$ref.report",
461 join("\n",@msg)."\n");
466 print DEBUG "maintainers >@maintaddrs<\n";
468 $orgsender= defined($header{'sender'}) ? "Orignal-Sender: $header{'sender'}\n" : '';
469 $newsubject= $subject; $newsubject =~ s/^$gBug#$ref\W*\s*//;
471 $xcchdr= $header{ 'x-debbugs-cc' };
472 if ($xcchdr =~ m/\S/) {
473 push(@resentccs,$xcchdr);
474 $resentccexplain.= <<END;
476 As you requested using X-Debbugs-CC, your message was also forwarded to
478 (after having been given a $gBug report number, if it did not have one).
482 if (@maintaddrs && ($codeletter eq 'B' || $codeletter eq 'M')) {
483 push(@resentccs,@maintaddrs);
484 $resentccexplain.= <<END." ".join("\n ",@maintaddrs)."\n";
486 Your message has been sent to the package maintainer(s):
490 $veryquiet= $codeletter eq 'Q';
491 if ($codeletter eq 'M' && !@maintaddrs) {
495 You requested that the message be sent to the package maintainer(s)
496 but either the $gBug report is not associated with any package (probably
497 because of a missing Package psuedo-header field in the original $gBug
498 report), or the package(s) specified do not have any maintainer(s).
500 Your message has *not* been sent to any package maintainers; it has
501 merely been filed in the $gBug tracking system. If you require assistance
502 please contact $gMaintainerEmail quoting the $gBug number $ref.
506 $resentccval.= join(', ',@resentccs);
507 $resentccval =~ s/\s+\n\s+/ /g; $resentccval =~ s/^\s+/ /; $resentccval =~ s/\s+$//;
508 if (length($resentccval)) { $resentcc= "Resent-CC: $resentccval\n"; }
510 if ($codeletter eq 'U') {
511 &htmllog("Message", "sent on", $s_originator, "$gBug#$ref.");
512 &sendmessage(<<END,$s_originator,@resentccs);
513 Subject: $gBug#$ref: $newsubject
514 Reply-To: $replyto, $ref-quiet\@$gEmailDomain
515 ${orgsender}Resent-To: $s_originator
516 ${resentcc}Resent-Date: $tdate
517 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
518 Resent-Sender: $gMaintainerEmail
519 X-$gProject-PR-Message: report $ref
520 X-$gProject-PR-Package: $s_package
521 X-$gProject-PR-Keywords: $s_keywords
524 } elsif ($codeletter eq 'B') {
525 &htmllog($newref ? "Report" : "Information", "forwarded",
526 join(', ',"$gSubmitList\@$gListDomain",@resentccs),
527 "<code>$gBug#$ref</code>".
528 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
529 (length($s_keywords)? "; Keywords <code>".&sani($s_keywords)."</code>":'').
531 &sendmessage(<<END,"$gSubmitList\@$gListDomain",@resentccs);
532 Subject: $gBug#$ref: $newsubject
533 Reply-To: $replyto, $ref\@$gEmailDomain
534 Resent-From: $header{'from'}
535 ${orgsender}Resent-To: $gSubmitList\@$gListDomain
536 ${resentcc}Resent-Date: $tdate
537 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
538 Resent-Sender: $gMaintainerEmail
539 X-$gProject-PR-Message: report $ref
540 X-$gProject-PR-Package: $s_package
541 X-$gProject-PR-Keywords: $s_keywords
544 } elsif (@resentccs) {
545 # D and F done far earlier; B just done - so this must be M or Q
546 # We preserve whichever it was in the Reply-To (possibly adding
548 &htmllog($newref ? "Report" : "Information", "forwarded",
550 "<code>$gBug#$ref</code>".
551 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
552 (length($s_keywords)? "; Keywords <code>".&sani($s_keywords)."</code>":'').
554 &sendmessage(<<END,@resentccs);
555 Subject: $gBug#$ref: $newsubject
556 Reply-To: $replyto, $ref-$baddressroot\@$gEmailDomain
557 Resent-From: $header{'from'}
558 ${orgsender}Resent-To: $resentccval
560 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
561 Resent-Sender: $gMaintainerEmail
562 X-$gProject-PR-Message: report $ref
563 X-$gProject-PR-Package: $s_package
564 X-$gProject-PR-Keywords: $s_keywords
569 $htmlbreak= length($brokenness) ? "<p>\n".&sani($brokenness)."\n<p>\n" : '';
570 $htmlbreak =~ s/\n\n/\n<P>\n\n/g;
571 if (length($resentccval)) {
573 " Copy sent to <code>".&sani($resentccval)."</code>.".
577 &htmllog("Acknowledgement","sent",$replyto,
579 "New $gBug report received and filed, but not forwarded." :
580 "New $gBug report received and forwarded."). $htmlbreak);
581 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
582 From: $gMaintainerEmail ($gProject $gBug Tracking System)
584 Subject: $gBug#$ref: Acknowledgement of QUIET report
586 Message-ID: <handler.$ref.$nn.ackquiet\@$gEmailDomain>
587 In-Reply-To: $header{'message-id'}
588 References: $header{'message-id'}
589 X-$gProject-PR-Message: ack-quiet $ref
591 Thank you for the problem report you have sent regarding $gProject.
592 This is an automatically generated reply, to let you know your message
593 has been received. It has not been forwarded to the developers or
594 their mailing list; you should ensure that the developers are aware of
595 the problem you have entered into the system - preferably quoting the
596 $gBug reference number, #$ref.
598 If you wish to submit further information on your problem, please send it
599 to $ref-$baddressroot\@$gEmailDomain (and *not*
600 to $baddress\@$gEmailDomain).
602 Please do not reply to the address at the top of this message,
603 unless you wish to report a problem with the $gBug-tracking system.
606 (administrator, $gProject $gBugs database)
608 From: $gMaintainerEmail ($gProject $gBug Tracking System)
610 Subject: $gBug#$ref: Acknowledgement of maintainer-only report
612 Message-ID: <handler.$ref.$nn.ackmaint\@$gEmailDomain>
613 In-Reply-To: $header{'message-id'}
614 References: $header{'message-id'}
615 X-$gProject-PR-Message: ack-maintonly $ref
617 Thank you for the problem report you have sent regarding $gProject.
618 This is an automatically generated reply, to let you know your message has
619 been received. It is being forwarded to the developers (but not the mailing
620 list, as you requested) for their attention; they will reply in due course.
622 If you wish to submit further information on your problem, please send
623 it to $ref-$baddressroot\@$gEmailDomain (and *not*
624 to $baddress\@$gEmailDomain).
626 Please do not reply to the address at the top of this message,
627 unless you wish to report a problem with the $gBug-tracking system.
630 (administrator, $gProject $gBugs database)
632 From: $gMaintainerEmail ($gProject $gBug Tracking System)
634 Subject: $gBug#$ref: Acknowledgement ($subject)
635 Message-ID: <handler.$ref.$nn.ack\@$gEmailDomain>
636 In-Reply-To: $header{'message-id'}
637 References: $header{'message-id'}
638 X-$gProject-PR-Message: ack $ref
640 Thank you for the problem report you have sent regarding $gProject.
641 This is an automatically generated reply, to let you know your message has
642 been received. It is being forwarded to the developers mailing list for
643 their attention; they will reply in due course.
645 If you wish to submit further information on your problem, please send
646 it to $ref\@$gEmailDomain (and *not* to
647 $baddress\@$gEmailDomain).
649 Please do not reply to the address at the top of this message,
650 unless you wish to report a problem with the $gBug-tracking system.
653 (administrator, $gProject $gBugs database)
655 } elsif ($codeletter ne 'U') {
656 &htmllog("Acknowledgement","sent",$replyto,
657 ($veryquiet ? "Extra info received and filed, but not forwarded." :
658 $codeletter eq 'M' ? "Extra info received and forwarded to maintainer." :
659 "Extra info received and forwarded to list."). $htmlbreak);
660 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
661 From: $gMaintainerEmail ($gProject $gBug Tracking System)
663 Subject: $gBug#$ref: Info received and FILED only
665 Message-ID: <handler.$ref.$nn.ackinfoquiet\@$gEmailDomain>
666 In-Reply-To: $header{'message-id'}
667 References: $header{'message-id'}
668 X-$gProject-PR-Message: ack-info-quiet $ref
670 Thank you for the additional information you have supplied regarding
671 this problem report. It has NOT been forwarded to the developers, but
672 will accompany the original report in the $gBug tracking system. Please
673 ensure that you yourself have sent a copy of the additional
674 information to any relevant developers or mailing lists.
676 If you wish to continue to submit further information on your problem,
677 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
679 Please do not reply to the address at the top of this message,
680 unless you wish to report a problem with the $gBug-tracking system.
683 (administrator, $gProject $gBugs database)
685 From: $gMaintainerEmail ($gProject $gBug Tracking System)
687 Subject: $gBug#$ref: Info received for maintainer only
689 Message-ID: <handler.$ref.$nn.ackinfomaint\@$gEmailDomain>
690 In-Reply-To: $header{'message-id'}
691 References: $header{'message-id'}
692 X-$gProject-PR-Message: ack-info $ref
694 Thank you for the additional information you have supplied regarding
695 this problem report. It has been forwarded to the developer(s) (but
696 not to the mailing list) to accompany the original report.
698 If you wish to continue to submit further information on your problem,
699 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
701 Please do not reply to the address at the top of this message,
702 unless you wish to report a problem with the $gBug-tracking system.
705 (administrator, $gProject $gBugs database)
707 From: $gMaintainerEmail ($gProject $gBug Tracking System)
709 Subject: $gBug#$ref: Info received (was $subject)
710 Message-ID: <handler.$ref.$nn.ackinfo\@$gEmailDomain>
711 In-Reply-To: $header{'message-id'}
712 References: $header{'message-id'}
713 X-$gProject-PR-Message: ack-info-maintonly $ref
715 Thank you for the additional information you have supplied regarding
716 this problem report. It has been forwarded to the developer(s) and
717 to the developers mailing list to accompany the original report.
719 If you wish to continue to submit further information on your problem,
720 please send it to $ref\@$gEmailDomain, as before.
722 Please do not reply to the address at the top of this message,
723 unless you wish to report a problem with the $gBug-tracking system.
726 (administrator, $gProject $gBugs database)
735 open(NEW,">$f.new") || &quit("$f.new: create: $!");
736 print(NEW "$v") || &quit("$f.new: write: $!");
737 close(NEW) || &quit("$f.new: close: $!");
738 rename("$f.new","$f") || &quit("rename $f.new to $f: $!");
742 if (!open(AP,">>db/$ref.log")) {
743 print DEBUG "failed open log<\n";
744 print DEBUG "failed open log err $!<\n";
745 &quit("opening db/$ref.log (li): $!");
747 print(AP "\7\n",@log,"\n\3\n") || &quit("writing db/$ref.log (li): $!");
748 close(AP) || &quit("closing db/$ref.log (li): $!");
752 utime(time,time,"db");
754 while ($u= $cleanups[$#cleanups]) { &$u; }
755 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
759 &quit("wot no exit");
761 sub chldhandle { $chldexit = 'yes'; }
764 local ($whatobj,$whatverb,$where,$desc) = @_;
765 open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lh): $!");
768 "<strong>$whatobj $whatverb</strong> to <code>".&sani($where).
769 "</code>:<br>\n". $desc.
770 "\n\3\n") || &quit("writing db/$ref.log (lh): $!");
771 close(AP) || &quit("closing db/$ref.log (lh): $!");
776 map { $_->address() }
777 map { Mail::Address->parse($_) } @_;
782 local ($msg,@recips) = @_;
783 if ($recips[0] eq '' && $#recips == 0) { @recips= ('-t'); }
785 #save email to the log
786 open(AP,">>db/$ref.log") || &quit("opening db/$ref.log (lo): $!");
787 print(AP "\2\n",join("\4",@recips),"\n\5\n$msg\n\3\n") ||
788 &quit("writing db/$ref.log (lo): $!");
789 close(AP) || &quit("closing db/$ref.log (lo): $!");
791 #if debbuging.. save email to a log
792 # open AP, ">>debug";
793 # print AP join( '|', @recips )."\n>>";
794 # print AP get_addresses( @recips );
795 # print AP "<<\n".$msg;
796 # print AP "\n--------------------------------------------------------\n";
800 $msg =~ /^Subject: (.*)$/;
801 $SIG{'CHLD'}='chldhandle';
802 #print DEBUG "mailing sigchild set up<\n";
805 #print DEBUG "mailing opened pipe fork<\n";
806 defined($c) || die $!;
807 #print DEBUG "mailing opened pipe fork ok $c<\n";
808 if (!$c) { # ie, we are in the child process
809 #print DEBUG "mailing child<\n";
810 unless (open(STDERR,">&STDOUT")) {
811 #print DEBUG "mailing child opened stderr<\n";
812 print STDOUT "redirect stderr: $!\n";
813 #print DEBUG "mailing child opened stderr fail<\n";
815 #print DEBUG "mailing child opened stderr fail exit !?<\n";
817 #print DEBUG "mailing child opened stderr ok<\n";
819 #print DEBUG "mailing child forked again<\n";
820 defined($c) || die $!;
821 #print DEBUG "mailing child forked again ok $c<\n";
822 if (!$c) { # ie, we are the child process
823 #print DEBUG "mailing grandchild<\n";
824 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odi','-oem','-oi',get_addresses(@recips);
825 #print DEBUG "mailing grandchild exec failed<\n";
827 #print DEBUG "mailing grandchild died !?<\n";
829 #print DEBUG "mailing child not grandchild<\n";
830 print(D $msg) || die $!;
831 #print DEBUG "mailing child printed msg<\n";
833 #print DEBUG "mailing child closed pipe<\n";
834 die "\n*** command returned exit status $?\n" if $?;
835 #print DEBUG "mailing child exit status ok<\n";
837 #print DEBUG "mailing child exited ?!<\n";
839 #print DEBUG "mailing parent<\n";
841 #print DEBUG "mailing parent results emptied<\n";
842 while( $chldexit eq 'no' ) { $results.= $_; }
843 #print DEBUG "mailing parent results read >$results<\n";
845 #print DEBUG "mailing parent results closed<\n";
846 $results.= "\n*** child returned exit status $?\n" if $?;
847 #print DEBUG "mailing parent exit status ok<\n";
848 $SIG{'CHLD'}='DEFAULT';
849 #print DEBUG "mailing parent sigchild default<\n";
850 if (length($results)) { &quit("running sendmail: $results"); }
851 #print DEBUG "mailing parent results ok<\n";
854 sub checkmaintainers {
855 return if $maintainerschecked++;
856 return if !length($s_package);
857 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
859 m/^(\S+)\s+(\S.*\S)\n$/ || &quit("maintainers bogus \`$_'");
860 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
861 $maintainerof{$1}= $2;
864 $anymaintfound=0; $anymaintnotfound=0;
865 for $p (split(m/[ \t?,()]+/,$s_package)) {
867 if (defined($maintainerof{$p})) {
868 print DEBUG "maintainer add >$p|$maintainerof{$p}<\n";
869 $addmaint= $maintainerof{$p};
870 push(@maintaddrs,$addmaint) unless
871 $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs);
874 print DEBUG "maintainer none >$p<\n";