2 # $Id: process.in,v 1.53 2002/10/21 08:37:29 cjwatson Exp $
10 $config_path = '/org/bugs.debian.org/etc';
11 $lib_path = '/org/bugs.debian.org/scripts';
13 require "$config_path/config";
14 require "$lib_path/errorlib";
15 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
17 chdir( "$gSpoolDir" ) || die "chdir spool: $!\n";
19 #open(DEBUG,"> /tmp/debbugs.debug");
21 open DEBUG, ">/dev/null";
23 defined( $intdate= time ) || &quit( "failed to get time: $!" );
26 m/^([BMQFDU])(\d*)\.\d+$/ || &quit("bad argument");
28 $tryref= length($2) ? $2+0 : -1;
31 if (!rename("incoming/G$nn","incoming/P$nn"))
32 { $_=$!.''; m/no such file or directory/i && exit 0;
33 &quit("renaming to lock: $!");
36 $baddress= 'submit' if $codeletter eq 'B';
37 $baddress= 'maintonly' if $codeletter eq 'M';
38 $baddress= 'quiet' if $codeletter eq 'Q';
39 $baddress= 'forwarded' if $codeletter eq 'F';
40 $baddress= 'done' if $codeletter eq 'D';
41 $baddress= 'submitter' if $codeletter eq 'U';
42 $baddress || &quit("bad codeletter $codeletter");
43 $baddressroot= $baddress;
44 $baddress= "$tryref-$baddress" if $tryref>=0;
46 open(M,"incoming/P$nn");
53 print DEBUG "###\n",join("##\n",@msg),"\n###\n";
55 chop($tdate= `date -u '+%a, %d %h %Y %T GMT'`);
57 Received: via spool by $baddress\@$gEmailDomain id=$nn
58 (code $codeletter ref $tryref); $tdate
61 # header and decoded body respectively
62 my (@headerlines, @bodylines);
64 my $parser = new MIME::Parser;
65 mkdir "$gSpoolDir/mime.tmp", 0777;
66 $parser->output_under("$gSpoolDir/mime.tmp");
67 my $entity = eval { $parser->parse_data(join('',@log)) };
69 if ($entity and $entity->head->tags) {
70 @headerlines = @{$entity->head->header};
73 my $entity_body = getmailbody($entity);
74 @bodylines = $entity_body ? $entity_body->as_lines() : ();
77 # set $i to beginning of encoded body data, so we can dump it out
80 ++$i while $msg[$i] =~ /./;
82 # Legacy pre-MIME code, kept around in case MIME::Parser fails.
83 for ($i = 0; $i <= $#msg; $i++) {
85 last unless length($_);
86 while ($msg[$i+1] =~ m/^\s/) {
90 push @headerlines, $_;
93 @bodylines = @msg[$i..$#msg];
96 for my $hdr (@headerlines) {
99 &quit("looping detected")
100 if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
101 my $ins = !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i
102 && !m/^From / && !m/^X-Debbugs-CC:/i && !m/^received:/i;
103 $fwd .= $hdr."\n" if $ins;
104 # print DEBUG ">$_<\n";
105 if (s/^(\S+):\s*//) {
107 print DEBUG ">$v=$_<\n";
110 print DEBUG "!>$_<\n";
115 shift @bodylines while @bodylines and $bodylines[0] !~ /\S/;
117 # Strip off RFC2440-style PGP clearsigning.
118 if (@bodylines and $bodylines[0] =~ /^-----BEGIN PGP SIGNED/) {
119 shift @bodylines while @bodylines and length $bodylines[0];
120 shift @bodylines while @bodylines and $bodylines[0] !~ /\S/;
121 for my $findsig (0 .. $#bodylines) {
122 if ($bodylines[$findsig] =~ /^-----BEGIN PGP SIGNATURE/) {
123 $#bodylines = $findsig - 1;
127 map { s/^- // } @bodylines;
130 # extract pseudo-headers
131 for my $phline (@bodylines)
133 last if $phline !~ m/^([\w]+):\s*(\S.*)/;
134 my ($fn, $fv) = ($1, $2);
135 print DEBUG ">$fn|$fv|\n";
139 print DEBUG ">$fn~$fv<\n";
143 $fwd .= join("\n",@msg[$i..$#msg]);
145 print DEBUG "***\n$fwd\n***\n";
147 if (defined $header{'resent-from'} && !defined $header{'from'}) {
148 $header{'from'} = $header{'resent-from'};
150 defined($header{'from'}) || &quit("no From header");
151 $replyto= defined($header{'reply-to'}) ? $header{'reply-to'} : $header{'from'};
154 $_= "$2 <$1>" if m/^([^\<\> \t\n\(\)]+) \(([^\(\)\<\>]+)\)$/;
156 print DEBUG "replytocompare >$replytocompare<\n";
158 if (!defined($header{'subject'}))
162 Your message did not contain a Subject field. They are recommended and
163 useful because the title of a $gBug is determined using this field.
164 Please remember to include a Subject field in your messages in future.
167 # RFC822 actually lists it as an `optional-field'.
169 $subject= '(no subject)';
170 } else { $subject= $header{'subject'}; }
173 $subject =~ s/^Re:\s*//i; $_= $subject."\n";
174 if ($tryref < 0 && m/^Bug ?\#(\d+)\D/i) { $tryref= $1+0; }
177 { $bfound= &lockreadbugmerge($tryref);
178 if ($bfound) { $ref= $tryref; }
180 { &htmllog("Reply","sent", $replyto,"Unknown problem report number <code>$tryref</code>.");
181 &sendmessage(<<END, '');
182 From: $gMaintainerEmail ($gProject $gBug Tracking System)
184 Subject: Unknown problem report $gBug#$tryref ($subject)
185 Message-ID: <handler.x.$nn.unknown\@$gEmailDomain>
186 In-Reply-To: $header{'message-id'}
187 References: $header{'message-id'} $s_msgid
188 X-$gProject-PR-Message: error
190 You sent a message to the $gBug tracking system which gave (in the
191 Subject line or encoded into the recipient at $gEmailDomain),
192 the number of a nonexistent $gBug report (#$tryref).
194 This may be because that $gBug report has been resolved for more than $gRemoveAge
195 days, and the record of it has been expunged, or because you mistyped
196 the $gBug report number.
198 Your message was dated $header{'date'} and was sent to
199 $baddress\@$gEmailDomain. It had
200 Message-ID $header{'message-id'}
201 and Subject $subject.
203 It has been filed (under junk) but otherwise ignored.
205 Please consult your records to find the correct $gBug report number, or
206 contact me, the system administrator, for assistance.
209 (administrator, $gProject $gBugs database)
211 (NB: If you are a system administrator and have no idea what I am
212 talking about this indicates a serious mail system misconfiguration
213 somewhere. Please contact me immediately.)
219 } else { &filelock('lock/-1'); }
221 if ($codeletter eq 'D' || $codeletter eq 'F')
222 { if ($replyto =~ m/$gBounceFroms/o ||
223 $header{'from'} =~ m/$gBounceFroms/o)
224 { &quit("bounce detected ! Mwaap! Mwaap!"); }
225 $markedby= $header{'from'} eq $replyto ? $replyto :
226 "$header{'from'} (reply to $replyto)";
227 if ($codeletter eq 'F')
228 { (&appendlog,&finish) if length($s_forwarded);
229 $receivedat= "forwarded\@$gEmailDomain";
230 $markaswhat= 'forwarded';
231 $set_forwarded= $header{'to'};
232 if ( length( $gListDomain ) > 0 && length( $gFowardList ) > 0 )
233 { $generalcc= "$gFowardList\@$gListDomain"; }
234 else { $generalcc=''; }
236 { (&appendlog,&finish) if length($s_done);
237 $receivedat= "done\@$gEmailDomain";
239 $set_done= $header{'from'};
240 if ( length( $gListDomain ) > 0 && length( $gDoneList ) > 0 )
241 { $generalcc= "$gDoneList\@$gListDomain"; }
242 else { $generalcc=''; }
245 { &htmllog("Warning","sent",$replyto,"Message ignored.");
246 &sendmessage(<<END, '');
247 From: $gMaintainerEmail ($gProject $gBug Tracking System)
249 Subject: Message with no $gBug number ignored by $receivedat
251 Message-ID: <header.x.$nn.warnignore\@$gEmailDomain>
252 In-Reply-To: $header{'message-id'}
253 References: $header{'message-id'} $s_msgid
254 X-$gProject-PR-Message: error
256 You sent a message to the $gProject $gBug tracking system old-style
257 unified mark as $markaswhat address ($receivedat),
258 without a recognisable $gBug number in the Subject.
259 Your message has been filed under junk but otherwise ignored.
261 If you don't know what I'm talking about then probably either:
263 (a) you unwittingly sent a message to done\@$gEmailDomain
264 because you replied to all recipients of the message a developer used
265 to mark a $gBug as done and you modified the Subject. In this case,
266 please do not be alarmed. To avoid confusion do not do it again, but
267 there is no need to apologise or mail anyone asking for an explanation.
269 (b) you are a system administrator, reading this because the $gBug
270 tracking system is responding to a misdirected bounce message. In this
271 case there is a serious mail system misconfiguration somewhere - please
272 contact me immediately.
274 Your message was dated $header{'date'} and had
275 message-id $header{'message-id'}
276 and subject $subject.
278 If you need any assistance or explanation please contact me.
281 (administrator, $gProject $gBugs database)
288 $noticeccval.= join(', ', grep($_ ne $replyto,@maintaddrs,@addsrcaddrs));
289 $noticeccval =~ s/\s+\n\s+/ /g; $noticeccval =~ s/^\s+/ /; $noticeccval =~ s/\s+$//;
290 if (length($noticeccval)) { $noticecc= "Cc: $noticeccval\n"; }
291 if (length($generalcc)) { $noticecc.= "Bcc: $generalcc\n"; }
292 @process= ($ref,split(/ /,$s_mergedwith));
295 { if ($ref != $orgref)
297 &lockreadbug($ref) || die "huh ? $ref from $orgref out of @process";
299 $s_done= $set_done if defined($set_done);
300 $s_forwarded= $set_forwarded if defined($set_forwarded);
301 my $hash = get_hashname($ref);
302 &overwrite("db-h/$hash/$ref.status",
303 "$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
304 "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
305 &bughook('change',$ref,
306 "$s_originator\n$s_date\n$s_subject\n$s_msgid\n".
307 "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n");
308 open(O,"db-h/$hash/$ref.report") || &quit("read original report: $!");
309 $x= join('',<O>); close(O);
310 if ($codeletter eq 'F')
311 { &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded.");
312 &sendmessage(<<END."---------------------------------------\n".join( "\n", @msg ), '');
313 From: $gMaintainerEmail ($gProject $gBug Tracking System)
315 ${noticecc}Subject: $gBug#$ref: marked as forwarded ($s_subject)
316 Message-ID: <header.$ref.$nn.ackfwdd\@$gEmailDomain>
317 In-Reply-To: $header{'message-id'}
318 References: $header{'message-id'} $s_msgid
319 X-$gProject-PR-Message: forwarded $ref
321 Your message dated $header{'date'}
322 with message-id $header{'message-id'}
323 has caused the $gProject $gBug report #$ref,
325 to be marked as having been forwarded to the upstream software
326 author(s) $s_forwarded.
328 (NB: If you are a system administrator and have no idea what I am
329 talking about this indicates a serious mail system misconfiguration
330 somewhere. Please contact me immediately.)
333 (administrator, $gProject $gBugs database)
337 { &htmllog("Reply","sent",$replyto,"You have taken responsibility.");
338 &sendmessage(<<END."--------------------------------------\n".$x."---------------------------------------\n".join( "\n", @msg ), '');
339 From: $gMaintainerEmail ($gProject $gBug Tracking System)
341 ${noticecc}Subject: $gBug#$ref: marked as done ($s_subject)
342 Message-ID: <handler.$ref.$nn.ackdone\@$gEmailDomain>
343 In-Reply-To: $header{'message-id'}
344 References: $header{'message-id'} $s_msgid
345 X-$gProject-PR-Message: closed $ref
347 Your message dated $header{'date'}
348 with message-id $header{'message-id'}
349 and subject line $subject
350 has caused the attached $gBug report to be marked as done.
352 This means that you claim that the problem has been dealt with.
353 If this is not the case it is now your responsibility to reopen the
354 $gBug report if necessary, and/or fix the problem forthwith.
356 (NB: If you are a system administrator and have no idea what I am
357 talking about this indicates a serious mail system misconfiguration
358 somewhere. Please contact me immediately.)
361 (administrator, $gProject $gBugs database)
364 &htmllog("Notification","sent",$s_originator,
365 "$gBug acknowledged by developer.");
366 &sendmessage(<<END.join("\n",@msg),'');
367 From: $gMaintainerEmail ($gProject $gBug Tracking System)
369 Subject: $gBug#$ref acknowledged by developer
371 Message-ID: <handler.$ref.$nn.notifdone\@$gEmailDomain>
372 In-Reply-To: $s_msgid
373 References: $header{'message-id'} $s_msgid
374 X-$gProject-PR-Message: they-closed $ref
375 Reply-To: $ref\@$gEmailDomain
377 This is an automatic notification regarding your $gBug report
379 which was filed against the $s_package package.
381 It has been closed by one of the developers, namely
384 Their explanation is attached below. If this explanation is
385 unsatisfactory and you have not received a better one in a separate
386 message then please contact the developer, by replying to this email.
389 (administrator, $gProject $gBugs database)
399 { if ($codeletter eq 'U')
400 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
401 &sendmessage(<<END, '');
402 From: $gMaintainerEmail ($gProject $gBug Tracking System)
404 Subject: Message with no $gBug number cannot be sent to submitter !
406 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
407 In-Reply-To: $header{'message-id'}
408 References: $header{'message-id'} $s_msgid
409 X-$gProject-PR-Message: error
411 You sent a message to the $gProject $gBug tracking system send to $gBug
412 report submitter address $baddress\@$gEmailDomain, without a
413 recognisable $gBug number in the Subject. Your message has been filed
414 under junk but otherwise ignored.
416 If you don't know what I'm talking about then probably either:
418 (a) you unwittingly sent a message to $baddress\@$gEmailDomain
419 because you replied to all recipients of the message a developer sent
420 to a $gBug's submitter and you modified the Subject. In this case,
421 please do not be alarmed. To avoid confusion do not do it again, but
422 there is no need to apologise or mail anyone asking for an
425 (b) you are a system administrator, reading this because the $gBug
426 tracking system is responding to a misdirected bounce message. In this
427 case there is a serious mail system misconfiguration somewhere - please
428 contact me immediately.
430 Your message was dated $header{'date'} and had
431 message-id $header{'message-id'}
432 and subject $subject.
434 If you need any assistance or explanation please contact me.
437 (administrator, $gProject $gBugs database)
443 if (!defined($pheader{'package'}))
444 { &htmllog("Warning","sent",$replyto,"Message not forwarded.");
445 &sendmessage(<<END."---------------------------------------------------------------------------\n".join("\n", @msg), '');
446 From: $gMaintainerEmail ($gProject $gBug Tracking System)
448 Subject: Message with no Package: tag cannot be processed!
450 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
451 In-Reply-To: $header{'message-id'}
452 References: $header{'message-id'} $s_msgid
453 X-$gProject-PR-Message: error
455 Your message didn't have a Package: line at the start (in the
456 pseudo-header following the real mail header), or didn't have a
457 pseudo-header at all.
459 This makes it much harder for us to categorise and deal with your
460 problem report. Please _resubmit_ your report and tell us which package
461 the report is on. For help, check out http://$gWebDomain/Reporting.html.
463 Your message was dated $header{'date'} and had
464 message-id $header{'message-id'}
465 and subject $subject.
466 The complete text of it is attached to this message.
468 If you need any assistance or explanation please contact me.
471 (administrator, $gProject $gBugs database)
476 } else { $s_package= $pheader{'package'}; }
478 if (defined($pheader{'keywords'})) {
479 $s_keywords= $pheader{'keywords'};
480 } elsif (defined($pheader{'tags'})) {
481 $s_keywords= $pheader{'tags'};
483 if (length($s_keywords)) {
485 my %gkws = map { ($_, 1) } @gTags;
486 foreach my $kw (sort split(/[,\s]+/, lc($s_keywords))) {
487 push @kws, $kw if (defined $gkws{$kw});
489 $s_keywords = join(" ", @kws);
492 if (defined($pheader{'severity'}) || defined($pheader{'priority'}))
493 { $s_severity= $pheader{'severity'};
494 $s_severity= $pheader{'priority'} unless ($s_severity);
496 if (!grep($_ eq $s_severity, @severities, "$gDefaultSeverity")) {
499 Your message specified a Severity: in the pseudo-header, but
500 the severity value $s_severity was not recognised.
501 The default severity $gDefaultSeverity is being used instead.
502 The recognised values are: $gShowSeverities.
504 # if we use @gSeverityList array in the above line, perl -c gives:
505 # In string, @gSeverityList now must be written as \@gSeverityList at
506 # process line 452, near "$gDefaultSeverity is being used instead.
510 &filelock("nextnumber.lock");
511 open(N,"nextnumber") || &quit("nextnumber: read: $!");
512 $v=<N>; $v =~ s/\n$// || &quit("nextnumber bad format");
513 $ref= $v+0; $v += 1; $newref=1;
514 &overwrite('nextnumber', "$v\n");
516 my $hash = get_hashname($ref);
517 &overwrite("db-h/$hash/$ref.log",'');
518 &overwrite("db-h/$hash/$ref.status",
519 "$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
520 "$s_package\n$s_keywords\n\n\n\n$s_severity\n");
522 "$replyto\n$intdate\n$subject\n$header{'message-id'}\n".
523 "$s_package\n$s_keywords\n\n\n\n$s_severity\n");
524 &overwrite("db-h/$hash/$ref.report",
525 join("\n",@msg)."\n");
530 print DEBUG "maintainers >@maintaddrs<\n";
532 $orgsender= defined($header{'sender'}) ? "Original-Sender: $header{'sender'}\n" : '';
533 $newsubject= $subject; $newsubject =~ s/^$gBug#$ref:*\s*//;
535 $xcchdr= $header{ 'x-debbugs-cc' };
536 if ($xcchdr =~ m/\S/) {
537 push(@resentccs,$xcchdr);
538 $resentccexplain.= <<END;
540 As you requested using X-Debbugs-CC, your message was also forwarded to
542 (after having been given a $gBug report number, if it did not have one).
546 if (@maintaddrs && ($codeletter eq 'B' || $codeletter eq 'M')) {
547 push(@resentccs,@maintaddrs);
548 $resentccexplain.= <<END." ".join("\n ",@maintaddrs)."\n";
550 Your message has been sent to the package maintainer(s):
554 push(@resentccs, @addsrcaddrs);
556 $veryquiet= $codeletter eq 'Q';
557 if ($codeletter eq 'M' && !@maintaddrs) {
561 You requested that the message be sent to the package maintainer(s)
562 but either the $gBug report is not associated with any package (probably
563 because of a missing Package pseudo-header field in the original $gBug
564 report), or the package(s) specified do not have any maintainer(s).
566 Your message has *not* been sent to any package maintainers; it has
567 merely been filed in the $gBug tracking system. If you require assistance
568 please contact $gMaintainerEmail quoting the $gBug number $ref.
572 $resentccval.= join(', ',@resentccs);
573 $resentccval =~ s/\s+\n\s+/ /g; $resentccval =~ s/^\s+/ /; $resentccval =~ s/\s+$//;
574 if (length($resentccval)) { $resentcc= "Resent-CC: $resentccval\n"; }
576 if ($codeletter eq 'U') {
577 &htmllog("Message", "sent on", $s_originator, "$gBug#$ref.");
578 &sendmessage(<<END,$s_originator,@resentccs);
579 Subject: $gBug#$ref: $newsubject
580 Reply-To: $replyto, $ref-quiet\@$gEmailDomain
581 ${orgsender}Resent-To: $s_originator
582 ${resentcc}Resent-Date: $tdate
583 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
584 Resent-Sender: $gMaintainerEmail
585 X-$gProject-PR-Message: report $ref
586 X-$gProject-PR-Package: $s_package
587 X-$gProject-PR-Keywords: $s_keywords
590 } elsif ($codeletter eq 'B') {
591 &htmllog($newref ? "Report" : "Information", "forwarded",
592 join(', ',"$gSubmitList\@$gListDomain",@resentccs),
593 "<code>$gBug#$ref</code>".
594 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
596 &sendmessage(<<END,"$gSubmitList\@$gListDomain",@resentccs);
597 Subject: $gBug#$ref: $newsubject
598 Reply-To: $replyto, $ref\@$gEmailDomain
599 Resent-From: $header{'from'}
600 ${orgsender}Resent-To: $gSubmitList\@$gListDomain
601 ${resentcc}Resent-Date: $tdate
602 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
603 Resent-Sender: $gMaintainerEmail
604 X-$gProject-PR-Message: report $ref
605 X-$gProject-PR-Package: $s_package
606 X-$gProject-PR-Keywords: $s_keywords
609 } elsif (@resentccs) {
610 # D and F done far earlier; B just done - so this must be M or Q
611 # We preserve whichever it was in the Reply-To (possibly adding
613 &htmllog($newref ? "Report" : "Information", "forwarded",
615 "<code>$gBug#$ref</code>".
616 (length($s_package)? "; Package <code>".&sani($s_package)."</code>" : '').
618 &sendmessage(<<END,@resentccs);
619 Subject: $gBug#$ref: $newsubject
620 Reply-To: $replyto, $ref-$baddressroot\@$gEmailDomain
621 Resent-From: $header{'from'}
622 ${orgsender}Resent-To: $resentccval
624 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
625 Resent-Sender: $gMaintainerEmail
626 X-$gProject-PR-Message: report $ref
627 X-$gProject-PR-Package: $s_package
628 X-$gProject-PR-Keywords: $s_keywords
633 $htmlbreak= length($brokenness) ? "<p>\n".&sani($brokenness)."\n<p>\n" : '';
634 $htmlbreak =~ s/\n\n/\n<P>\n\n/g;
635 if (length($resentccval)) {
637 " Copy sent to <code>".&sani($resentccval)."</code>.".
641 &htmllog("Acknowledgement","sent",$replyto,
643 "New $gBug report received and filed, but not forwarded." :
644 "New $gBug report received and forwarded."). $htmlbreak);
645 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
646 From: $gMaintainerEmail ($gProject $gBug Tracking System)
648 Subject: $gBug#$ref: Acknowledgement of QUIET report
650 Message-ID: <handler.$ref.$nn.ackquiet\@$gEmailDomain>
651 In-Reply-To: $header{'message-id'}
652 References: $header{'message-id'}
653 X-$gProject-PR-Message: ack-quiet $ref
654 Reply-To: $ref-quiet\@$gEmailDomain
656 Thank you for the problem report you have sent regarding $gProject.
657 This is an automatically generated reply, to let you know your message
658 has been received. It has not been forwarded to the developers or
659 their mailing list; you should ensure that the developers are aware of
660 the problem you have entered into the system - preferably quoting the
661 $gBug reference number, #$ref.
663 If you wish to submit further information on your problem, please send it
664 to $ref-$baddressroot\@$gEmailDomain (and *not*
665 to $baddress\@$gEmailDomain).
667 Please do not reply to the address at the top of this message,
668 unless you wish to report a problem with the $gBug-tracking system.
671 (administrator, $gProject $gBugs database)
673 From: $gMaintainerEmail ($gProject $gBug Tracking System)
675 Subject: $gBug#$ref: Acknowledgement of maintainer-only report
677 Message-ID: <handler.$ref.$nn.ackmaint\@$gEmailDomain>
678 In-Reply-To: $header{'message-id'}
679 References: $header{'message-id'}
680 X-$gProject-PR-Message: ack-maintonly $ref
681 Reply-To: $ref-maintonly\@$gEmailDomain
683 Thank you for the problem report you have sent regarding $gProject.
684 This is an automatically generated reply, to let you know your message has
685 been received. It is being forwarded to the developers (but not the mailing
686 list, as you requested) for their attention; they will reply in due course.
688 If you wish to submit further information on your problem, please send
689 it to $ref-$baddressroot\@$gEmailDomain (and *not*
690 to $baddress\@$gEmailDomain).
692 Please do not reply to the address at the top of this message,
693 unless you wish to report a problem with the $gBug-tracking system.
696 (administrator, $gProject $gBugs database)
698 From: $gMaintainerEmail ($gProject $gBug Tracking System)
700 Subject: $gBug#$ref: Acknowledgement ($subject)
701 Message-ID: <handler.$ref.$nn.ack\@$gEmailDomain>
702 In-Reply-To: $header{'message-id'}
703 References: $header{'message-id'}
704 X-$gProject-PR-Message: ack $ref
705 Reply-To: $ref\@$gEmailDomain
707 Thank you for the problem report you have sent regarding $gProject.
708 This is an automatically generated reply, to let you know your message has
709 been received. It is being forwarded to the developers mailing list for
710 their attention; they will reply in due course.
712 If you wish to submit further information on your problem, please send
713 it to $ref\@$gEmailDomain (and *not* to
714 $baddress\@$gEmailDomain).
716 Please do not reply to the address at the top of this message,
717 unless you wish to report a problem with the $gBug-tracking system.
720 (administrator, $gProject $gBugs database)
722 } elsif ($codeletter ne 'U') {
723 &htmllog("Acknowledgement","sent",$replyto,
724 ($veryquiet ? "Extra info received and filed, but not forwarded." :
725 $codeletter eq 'M' ? "Extra info received and forwarded to maintainer." :
726 "Extra info received and forwarded to list."). $htmlbreak);
727 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
728 From: $gMaintainerEmail ($gProject $gBug Tracking System)
730 Subject: $gBug#$ref: Info received and FILED only
732 Message-ID: <handler.$ref.$nn.ackinfoquiet\@$gEmailDomain>
733 In-Reply-To: $header{'message-id'}
734 References: $header{'message-id'}
735 X-$gProject-PR-Message: ack-info-quiet $ref
736 Reply-To: $ref-quiet\@$gEmailDomain
738 Thank you for the additional information you have supplied regarding
739 this problem report. It has NOT been forwarded to the developers, but
740 will accompany the original report in the $gBug tracking system. Please
741 ensure that you yourself have sent a copy of the additional
742 information to any relevant developers or mailing lists.
744 If you wish to continue to submit further information on your problem,
745 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
747 Please do not reply to the address at the top of this message,
748 unless you wish to report a problem with the $gBug-tracking system.
751 (administrator, $gProject $gBugs database)
753 From: $gMaintainerEmail ($gProject $gBug Tracking System)
755 Subject: $gBug#$ref: Info received for maintainer only
757 Message-ID: <handler.$ref.$nn.ackinfomaint\@$gEmailDomain>
758 In-Reply-To: $header{'message-id'}
759 References: $header{'message-id'}
760 X-$gProject-PR-Message: ack-info-maintonly $ref
761 Reply-To: $ref-maintonly\@$gEmailDomain
763 Thank you for the additional information you have supplied regarding
764 this problem report. It has been forwarded to the developer(s) (but
765 not to the mailing list) to accompany the original report.
767 If you wish to continue to submit further information on your problem,
768 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
770 Please do not reply to the address at the top of this message,
771 unless you wish to report a problem with the $gBug-tracking system.
774 (administrator, $gProject $gBugs database)
776 From: $gMaintainerEmail ($gProject $gBug Tracking System)
778 Subject: $gBug#$ref: Info received (was $subject)
779 Message-ID: <handler.$ref.$nn.ackinfo\@$gEmailDomain>
780 In-Reply-To: $header{'message-id'}
781 References: $header{'message-id'}
782 X-$gProject-PR-Message: ack-info $ref
783 Disabled-Doogie-Reply-To: $ref\@$gEmailDomain
785 Thank you for the additional information you have supplied regarding
786 this problem report. It has been forwarded to the developer(s) and
787 to the developers mailing list to accompany the original report.
789 If you wish to continue to submit further information on your problem,
790 please send it to $ref\@$gEmailDomain, as before.
792 Please do not reply to the address at the top of this message,
793 unless you wish to report a problem with the $gBug-tracking system.
796 (administrator, $gProject $gBugs database)
805 open(NEW,">$f.new") || &quit("$f.new: create: $!");
806 print(NEW "$v") || &quit("$f.new: write: $!");
807 close(NEW) || &quit("$f.new: close: $!");
808 rename("$f.new","$f") || &quit("rename $f.new to $f: $!");
812 my $hash = get_hashname($ref);
813 if (!open(AP,">>db-h/$hash/$ref.log")) {
814 print DEBUG "failed open log<\n";
815 print DEBUG "failed open log err $!<\n";
816 &quit("opening db-h/$hash/$ref.log (li): $!");
818 print(AP "\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!");
819 close(AP) || &quit("closing db-h/$hash/$ref.log (li): $!");
823 utime(time,time,"db");
825 while ($u= $cleanups[$#cleanups]) { &$u; }
826 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
830 &quit("wot no exit");
832 sub chldhandle { $chldexit = 'yes'; }
835 local ($whatobj,$whatverb,$where,$desc) = @_;
836 my $hash = get_hashname($ref);
837 open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lh): $!");
840 "<strong>$whatobj $whatverb</strong> to <code>".&sani($where).
841 "</code>:<br>\n". $desc.
842 "\n\3\n") || &quit("writing db-h/$hash/$ref.log (lh): $!");
843 close(AP) || &quit("closing db-h/$hash/$ref.log (lh): $!");
848 map { $_->address() }
849 map { Mail::Address->parse($_) } @_;
853 local ($msg,@recips) = @_;
854 if ($recips[0] eq '' && $#recips == 0) { @recips= ('-t'); }
855 $msg = "X-Loop: $gMaintainerEmail\n" . $msg;
857 my $hash = get_hashname($ref);
858 #save email to the log
859 open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lo): $!");
860 print(AP "\2\n",join("\4",@recips),"\n\5\n",@{escapelog($msg)},"\n\3\n") ||
861 &quit("writing db-h/$hash/$ref.log (lo): $!");
862 close(AP) || &quit("closing db-h/$hash/$ref.log (lo): $!");
864 #if debbuging.. save email to a log
865 # open AP, ">>debug";
866 # print AP join( '|', @recips )."\n>>";
867 # print AP get_addresses( @recips );
868 # print AP "<<\n".$msg;
869 # print AP "\n--------------------------------------------------------\n";
874 $SIG{'CHLD'}='chldhandle';
875 #print DEBUG "mailing sigchild set up<\n";
878 #print DEBUG "mailing opened pipe fork<\n";
879 defined($c) || die $!;
880 #print DEBUG "mailing opened pipe fork ok $c<\n";
881 if (!$c) { # ie, we are in the child process
882 #print DEBUG "mailing child<\n";
883 unless (open(STDERR,">&STDOUT")) {
884 #print DEBUG "mailing child opened stderr<\n";
885 print STDOUT "redirect stderr: $!\n";
886 #print DEBUG "mailing child opened stderr fail<\n";
888 #print DEBUG "mailing child opened stderr fail exit !?<\n";
890 #print DEBUG "mailing child opened stderr ok<\n";
892 #print DEBUG "mailing child forked again<\n";
893 defined($c) || die $!;
894 #print DEBUG "mailing child forked again ok $c<\n";
895 if (!$c) { # ie, we are the child process
896 #print DEBUG "mailing grandchild<\n";
897 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odq','-oem','-oi',get_addresses(@recips);
898 #print DEBUG "mailing grandchild exec failed<\n";
900 #print DEBUG "mailing grandchild died !?<\n";
902 #print DEBUG "mailing child not grandchild<\n";
903 print(D $msg) || die $!;
904 #print DEBUG "mailing child printed msg<\n";
906 #print DEBUG "mailing child closed pipe<\n";
907 die "\n*** command returned exit status $?\n" if $?;
908 #print DEBUG "mailing child exit status ok<\n";
910 #print DEBUG "mailing child exited ?!<\n";
912 #print DEBUG "mailing parent<\n";
914 #print DEBUG "mailing parent results emptied<\n";
915 while( $chldexit eq 'no' ) { $results.= $_; }
916 #print DEBUG "mailing parent results read >$results<\n";
918 #print DEBUG "mailing parent results closed<\n";
919 $results.= "\n*** child returned exit status $?\n" if $?;
920 #print DEBUG "mailing parent exit status ok<\n";
921 $SIG{'CHLD'}='DEFAULT';
922 #print DEBUG "mailing parent sigchild default<\n";
923 if (length($results)) { &quit("running sendmail: $results"); }
924 #print DEBUG "mailing parent results ok<\n";
927 sub checkmaintainers {
928 return if $maintainerschecked++;
929 return if !length($s_package);
930 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
934 m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers bogus \`$_'");
935 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
936 $maintainerof{$1}= $2;
939 open(MAINT,"$gMaintainerFileOverride") || die &quit("maintainers.override open: $!");
943 m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers.override bogus \`$_'");
944 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
945 $maintainerof{$1}= $2;
948 open(SOURCES,"$gPackageSource") || &quit("pkgsrc open: $!");
950 next unless m/^(\S+)\s+\S+\s+(\S.*\S)\s*$/;
956 $anymaintfound=0; $anymaintnotfound=0;
957 for $p (split(m/[ \t?,()]+/,$s_package)) {
959 if (defined($pkgsrc{$p})) {
960 push @addsrcaddrs, "$pkgsrc{$p}\@packages.qa.debian.org";
962 push @addsrcaddrs, "$p\@packages.qa.debian.org";
964 if (defined($maintainerof{$p})) {
965 print DEBUG "maintainer add >$p|$maintainerof{$p}<\n";
966 $addmaint= $maintainerof{$p};
967 push(@maintaddrs,$addmaint) unless
968 $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs);
971 print DEBUG "maintainer none >$p<\n";
972 push(@maintaddrs,$gUnknownMaintainerEmail) unless $anymaintnotfound;