2 # $Id: process.in,v 1.38 2001/09/18 20:12:54 joy Exp $
8 $config_path = '/org/bugs.debian.org/etc';
9 $lib_path = '/org/bugs.debian.org/scripts';
11 require "$config_path/config";
12 require "$lib_path/errorlib";
13 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
15 chdir( "$gSpoolDir" ) || die 'chdir spool: $!\n';
17 #open(DEBUG,"> /tmp/debbugs.debug");
19 open DEBUG, ">/dev/null";
21 defined( $intdate= time ) || &quit( "failed to get time: $!" );
24 m/^([BMQFDU])(\d*)\.\d+$/ || &quit("bad argument");
26 $tryref= length($2) ? $2+0 : -1;
29 if (!rename("incoming/G$nn","incoming/P$nn"))
30 { $_=$!.''; m/no such file or directory/i && exit 0;
31 &quit("renaming to lock: $!");
34 $baddress= 'submit' if $codeletter eq 'B';
35 $baddress= 'maintonly' if $codeletter eq 'M';
36 $baddress= 'quiet' if $codeletter eq 'Q';
37 $baddress= 'forwarded' if $codeletter eq 'F';
38 $baddress= 'done' if $codeletter eq 'D';
39 $baddress= 'submitter' if $codeletter eq 'U';
40 $baddress || &quit("bad codeletter $codeletter");
41 $baddressroot= $baddress;
42 $baddress= "$tryref-$baddress" if $tryref>=0;
44 open(M,"incoming/P$nn");
51 print DEBUG "###\n",join("##\n",@msg),"\n###\n";
53 chop($tdate= `date -u '+%a, %d %h %Y %T GMT'`);
55 X-Loop: $gMaintainerEmail
56 Received: via spool by $baddress\@$gEmailDomain id=$nn
57 (code $codeletter ref $tryref); $tdate
60 # Process the message's mail headers
61 for ($i=0; $i<=$#msg; $i++) {
63 last unless length($_);
64 &quit("looping detected") if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
65 $ins= !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i
66 && !m/^From / && !m/^X-Debbugs-CC:/i && !m/^received:/i;
67 $fwd .= $_."\n" if $ins;
68 while ($msg[$i+1] =~ m/^\s/) {
70 $fwd .= $msg[$i]."\n" if $ins;
73 # print DEBUG ">$_<\n";
75 $v= $1; $v =~ y/A-Z/a-z/;
76 print DEBUG ">$v=$_<\n";
79 print DEBUG "!>$_<\n";
84 while ($i <= $#msg && !length($msg[$i])) { $fwd .= "\n"; $i++; }
86 #skips the "this is mime" message and any blank space after it
87 if ( $msg[$i] =~ /^This is a multi-part message in MIME format./ )
89 while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; }
90 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
92 #if the lines starts with -- or is nothing but blank space...
93 #skip to the next blank line(s) then skip past the blank line(s)
94 if ( $msg[$i] =~ /^--/ || $msg[$i] =~ /^\s*$/ )
96 while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; }
97 while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; }
100 while (defined ($msg[$i] ) )
102 last if ( $msg[$i] !~ m/^([\w]+):\s*(\S.*)/ );
105 print DEBUG ">$fn|$'|\n";
106 $fwd .= $fn.': '.$fv."\n";
110 print DEBUG ">$fn~$fv<\n";
114 $fwd .= join("\n",@msg[$i..$#msg]);
116 print DEBUG "***\n$fwd\n***\n";
118 if (defined $header{'resent-from'} && !defined $header{'from'}) {
119 $header{'from'} = $header{'resent-from'};
121 defined($header{'from'}) || &quit("no From header");
122 $replyto= defined($header{'reply-to'}) ? $header{'reply-to'} : $header{'from'};
125 $_= "$2 <$1>" if m/^([^\<\> \t\n\(\)]+) \(([^\(\)\<\>]+)\)$/;
127 print DEBUG "replytocompare >$replytocompare<\n";
129 if (!defined($header{'subject'}))
130 { $brokenness.= <<END;
132 Your message did not contain a Subject field. This is broken, I am
133 afraid - the Subject: line is a Required Header according to RFC822.
134 Please remember to include a Subject field in your messages in future.
135 If you did so the fact that it got lost probably indicates a poorly
136 configured mail system at your site or an intervening one.
138 $subject= '(no subject)';
139 } else { $subject= $header{'subject'}; }
142 $subject =~ s/^Re:\s*//i; $_= $subject."\n";
143 if ($tryref < 0 && m/^Bug ?\#(\d+)\D/i) { $tryref= $1+0; }
146 { $bfound= &lockreadbugmerge($tryref);
147 if ($bfound) { $ref= $tryref; }
149 { &htmllog("Reply","sent", $replyto,"Unknown problem report number <code>$tryref</code>.");
150 &sendmessage(<<END, '');
151 From: $gMaintainerEmail ($gProject $gBug Tracking System)
153 Subject: Unknown problem report $gBug#$tryref ($subject)
154 Message-ID: <handler.x.$nn.unknown\@$gEmailDomain>
155 In-Reply-To: $header{'message-id'}
156 References: $header{'message-id'} $s_msgid
157 X-$gProject-PR-Message: error
159 You sent a message to the $gBug tracking system which gave (in the
160 Subject line or encoded into the recipient at $gEmailDomain),
161 the number of a nonexistent $gBug report (#$tryref).
163 This may be because that $gBug report has been resolved for more than $gRemoveAge
164 days, and the record of it has been expunged, or because you mistyped
165 the $gBug report number.
167 Your message was dated $header{'date'} and was sent to
168 $baddress\@$gEmailDomain. It had
169 Message-ID $header{'message-id'}
170 and Subject $subject.
172 It has been filed (under junk) but otherwise ignored.
174 Please consult your records to find the correct $gBug report number, or
175 contact me, the system administrator, for assistance.
178 (administrator, $gProject $gBugs database)
180 (NB: If you are a system administrator and have no idea what I am
181 talking about this indicates a serious mail system misconfiguration
182 somewhere. Please contact me immediately.)
188 } else { &filelock('lock/-1'); }
190 if ($codeletter eq 'D' || $codeletter eq 'F')
191 { if ($replyto =~ m/$gBounceFroms/o ||
192 $header{'from'} =~ m/$gBounceFroms/o)
193 { &quit("bounce detected ! Mwaap! Mwaap!"); }
194 $markedby= $header{'from'} eq $replyto ? $replyto :
195 "$header{'from'} (reply to $replyto)";
196 if ($codeletter eq 'F')
197 { (&appendlog,&finish) if length($s_forwarded);
198 $receivedat= "forwarded\@$gEmailDomain";
199 $markaswhat= 'forwarded';
200 $set_forwarded= $header{'to'};
201 if ( length( $gListDomain ) > 0 && length( $gFowardList ) > 0 )
202 { $generalcc= "$gFowardList\@$gListDomain"; }
203 else { $generalcc=''; }
205 { (&appendlog,&finish) if length($s_done);
206 $receivedat= "done\@$gEmailDomain";
208 $set_done= $header{'from'};
209 if ( length( $gListDomain ) > 0 && length( $gDoneList ) > 0 )
210 { $generalcc= "$gDoneList\@$gListDomain"; }
211 else { $generalcc=''; }
214 { &htmllog("Warning","sent",$replyto,"Message ignored.");
215 &sendmessage(<<END, '');
216 From: $gMaintainerEmail ($gProject $gBug Tracking System)
218 Subject: Message with no $gBug number ignored by $receivedat
220 Message-ID: <header.x.$nn.warnignore\@$gEmailDomain>
221 In-Reply-To: $header{'message-id'}
222 References: $header{'message-id'} $s_msgid
223 X-$gProject-PR-Message: error
225 You sent a message to the $gProject $gBug tracking system old-style
226 unified mark as $markaswhat address ($receivedat),
227 without a recognisable $gBug number in the Subject.
228 Your message has been filed under junk but otherwise ignored.
230 If you don't know what I'm talking about then probably either:
232 (a) you unwittingly sent a message to done\@$gEmailDomain
233 because you replied to all recipients of the message a developer used
234 to mark a $gBug as done and you modified the Subject. In this case,
235 please do not be alarmed. To avoid confusion do not do it again, but
236 there is no need to apologise or mail anyone asking for an explanation.
238 (b) you are a system administrator, reading this because the $gBug
239 tracking system is responding to a misdirected bounce message. In this
240 case there is a serious mail system misconfiguration somewhere - please
241 contact me immediately.
243 Your message was dated $header{'date'} and had
244 message-id $header{'message-id'}
245 and subject $subject.
247 If you need any assistance or explanation please contact me.
250 (administrator, $gProject $gBugs database)
257 $noticeccval.= join(', ', grep($_ ne $replyto,@maintaddrs));
258 $noticeccval =~ s/\s+\n\s+/ /g; $noticeccval =~ s/^\s+/ /; $noticeccval =~ s/\s+$//;
259 if (length($noticeccval)) { $noticecc= "Cc: $noticeccval\n"; }
260 if (length($generalcc)) { $noticecc.= "Bcc: $generalcc\n"; }
261 @process= ($ref,split(/ /,$s_mergedwith));
264 { if ($ref != $orgref)
266 &lockreadbug($ref) || die "huh ? $ref from $orgref out of @process";
268 $s_done= $set_done if defined($set_done);
269 $s_forwarded= $set_forwarded if defined($set_forwarded);
270 my $hash = get_hashname($ref);
271 &overwrite("db-h/$hash/$ref.status",
272 "$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
273 "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
274 &bughook('change',$ref,
275 "$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
276 "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
277 open(O,"db-h/$hash/$ref.report") || &quit("read original report: $!");
278 $x= join('',<O>); close(O);
279 if ($codeletter eq 'F')
280 { &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded.");
281 &sendmessage(<<END, '');
282 From: $gMaintainerEmail ($gProject $gBug Tracking System)
284 ${noticecc}Subject: $gBug#$ref: marked as forwarded ($s_subject)
285 Message-ID: <header.$ref.$nn.ackfwdd\@$gEmailDomain>
286 In-Reply-To: $header{'message-id'}
287 References: $header{'message-id'} $s_msgid
288 X-$gProject-PR-Message: forwarded $ref
290 Your message dated $header{'date'}
291 with message-id $header{'message-id'}
292 has caused the $gProject $gBug report #$ref,
294 to be marked as having been forwarded to the upstream software
295 author(s) $s_forwarded.
297 (NB: If you are a system administrator and have no idea what I am
298 talking about this indicates a serious mail system misconfiguration
299 somewhere. Please contact me immediately.)
302 (administrator, $gProject $gBugs database)
306 { &htmllog("Reply","sent",$replyto,"You have taken responsibility.");
307 &sendmessage(<<END."--------------------------------------\n".$x."---------------------------------------\n".join( "\n", @msg ), '');
308 From: $gMaintainerEmail ($gProject $gBug Tracking System)
310 ${noticecc}Subject: $gBug#$ref: marked as done ($s_subject)
311 Message-ID: <handler.$ref.$nn.ackdone\@$gEmailDomain>
312 In-Reply-To: $header{'message-id'}
313 References: $header{'message-id'} $s_msgid
314 X-$gProject-PR-Message: closed $ref
316 Your message dated $header{'date'}
317 with message-id $header{'message-id'}
318 and subject line $subject
319 has caused the attached $gBug report to be marked as done.
321 This means that you claim that the problem has been dealt with.
322 If this is not the case it is now your responsibility to reopen the
323 $gBug report if necessary, and/or fix the problem forthwith.
325 (NB: If you are a system administrator and have no idea what I am
326 talking about this indicates a serious mail system misconfiguration
327 somewhere. Please contact me immediately.)
330 (administrator, $gProject $gBugs database)
333 &htmllog("Notification","sent",$s_originator,
334 "$gBug acknowledged by developer.");
335 &sendmessage(<<END.join("\n",@msg),'');
336 From: $gMaintainerEmail ($gProject $gBug Tracking System)
338 Subject: $gBug#$ref acknowledged by developer
340 Message-ID: <handler.$ref.$nn.notifdone\@$gEmailDomain>
341 In-Reply-To: $s_msgid
342 References: $header{'message-id'} $s_msgid
343 X-$gProject-PR-Message: they-closed $ref
344 Reply-To: $ref\@$gEmailDomain
346 This is an automatic notification regarding your $gBug report
348 which was filed against the $s_package package.
350 It has been closed by one of the developers, namely
353 Their explanation is attached below. If this explanation is
354 unsatisfactory and you have not received a better one in a separate
355 message then please contact the developer, by replying to this email.
358 (administrator, $gProject $gBugs database)
368 { if ($codeletter eq 'U')
369 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
370 &sendmessage(<<END, '');
371 From: $gMaintainerEmail ($gProject $gBug Tracking System)
373 Subject: Message with no $gBug number cannot be sent to submitter !
375 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
376 In-Reply-To: $header{'message-id'}
377 References: $header{'message-id'} $s_msgid
378 X-$gProject-PR-Message: error
380 You sent a message to the $gProject $gBug tracking system send to $gBug
381 report submitter address $baddress\@$gEmailDomain, without a
382 recognisable $gBug number in the Subject. Your message has been filed
383 under junk but otherwise ignored.
385 If you don't know what I'm talking about then probably either:
387 (a) you unwittingly sent a message to $baddress\@$gEmailDomain
388 because you replied to all recipients of the message a developer sent
389 to a $gBug's submitter and you modified the Subject. In this case,
390 please do not be alarmed. To avoid confusion do not do it again, but
391 there is no need to apologise or mail anyone asking for an
394 (b) you are a system administrator, reading this because the $gBug
395 tracking system is responding to a misdirected bounce message. In this
396 case there is a serious mail system misconfiguration somewhere - please
397 contact me immediately.
399 Your message was dated $header{'date'} and had
400 message-id $header{'message-id'}
401 and subject $subject.
403 If you need any assistance or explanation please contact me.
406 (administrator, $gProject $gBugs database)
412 if (!defined($pheader{'package'}))
413 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
414 &sendmessage(<<END."---------------------------------------------------------------------------\n".join("\n", @msg), '');
415 From: $gMaintainerEmail ($gProject $gBug Tracking System)
417 Subject: Message with no Package: tag cannot be processed!
419 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
420 In-Reply-To: $header{'message-id'}
421 References: $header{'message-id'} $s_msgid
422 X-$gProject-PR-Message: error
424 Your message didn't have a Package: line at the start (in the
425 pseudo-header following the real mail header), or didn't have a
426 pseudo-header at all.
428 This makes it much harder for us to categorise and deal with your
429 problem report. Please _resubmit_ your report and tell us which package
430 the report is on. For help, check out http://$gWebDomain/Reporting.html.
432 Your message was dated $header{'date'} and had
433 message-id $header{'message-id'}
434 and subject $subject.
435 The complete text of it is attached to this message.
437 If you need any assistance or explanation please contact me.
440 (administrator, $gProject $gBugs database)
445 } else { $s_package= $pheader{'package'}; }
447 if (defined($pheader{'keywords'})) {
448 $s_keywords= $pheader{'keywords'};
449 } elsif (defined($pheader{'tags'})) {
450 $s_keywords= $pheader{'tags'};
452 if (length($s_keywords)) {
454 my %gkws = map { ($_, 1) } @gTags;
455 foreach my $kw (sort split(/[,\s]+/, lc($s_keywords))) {
456 push @kws, $kw if (defined $gkws{$kw});
458 $s_keywords = join(" ", @kws);
461 if (defined($pheader{'severity'}) || defined($pheader{'priority'}))
462 { $s_severity= $pheader{'severity'};
463 $s_severity= $pheader{'priority'} unless ($s_severity);
465 if (!grep($_ eq $s_severity, @severities, "$gDefaultSeverity")) {
468 Your message specified a Severity: in the pseudo-header, but
469 the severity value $s_severity was not recognised.
470 The default severity $gDefaultSeverity is being used instead.
471 The recognised values are: $gShowSeverities.
473 # if we use @gSeverityList array in the above line, perl -c gives:
474 # In string, @gSeverityList now must be written as \@gSeverityList at
475 # process line 452, near "$gDefaultSeverity is being used instead.
479 &filelock("nextnumber.lock");
480 open(N,"nextnumber") || &quit("nextnumber: read: $!");
481 $v=<N>; $v =~ s/\n$// || &quit("nextnumber bad format");
482 $ref= $v+0; $v += 1; $newref=1;
483 &overwrite('nextnumber', "$v\n");
485 my $hash = get_hashname($ref);
486 &overwrite("db-h/$hash/$ref.log",'');
487 &overwrite("db-h/$hash/$ref.status",
488 "$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
489 "$s_package\n$s_keywords\n\n\n\n$s_severity\n");
491 "$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
492 "$s_package\n$s_keywords\n\n\n\n$s_severity\n");
493 &overwrite("db-h/$hash/$ref.report",
494 join("\n",@msg)."\n");
499 print DEBUG "maintainers >@maintaddrs<\n";
501 $orgsender= defined($header{'sender'}) ? "Orignal-Sender: $header{'sender'}\n" : '';
502 $newsubject= $subject; $newsubject =~ s/^$gBug#$ref\W*\s*//;
504 $xcchdr= $header{ 'x-debbugs-cc' };
505 if ($xcchdr =~ m/\S/) {
506 push(@resentccs,$xcchdr);
507 $resentccexplain.= <<END;
509 As you requested using X-Debbugs-CC, your message was also forwarded to
511 (after having been given a $gBug report number, if it did not have one).
515 if (@maintaddrs && ($codeletter eq 'B' || $codeletter eq 'M')) {
516 push(@resentccs,@maintaddrs);
517 $resentccexplain.= <<END." ".join("\n ",@maintaddrs)."\n";
519 Your message has been sent to the package maintainer(s):
523 $veryquiet= $codeletter eq 'Q';
524 if ($codeletter eq 'M' && !@maintaddrs) {
528 You requested that the message be sent to the package maintainer(s)
529 but either the $gBug report is not associated with any package (probably
530 because of a missing Package pseudo-header field in the original $gBug
531 report), or the package(s) specified do not have any maintainer(s).
533 Your message has *not* been sent to any package maintainers; it has
534 merely been filed in the $gBug tracking system. If you require assistance
535 please contact $gMaintainerEmail quoting the $gBug number $ref.
539 $resentccval.= join(', ',@resentccs);
540 $resentccval =~ s/\s+\n\s+/ /g; $resentccval =~ s/^\s+/ /; $resentccval =~ s/\s+$//;
541 if (length($resentccval)) { $resentcc= "Resent-CC: $resentccval\n"; }
543 if ($codeletter eq 'U') {
544 &htmllog("Message", "sent on", $s_originator, "$gBug#$ref.");
545 &sendmessage(<<END,$s_originator,@resentccs);
546 Subject: $gBug#$ref: $newsubject
547 Reply-To: $replyto, $ref-quiet\@$gEmailDomain
548 ${orgsender}Resent-To: $s_originator
549 ${resentcc}Resent-Date: $tdate
550 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
551 Resent-Sender: $gMaintainerEmail
552 X-$gProject-PR-Message: report $ref
553 X-$gProject-PR-Package: $s_package
554 X-$gProject-PR-Keywords: $s_keywords
557 } elsif ($codeletter eq 'B') {
558 &htmllog($newref ? "Report" : "Information", "forwarded",
559 join(', ',"$gSubmitList\@$gListDomain",@resentccs),
560 "<code>$gBug#$ref</code>".
561 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
563 &sendmessage(<<END,"$gSubmitList\@$gListDomain",@resentccs);
564 Subject: $gBug#$ref: $newsubject
565 Reply-To: $replyto, $ref\@$gEmailDomain
566 Resent-From: $header{'from'}
567 ${orgsender}Resent-To: $gSubmitList\@$gListDomain
568 ${resentcc}Resent-Date: $tdate
569 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
570 Resent-Sender: $gMaintainerEmail
571 X-$gProject-PR-Message: report $ref
572 X-$gProject-PR-Package: $s_package
573 X-$gProject-PR-Keywords: $s_keywords
576 } elsif (@resentccs) {
577 # D and F done far earlier; B just done - so this must be M or Q
578 # We preserve whichever it was in the Reply-To (possibly adding
580 &htmllog($newref ? "Report" : "Information", "forwarded",
582 "<code>$gBug#$ref</code>".
583 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
585 &sendmessage(<<END,@resentccs);
586 Subject: $gBug#$ref: $newsubject
587 Reply-To: $replyto, $ref-$baddressroot\@$gEmailDomain
588 Resent-From: $header{'from'}
589 ${orgsender}Resent-To: $resentccval
591 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
592 Resent-Sender: $gMaintainerEmail
593 X-$gProject-PR-Message: report $ref
594 X-$gProject-PR-Package: $s_package
595 X-$gProject-PR-Keywords: $s_keywords
600 $htmlbreak= length($brokenness) ? "<p>\n".&sani($brokenness)."\n<p>\n" : '';
601 $htmlbreak =~ s/\n\n/\n<P>\n\n/g;
602 if (length($resentccval)) {
604 " Copy sent to <code>".&sani($resentccval)."</code>.".
608 &htmllog("Acknowledgement","sent",$replyto,
610 "New $gBug report received and filed, but not forwarded." :
611 "New $gBug report received and forwarded."). $htmlbreak);
612 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
613 From: $gMaintainerEmail ($gProject $gBug Tracking System)
615 Subject: $gBug#$ref: Acknowledgement of QUIET report
617 Message-ID: <handler.$ref.$nn.ackquiet\@$gEmailDomain>
618 In-Reply-To: $header{'message-id'}
619 References: $header{'message-id'}
620 X-$gProject-PR-Message: ack-quiet $ref
621 Reply-To: $ref-quiet\@$gEmailDomain
623 Thank you for the problem report you have sent regarding $gProject.
624 This is an automatically generated reply, to let you know your message
625 has been received. It has not been forwarded to the developers or
626 their mailing list; you should ensure that the developers are aware of
627 the problem you have entered into the system - preferably quoting the
628 $gBug reference number, #$ref.
630 If you wish to submit further information on your problem, please send it
631 to $ref-$baddressroot\@$gEmailDomain (and *not*
632 to $baddress\@$gEmailDomain).
634 Please do not reply to the address at the top of this message,
635 unless you wish to report a problem with the $gBug-tracking system.
638 (administrator, $gProject $gBugs database)
640 From: $gMaintainerEmail ($gProject $gBug Tracking System)
642 Subject: $gBug#$ref: Acknowledgement of maintainer-only report
644 Message-ID: <handler.$ref.$nn.ackmaint\@$gEmailDomain>
645 In-Reply-To: $header{'message-id'}
646 References: $header{'message-id'}
647 X-$gProject-PR-Message: ack-maintonly $ref
648 Reply-To: $ref-maintonly\@$gEmailDomain
650 Thank you for the problem report you have sent regarding $gProject.
651 This is an automatically generated reply, to let you know your message has
652 been received. It is being forwarded to the developers (but not the mailing
653 list, as you requested) for their attention; they will reply in due course.
655 If you wish to submit further information on your problem, please send
656 it to $ref-$baddressroot\@$gEmailDomain (and *not*
657 to $baddress\@$gEmailDomain).
659 Please do not reply to the address at the top of this message,
660 unless you wish to report a problem with the $gBug-tracking system.
663 (administrator, $gProject $gBugs database)
665 From: $gMaintainerEmail ($gProject $gBug Tracking System)
667 Subject: $gBug#$ref: Acknowledgement ($subject)
668 Message-ID: <handler.$ref.$nn.ack\@$gEmailDomain>
669 In-Reply-To: $header{'message-id'}
670 References: $header{'message-id'}
671 X-$gProject-PR-Message: ack $ref
672 Reply-To: $ref\@$gEmailDomain
674 Thank you for the problem report you have sent regarding $gProject.
675 This is an automatically generated reply, to let you know your message has
676 been received. It is being forwarded to the developers mailing list for
677 their attention; they will reply in due course.
679 If you wish to submit further information on your problem, please send
680 it to $ref\@$gEmailDomain (and *not* to
681 $baddress\@$gEmailDomain).
683 Please do not reply to the address at the top of this message,
684 unless you wish to report a problem with the $gBug-tracking system.
687 (administrator, $gProject $gBugs database)
689 } elsif ($codeletter ne 'U') {
690 &htmllog("Acknowledgement","sent",$replyto,
691 ($veryquiet ? "Extra info received and filed, but not forwarded." :
692 $codeletter eq 'M' ? "Extra info received and forwarded to maintainer." :
693 "Extra info received and forwarded to list."). $htmlbreak);
694 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
695 From: $gMaintainerEmail ($gProject $gBug Tracking System)
697 Subject: $gBug#$ref: Info received and FILED only
699 Message-ID: <handler.$ref.$nn.ackinfoquiet\@$gEmailDomain>
700 In-Reply-To: $header{'message-id'}
701 References: $header{'message-id'}
702 X-$gProject-PR-Message: ack-info-quiet $ref
703 Reply-To: $ref-quiet\@$gEmailDomain
705 Thank you for the additional information you have supplied regarding
706 this problem report. It has NOT been forwarded to the developers, but
707 will accompany the original report in the $gBug tracking system. Please
708 ensure that you yourself have sent a copy of the additional
709 information to any relevant developers or mailing lists.
711 If you wish to continue to submit further information on your problem,
712 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
714 Please do not reply to the address at the top of this message,
715 unless you wish to report a problem with the $gBug-tracking system.
718 (administrator, $gProject $gBugs database)
720 From: $gMaintainerEmail ($gProject $gBug Tracking System)
722 Subject: $gBug#$ref: Info received for maintainer only
724 Message-ID: <handler.$ref.$nn.ackinfomaint\@$gEmailDomain>
725 In-Reply-To: $header{'message-id'}
726 References: $header{'message-id'}
727 X-$gProject-PR-Message: ack-info-maintonly $ref
728 Reply-To: $ref-maintonly\@$gEmailDomain
730 Thank you for the additional information you have supplied regarding
731 this problem report. It has been forwarded to the developer(s) (but
732 not to the mailing list) to accompany the original report.
734 If you wish to continue to submit further information on your problem,
735 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
737 Please do not reply to the address at the top of this message,
738 unless you wish to report a problem with the $gBug-tracking system.
741 (administrator, $gProject $gBugs database)
743 From: $gMaintainerEmail ($gProject $gBug Tracking System)
745 Subject: $gBug#$ref: Info received (was $subject)
746 Message-ID: <handler.$ref.$nn.ackinfo\@$gEmailDomain>
747 In-Reply-To: $header{'message-id'}
748 References: $header{'message-id'}
749 X-$gProject-PR-Message: ack-info $ref
750 Reply-To: $ref\@$gEmailDomain
752 Thank you for the additional information you have supplied regarding
753 this problem report. It has been forwarded to the developer(s) and
754 to the developers mailing list to accompany the original report.
756 If you wish to continue to submit further information on your problem,
757 please send it to $ref\@$gEmailDomain, as before.
759 Please do not reply to the address at the top of this message,
760 unless you wish to report a problem with the $gBug-tracking system.
763 (administrator, $gProject $gBugs database)
772 open(NEW,">$f.new") || &quit("$f.new: create: $!");
773 print(NEW "$v") || &quit("$f.new: write: $!");
774 close(NEW) || &quit("$f.new: close: $!");
775 rename("$f.new","$f") || &quit("rename $f.new to $f: $!");
779 my $hash = get_hashname($ref);
780 if (!open(AP,">>db-h/$hash/$ref.log")) {
781 print DEBUG "failed open log<\n";
782 print DEBUG "failed open log err $!<\n";
783 &quit("opening db-h/$hash/$ref.log (li): $!");
785 print(AP "\7\n",@log,"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!");
786 close(AP) || &quit("closing db-h/$hash/$ref.log (li): $!");
790 utime(time,time,"db");
792 while ($u= $cleanups[$#cleanups]) { &$u; }
793 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
797 &quit("wot no exit");
799 sub chldhandle { $chldexit = 'yes'; }
802 local ($whatobj,$whatverb,$where,$desc) = @_;
803 my $hash = get_hashname($ref);
804 open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lh): $!");
807 "<strong>$whatobj $whatverb</strong> to <code>".&sani($where).
808 "</code>:<br>\n". $desc.
809 "\n\3\n") || &quit("writing db-h/$hash/$ref.log (lh): $!");
810 close(AP) || &quit("closing db-h/$hash/$ref.log (lh): $!");
815 map { $_->address() }
816 map { Mail::Address->parse($_) } @_;
821 local ($msg,@recips) = @_;
822 if ($recips[0] eq '' && $#recips == 0) { @recips= ('-t'); }
824 my $hash = get_hashname($ref);
825 #save email to the log
826 open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lo): $!");
827 print(AP "\2\n",join("\4",@recips),"\n\5\n$msg\n\3\n") ||
828 &quit("writing db-h/$hash/$ref.log (lo): $!");
829 close(AP) || &quit("closing db-h/$hash/$ref.log (lo): $!");
831 #if debbuging.. save email to a log
832 # open AP, ">>debug";
833 # print AP join( '|', @recips )."\n>>";
834 # print AP get_addresses( @recips );
835 # print AP "<<\n".$msg;
836 # print AP "\n--------------------------------------------------------\n";
841 $SIG{'CHLD'}='chldhandle';
842 #print DEBUG "mailing sigchild set up<\n";
845 #print DEBUG "mailing opened pipe fork<\n";
846 defined($c) || die $!;
847 #print DEBUG "mailing opened pipe fork ok $c<\n";
848 if (!$c) { # ie, we are in the child process
849 #print DEBUG "mailing child<\n";
850 unless (open(STDERR,">&STDOUT")) {
851 #print DEBUG "mailing child opened stderr<\n";
852 print STDOUT "redirect stderr: $!\n";
853 #print DEBUG "mailing child opened stderr fail<\n";
855 #print DEBUG "mailing child opened stderr fail exit !?<\n";
857 #print DEBUG "mailing child opened stderr ok<\n";
859 #print DEBUG "mailing child forked again<\n";
860 defined($c) || die $!;
861 #print DEBUG "mailing child forked again ok $c<\n";
862 if (!$c) { # ie, we are the child process
863 #print DEBUG "mailing grandchild<\n";
864 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odq','-oem','-oi',get_addresses(@recips);
865 #print DEBUG "mailing grandchild exec failed<\n";
867 #print DEBUG "mailing grandchild died !?<\n";
869 #print DEBUG "mailing child not grandchild<\n";
870 print(D $msg) || die $!;
871 #print DEBUG "mailing child printed msg<\n";
873 #print DEBUG "mailing child closed pipe<\n";
874 die "\n*** command returned exit status $?\n" if $?;
875 #print DEBUG "mailing child exit status ok<\n";
877 #print DEBUG "mailing child exited ?!<\n";
879 #print DEBUG "mailing parent<\n";
881 #print DEBUG "mailing parent results emptied<\n";
882 while( $chldexit eq 'no' ) { $results.= $_; }
883 #print DEBUG "mailing parent results read >$results<\n";
885 #print DEBUG "mailing parent results closed<\n";
886 $results.= "\n*** child returned exit status $?\n" if $?;
887 #print DEBUG "mailing parent exit status ok<\n";
888 $SIG{'CHLD'}='DEFAULT';
889 #print DEBUG "mailing parent sigchild default<\n";
890 if (length($results)) { &quit("running sendmail: $results"); }
891 #print DEBUG "mailing parent results ok<\n";
894 sub checkmaintainers {
895 return if $maintainerschecked++;
896 return if !length($s_package);
897 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
901 m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers bogus \`$_'");
902 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
903 $maintainerof{$1}= $2;
906 open(MAINT,"$gMaintainerFileOverride") || die &quit("maintainers.override open: $!");
910 m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers.override bogus \`$_'");
911 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
912 $maintainerof{$1}= $2;
915 $anymaintfound=0; $anymaintnotfound=0;
916 for $p (split(m/[ \t?,()]+/,$s_package)) {
918 if (defined($maintainerof{$p})) {
919 print DEBUG "maintainer add >$p|$maintainerof{$p}<\n";
920 $addmaint= $maintainerof{$p};
921 push(@maintaddrs,$addmaint) unless
922 $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs);
925 print DEBUG "maintainer none >$p<\n";
926 push(@maintaddrs,$gUnknownMaintainerEmail) unless $anymaintnotfound;