2 # $Id: process.in,v 1.71 2003/05/27 02:39:17 cjwatson Exp $
7 use POSIX qw(strftime tzset);
14 $config_path = '/etc/debbugs';
15 $lib_path = '/usr/lib/debbugs';
17 require "$config_path/config";
18 require "$lib_path/errorlib";
19 $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
21 chdir( "$gSpoolDir" ) || die "chdir spool: $!\n";
23 #open(DEBUG,"> /tmp/debbugs.debug");
25 open DEBUG, ">/dev/null";
27 defined( $intdate= time ) || &quit( "failed to get time: $!" );
30 m/^([BMQFDU])(\d*)\.\d+$/ || &quit("bad argument");
32 $tryref= length($2) ? $2+0 : -1;
35 if (!rename("incoming/G$nn","incoming/P$nn"))
37 $_=$!.''; m/no such file or directory/i && exit 0;
38 &quit("renaming to lock: $!");
41 $baddress= 'submit' if $codeletter eq 'B';
42 $baddress= 'maintonly' if $codeletter eq 'M';
43 $baddress= 'quiet' if $codeletter eq 'Q';
44 $baddress= 'forwarded' if $codeletter eq 'F';
45 $baddress= 'done' if $codeletter eq 'D';
46 $baddress= 'submitter' if $codeletter eq 'U';
47 $baddress || &quit("bad codeletter $codeletter");
48 $baddressroot= $baddress;
49 $baddress= "$tryref-$baddress" if $tryref>=0;
51 open(M,"incoming/P$nn");
58 print DEBUG "###\n",join("##\n",@msg),"\n###\n";
60 $tdate = strftime "%a, %d %h %Y %T UTC", localtime;
62 Received: via spool by $baddress\@$gEmailDomain id=$nn
63 (code $codeletter ref $tryref); $tdate
66 # header and decoded body respectively
67 my (@headerlines, @bodylines);
69 my $parser = new MIME::Parser;
70 mkdir "$gSpoolDir/mime.tmp", 0777;
71 $parser->output_under("$gSpoolDir/mime.tmp");
72 my $entity = eval { $parser->parse_data(join('',@log)) };
74 if ($entity and $entity->head->tags) {
75 @headerlines = @{$entity->head->header};
78 my $entity_body = getmailbody($entity);
79 @bodylines = $entity_body ? $entity_body->as_lines() : ();
82 # set $i to beginning of encoded body data, so we can dump it out
85 ++$i while $msg[$i] =~ /./;
87 # Legacy pre-MIME code, kept around in case MIME::Parser fails.
88 for ($i = 0; $i <= $#msg; $i++) {
90 last unless length($_);
91 while ($msg[$i+1] =~ m/^\s/) {
95 push @headerlines, $_;
98 @bodylines = @msg[$i..$#msg];
101 for my $hdr (@headerlines) {
104 &finish if m/^x-loop: (\S+)$/i && $1 eq "$gMaintainerEmail";
105 my $ins = !m/^subject:/i && !m/^reply-to:/i && !m/^return-path:/i
106 && !m/^From / && !m/^X-Debbugs-CC:/i;
107 $fwd .= $hdr."\n" if $ins;
108 # print DEBUG ">$_<\n";
109 if (s/^(\S+):\s*//) {
111 print DEBUG ">$v=$_<\n";
114 print DEBUG "!>$_<\n";
119 shift @bodylines while @bodylines and $bodylines[0] !~ /\S/;
121 # Strip off RFC2440-style PGP clearsigning.
122 if (@bodylines and $bodylines[0] =~ /^-----BEGIN PGP SIGNED/) {
123 shift @bodylines while @bodylines and length $bodylines[0];
124 shift @bodylines while @bodylines and $bodylines[0] !~ /\S/;
125 for my $findsig (0 .. $#bodylines) {
126 if ($bodylines[$findsig] =~ /^-----BEGIN PGP SIGNATURE/) {
127 $#bodylines = $findsig - 1;
131 map { s/^- // } @bodylines;
134 # extract pseudo-headers
135 for my $phline (@bodylines)
137 last if $phline !~ m/^([\w]+):\s*(\S.*)/;
138 my ($fn, $fv) = ($1, $2);
140 print DEBUG ">$fn|$fv|\n";
144 print DEBUG ">$fn~$fv<\n";
148 $fwd .= join("\n",@msg[$i..$#msg]);
150 print DEBUG "***\n$fwd\n***\n";
152 if (defined $header{'resent-from'} && !defined $header{'from'}) {
153 $header{'from'} = $header{'resent-from'};
155 defined($header{'from'}) || &quit("no From header");
156 $replyto= defined($header{'reply-to'}) ? $header{'reply-to'} : $header{'from'};
159 $_= "$2 <$1>" if m/^([^\<\> \t\n\(\)]+) \(([^\(\)\<\>]+)\)$/;
161 print DEBUG "replytocompare >$replytocompare<\n";
163 if (!defined($header{'subject'}))
167 Your message did not contain a Subject field. They are recommended and
168 useful because the title of a $gBug is determined using this field.
169 Please remember to include a Subject field in your messages in future.
172 # RFC822 actually lists it as an `optional-field'.
174 $subject= '(no subject)';
176 $subject= $header{'subject'};
180 $subject =~ s/^Re:\s*//i; $_= $subject."\n";
181 if ($tryref < 0 && m/^Bug ?\#(\d+)\D/i) {
187 ($bfound, $data)= &lockreadbugmerge($tryref);
191 &htmllog("Reply","sent", $replyto,"Unknown problem report number <code>$tryref</code>.");
192 &sendmessage(<<END, '');
193 From: $gMaintainerEmail ($gProject $gBug Tracking System)
195 Subject: Unknown problem report $gBug#$tryref ($subject)
196 Message-ID: <handler.x.$nn.unknown\@$gEmailDomain>
197 In-Reply-To: $header{'message-id'}
198 References: $header{'message-id'} $data->{msgid}
200 X-$gProject-PR-Message: error
202 You sent a message to the $gBug tracking system which gave (in the
203 Subject line or encoded into the recipient at $gEmailDomain),
204 the number of a nonexistent $gBug report (#$tryref).
206 This may be because that $gBug report has been resolved for more than $gRemoveAge
207 days, and the record of it has been expunged, or because you mistyped
208 the $gBug report number.
210 Your message was dated $header{'date'} and was sent to
211 $baddress\@$gEmailDomain. It had
212 Message-ID $header{'message-id'}
213 and Subject $subject.
215 It has been filed (under junk) but otherwise ignored.
217 Please consult your records to find the correct $gBug report number, or
218 contact me, the system administrator, for assistance.
221 (administrator, $gProject $gBugs database)
223 (NB: If you are a system administrator and have no idea what I am
224 talking about this indicates a serious mail system misconfiguration
225 somewhere. Please contact me immediately.)
232 &filelock('lock/-1');
235 if ($codeletter eq 'D' || $codeletter eq 'F')
237 if ($replyto =~ m/$gBounceFroms/o ||
238 $header{'from'} =~ m/$gBounceFroms/o)
240 &quit("bounce detected ! Mwaap! Mwaap!");
242 $markedby= $header{'from'} eq $replyto ? $replyto :
243 "$header{'from'} (reply to $replyto)";
244 if ($codeletter eq 'F') {
245 (&appendlog,&finish) if length($data->{forwarded});
246 $receivedat= "forwarded\@$gEmailDomain";
247 $markaswhat= 'forwarded';
248 $set_forwarded= $header{'to'};
249 if ( length( $gListDomain ) > 0 && length( $gFowardList ) > 0 ) {
250 $generalcc= "$gFowardList\@$gListDomain";
255 (&appendlog,&finish) if length($data->{done});
256 $receivedat= "done\@$gEmailDomain";
258 $set_done= $header{'from'};
259 if ( length( $gListDomain ) > 0 && length( $gDoneList ) > 0 ) {
260 $generalcc= "$gDoneList\@$gListDomain";
266 &htmllog("Warning","sent",$replyto,"Message ignored.");
267 &sendmessage(<<END, '');
268 From: $gMaintainerEmail ($gProject $gBug Tracking System)
270 Subject: Message with no $gBug number ignored by $receivedat
272 Message-ID: <header.x.$nn.warnignore\@$gEmailDomain>
273 In-Reply-To: $header{'message-id'}
274 References: $header{'message-id'} $data->{msgid}
276 X-$gProject-PR-Message: error
278 You sent a message to the $gProject $gBug tracking system old-style
279 unified mark as $markaswhat address ($receivedat),
280 without a recognisable $gBug number in the Subject.
281 Your message has been filed under junk but otherwise ignored.
283 If you don't know what I'm talking about then probably either:
285 (a) you unwittingly sent a message to done\@$gEmailDomain
286 because you replied to all recipients of the message a developer used
287 to mark a $gBug as done and you modified the Subject. In this case,
288 please do not be alarmed. To avoid confusion do not do it again, but
289 there is no need to apologise or mail anyone asking for an explanation.
291 (b) you are a system administrator, reading this because the $gBug
292 tracking system is responding to a misdirected bounce message. In this
293 case there is a serious mail system misconfiguration somewhere - please
294 contact me immediately.
296 Your message was dated $header{'date'} and had
297 message-id $header{'message-id'}
298 and subject $subject.
300 If you need any assistance or explanation please contact me.
303 (administrator, $gProject $gBugs database)
312 $noticeccval.= join(', ', grep($_ ne $replyto,@maintaddrs));
313 $noticeccval =~ s/\s+\n\s+/ /g;
314 $noticeccval =~ s/^\s+/ /; $noticeccval =~ s/\s+$//;
316 $generalcc = join(', ', $generalcc, @addsrcaddrs);
317 $generalcc =~ s/\s+\n\s+/ /g;
318 $generalcc =~ s/^\s+/ /; $generalcc =~ s/\s+$//;
320 if (length($noticeccval)) { $noticecc= "Cc: $noticeccval\n"; }
321 if (length($generalcc)) { $noticecc.= "Bcc: $generalcc\n"; }
323 @process= ($ref,split(/ /,$data->{mergedwith}));
326 for $ref (@process) {
327 if ($ref != $orgref) {
329 $data = &lockreadbug($ref)
330 || die "huh ? $ref from $orgref out of @process";
332 $data->{done}= $set_done if defined($set_done);
333 $data->{forwarded}= $set_forwarded if defined($set_forwarded);
334 writebug($ref, $data);
336 my $hash = get_hashname($ref);
337 open(O,"db-h/$hash/$ref.report") || &quit("read original report: $!");
338 $x= join('',<O>); close(O);
339 if ($codeletter eq 'F') {
340 &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded.");
341 &sendmessage(<<END."---------------------------------------\n".join( "\n", @msg ), '');
342 From: $gMaintainerEmail ($gProject $gBug Tracking System)
344 ${noticecc}Subject: $gBug#$ref: marked as forwarded ($data->{subject})
345 Message-ID: <header.$ref.$nn.ackfwdd\@$gEmailDomain>
346 In-Reply-To: $header{'message-id'}
347 References: $header{'message-id'} $data->{msgid}
349 X-$gProject-PR-Message: forwarded $ref
350 X-$gProject-PR-Package: $data->{package}
351 X-$gProject-PR-Keywords: $data->{keywords}
353 Your message dated $header{'date'}
354 with message-id $header{'message-id'}
355 has caused the $gProject $gBug report #$ref,
356 regarding $data->{subject}
357 to be marked as having been forwarded to the upstream software
358 author(s) $data->{forwarded}.
360 (NB: If you are a system administrator and have no idea what I am
361 talking about this indicates a serious mail system misconfiguration
362 somewhere. Please contact me immediately.)
365 (administrator, $gProject $gBugs database)
370 &htmllog("Reply","sent",$replyto,"You have taken responsibility.");
371 &sendmessage(<<END."--------------------------------------\n".$x."---------------------------------------\n".join( "\n", @msg ), '');
372 From: $gMaintainerEmail ($gProject $gBug Tracking System)
374 ${noticecc}Subject: $gBug#$ref: marked as done ($data->{subject})
375 Message-ID: <handler.$ref.$nn.ackdone\@$gEmailDomain>
376 In-Reply-To: $header{'message-id'}
377 References: $header{'message-id'} $data->{msgid}
379 X-$gProject-PR-Message: closed $ref
380 X-$gProject-PR-Package: $data->{package}
381 X-$gProject-PR-Keywords: $data->{keywords}
383 Your message dated $header{'date'}
384 with message-id $header{'message-id'}
385 and subject line $subject
386 has caused the attached $gBug report to be marked as done.
388 This means that you claim that the problem has been dealt with.
389 If this is not the case it is now your responsibility to reopen the
390 $gBug report if necessary, and/or fix the problem forthwith.
392 (NB: If you are a system administrator and have no idea what I am
393 talking about this indicates a serious mail system misconfiguration
394 somewhere. Please contact me immediately.)
397 (administrator, $gProject $gBugs database)
400 &htmllog("Notification","sent",$data->{originator},
401 "$gBug acknowledged by developer.");
402 &sendmessage(<<END.join("\n",@msg),'');
403 From: $gMaintainerEmail ($gProject $gBug Tracking System)
404 To: $data->{originator}
405 Subject: $gBug#$ref acknowledged by developer
407 Message-ID: <handler.$ref.$nn.notifdone\@$gEmailDomain>
408 In-Reply-To: $data->{msgid}
409 References: $header{'message-id'} $data->{msgid}
410 X-$gProject-PR-Message: they-closed $ref
411 X-$gProject-PR-Package: $data->{package}
412 X-$gProject-PR-Keywords: $data->{keywords}
413 Reply-To: $ref\@$gEmailDomain
415 This is an automatic notification regarding your $gBug report
416 #$ref: $data->{subject},
417 which was filed against the $data->{package} package.
419 It has been closed by one of the developers, namely
422 Their explanation is attached below. If this explanation is
423 unsatisfactory and you have not received a better one in a separate
424 message then please contact the developer, by replying to this email.
427 (administrator, $gProject $gBugs database)
437 if ($codeletter eq 'U') {
438 &htmllog("Warning","sent",$replyto,"Message not forwarded.");
439 &sendmessage(<<END, '');
440 From: $gMaintainerEmail ($gProject $gBug Tracking System)
442 Subject: Message with no $gBug number cannot be sent to submitter !
444 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
445 In-Reply-To: $header{'message-id'}
446 References: $header{'message-id'} $data->{msgid}
448 X-$gProject-PR-Message: error
450 You sent a message to the $gProject $gBug tracking system send to $gBug
451 report submitter address $baddress\@$gEmailDomain, without a
452 recognisable $gBug number in the Subject. Your message has been filed
453 under junk but otherwise ignored.
455 If you don't know what I'm talking about then probably either:
457 (a) you unwittingly sent a message to $baddress\@$gEmailDomain
458 because you replied to all recipients of the message a developer sent
459 to a $gBug's submitter and you modified the Subject. In this case,
460 please do not be alarmed. To avoid confusion do not do it again, but
461 there is no need to apologise or mail anyone asking for an
464 (b) you are a system administrator, reading this because the $gBug
465 tracking system is responding to a misdirected bounce message. In this
466 case there is a serious mail system misconfiguration somewhere - please
467 contact me immediately.
469 Your message was dated $header{'date'} and had
470 message-id $header{'message-id'}
471 and subject $subject.
473 If you need any assistance or explanation please contact me.
476 (administrator, $gProject $gBugs database)
482 if (!defined($pheader{'package'})) {
483 &htmllog("Warning","sent",$replyto,"Message not forwarded.");
484 &sendmessage(<<END."---------------------------------------------------------------------------\n".join("\n", @msg), '');
485 From: $gMaintainerEmail ($gProject $gBug Tracking System)
487 Subject: Message with no Package: tag cannot be processed!
489 Message-ID: <handler.x.$nn.nonumnosub\@$gEmailDomain>
490 In-Reply-To: $header{'message-id'}
491 References: $header{'message-id'} $data->{msgid}
493 X-$gProject-PR-Message: error
495 Your message didn't have a Package: line at the start (in the
496 pseudo-header following the real mail header), or didn't have a
497 pseudo-header at all.
499 This makes it much harder for us to categorise and deal with your
500 problem report. Please _resubmit_ your report to $baddress\@$gEmailDomain
501 and tell us which package the report is on. For help, check out
502 http://$gWebDomain/Reporting$gHTMLSuffix.
504 Your message was dated $header{'date'} and had
505 message-id $header{'message-id'}
506 and subject $subject.
507 The complete text of it is attached to this message.
509 If you need any assistance or explanation please contact me.
512 (administrator, $gProject $gBugs database)
518 $data->{package}= $pheader{'package'};
521 $data->{versions}= '';
522 if (defined($pheader{'version'})) {
523 $data->{versions} = $pheader{'version'};
524 $data->{versions} =~ s/\s+/ /;
525 # BUG: need to bounce unknown versions back to submitter here
528 $data->{fixed_versions}= '';
529 if (defined($pheader{'fixed-in-version'})) {
530 $data->{fixed_versions} = $pheader{'fixed-in-version'};
531 $data->{fixed_versions} =~ s/\s+/ /;
534 $data->{keywords}= '';
535 if (defined($pheader{'keywords'})) {
536 $data->{keywords}= $pheader{'keywords'};
537 } elsif (defined($pheader{'tags'})) {
538 $data->{keywords}= $pheader{'tags'};
540 if (length($data->{keywords})) {
542 my %gkws = map { ($_, 1) } @gTags;
543 foreach my $kw (sort split(/[,\s]+/, lc($data->{keywords}))) {
544 push @kws, $kw if (defined $gkws{$kw});
546 $data->{keywords} = join(" ", @kws);
548 $data->{severity}= '';
549 if (defined($pheader{'severity'}) || defined($pheader{'priority'})) {
550 $data->{severity}= $pheader{'severity'};
551 $data->{severity}= $pheader{'priority'} unless ($data->{severity});
552 $data->{severity} =~ s/^\s*(.+)\s*$/$1/;
554 if (!grep($_ eq $data->{severity}, @severities, "$gDefaultSeverity")) {
557 Your message specified a Severity: in the pseudo-header, but
558 the severity value $data->{severity} was not recognised.
559 The default severity $gDefaultSeverity is being used instead.
560 The recognised values are: $gShowSeverities.
562 # if we use @gSeverityList array in the above line, perl -c gives:
563 # In string, @gSeverityList now must be written as \@gSeverityList at
564 # process line 452, near "$gDefaultSeverity is being used instead.
565 $data->{severity}= '';
568 &filelock("nextnumber.lock");
569 open(N,"nextnumber") || &quit("nextnumber: read: $!");
570 $v=<N>; $v =~ s/\n$// || &quit("nextnumber bad format");
571 $ref= $v+0; $v += 1; $newref=1;
572 &overwrite('nextnumber', "$v\n");
574 my $hash = get_hashname($ref);
575 &overwrite("db-h/$hash/$ref.log",'');
576 $data->{originator} = $replyto;
577 $data->{date} = $intdate;
578 $data->{subject} = $subject;
579 $data->{msgid} = $header{'message-id'};
580 writebug($ref, $data);
581 &overwrite("db-h/$hash/$ref.report",
582 join("\n",@msg)."\n");
587 print DEBUG "maintainers >@maintaddrs<\n";
589 $orgsender= defined($header{'sender'}) ? "Original-Sender: $header{'sender'}\n" : '';
590 $newsubject= $subject; $newsubject =~ s/^$gBug#$ref:*\s*//;
592 $xcchdr= $header{ 'x-debbugs-cc' };
593 if ($xcchdr =~ m/\S/) {
594 push(@resentccs,$xcchdr);
595 $resentccexplain.= <<END;
597 As you requested using X-Debbugs-CC, your message was also forwarded to
599 (after having been given a $gBug report number, if it did not have one).
603 if (@maintaddrs && ($codeletter eq 'B' || $codeletter eq 'M')) {
604 push(@resentccs,@maintaddrs);
605 $resentccexplain.= <<END." ".join("\n ",@maintaddrs)."\n";
607 Your message has been sent to the package maintainer(s):
611 @bccs = @addsrcaddrs;
613 $veryquiet= $codeletter eq 'Q';
614 if ($codeletter eq 'M' && !@maintaddrs) {
618 You requested that the message be sent to the package maintainer(s)
619 but either the $gBug report is not associated with any package (probably
620 because of a missing Package pseudo-header field in the original $gBug
621 report), or the package(s) specified do not have any maintainer(s).
623 Your message has *not* been sent to any package maintainers; it has
624 merely been filed in the $gBug tracking system. If you require assistance
625 please contact $gMaintainerEmail quoting the $gBug number $ref.
629 $resentccval.= join(', ',@resentccs);
630 $resentccval =~ s/\s+\n\s+/ /g; $resentccval =~ s/^\s+/ /; $resentccval =~ s/\s+$//;
631 if (length($resentccval)) {
632 $resentcc= "Resent-CC: $resentccval\n";
635 if ($codeletter eq 'U') {
636 &htmllog("Message", "sent on", $data->{originator}, "$gBug#$ref.");
637 &sendmessage(<<END,[$data->{originator},@resentccs],[@bccs]);
638 Subject: $gBug#$ref: $newsubject
639 Reply-To: $replyto, $ref-quiet\@$gEmailDomain
640 ${orgsender}Resent-To: $data->{originator}
641 ${resentcc}Resent-Date: $tdate
642 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
643 Resent-Sender: $gMaintainerEmail
644 X-$gProject-PR-Message: report $ref
645 X-$gProject-PR-Package: $data->{package}
646 X-$gProject-PR-Keywords: $data->{keywords}
649 } elsif ($codeletter eq 'B') {
650 &htmllog($newref ? "Report" : "Information", "forwarded",
651 join(', ',"$gSubmitList\@$gListDomain",@resentccs),
652 "<code>$gBug#$ref</code>".
653 (length($data->{package})? "; Package <code>".&sani($data->{package})."</code>" : '').
655 &sendmessage(<<END,["$gSubmitList\@$gListDomain",@resentccs],[@bccs]);
656 Subject: $gBug#$ref: $newsubject
657 Reply-To: $replyto, $ref\@$gEmailDomain
658 Resent-From: $header{'from'}
659 ${orgsender}Resent-To: $gSubmitList\@$gListDomain
660 ${resentcc}Resent-Date: $tdate
661 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
662 Resent-Sender: $gMaintainerEmail
663 X-$gProject-PR-Message: report $ref
664 X-$gProject-PR-Package: $data->{package}
665 X-$gProject-PR-Keywords: $data->{keywords}
668 } elsif (@resentccs or @bccs) {
669 # D and F done far earlier; B just done - so this must be M or Q
670 # We preserve whichever it was in the Reply-To (possibly adding
673 &htmllog($newref ? "Report" : "Information", "forwarded",
675 "<code>$gBug#$ref</code>".
676 (length($data->{package}) ? "; Package <code>".&sani($data->{package})."</code>" : '').
679 &htmllog($newref ? "Report" : "Information", "stored",
681 "<code>$gBug#$ref</code>".
682 (length($data->{package}) ? "; Package <code>".&sani($data->{package})."</code>" : '').
685 &sendmessage(<<END,[@resentccs],[@bccs]);
686 Subject: $gBug#$ref: $newsubject
687 Reply-To: $replyto, $ref-$baddressroot\@$gEmailDomain
688 Resent-From: $header{'from'}
689 ${orgsender}Resent-To: $resentccval
691 Resent-Message-ID: <handler.$ref.$nn\@$gEmailDomain>
692 Resent-Sender: $gMaintainerEmail
693 X-$gProject-PR-Message: report $ref
694 X-$gProject-PR-Package: $data->{package}
695 X-$gProject-PR-Keywords: $data->{keywords}
700 $htmlbreak= length($brokenness) ? "<p>\n".&sani($brokenness)."\n<p>\n" : '';
701 $htmlbreak =~ s/\n\n/\n<P>\n\n/g;
702 if (length($resentccval)) {
703 $htmlbreak = " Copy sent to <code>".&sani($resentccval)."</code>.".
707 &htmllog("Acknowledgement","sent",$replyto,
709 "New $gBug report received and filed, but not forwarded." :
710 "New $gBug report received and forwarded."). $htmlbreak);
711 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
712 From: $gMaintainerEmail ($gProject $gBug Tracking System)
714 Subject: $gBug#$ref: Acknowledgement of QUIET report
716 Message-ID: <handler.$ref.$nn.ackquiet\@$gEmailDomain>
717 In-Reply-To: $header{'message-id'}
718 References: $header{'message-id'}
720 X-$gProject-PR-Message: ack-quiet $ref
721 X-$gProject-PR-Package: $data->{package}
722 X-$gProject-PR-Keywords: $data->{keywords}
723 Reply-To: $ref-quiet\@$gEmailDomain
725 Thank you for the problem report you have sent regarding $gProject.
726 This is an automatically generated reply, to let you know your message
727 has been received. It has not been forwarded to the developers or
728 their mailing list; you should ensure that the developers are aware of
729 the problem you have entered into the system - preferably quoting the
730 $gBug reference number, #$ref.
732 If you wish to submit further information on your problem, please send it
733 to $ref-$baddressroot\@$gEmailDomain (and *not*
734 to $baddress\@$gEmailDomain).
736 Please do not reply to the address at the top of this message,
737 unless you wish to report a problem with the $gBug-tracking system.
740 (administrator, $gProject $gBugs database)
742 From: $gMaintainerEmail ($gProject $gBug Tracking System)
744 Subject: $gBug#$ref: Acknowledgement of maintainer-only report
746 Message-ID: <handler.$ref.$nn.ackmaint\@$gEmailDomain>
747 In-Reply-To: $header{'message-id'}
748 References: $header{'message-id'}
750 X-$gProject-PR-Message: ack-maintonly $ref
751 X-$gProject-PR-Package: $data->{package}
752 X-$gProject-PR-Keywords: $data->{keywords}
753 Reply-To: $ref-maintonly\@$gEmailDomain
755 Thank you for the problem report you have sent regarding $gProject.
756 This is an automatically generated reply, to let you know your message has
757 been received. It is being forwarded to the developers (but not the mailing
758 list, as you requested) for their attention; they will reply in due course.
760 If you wish to submit further information on your problem, please send
761 it to $ref-$baddressroot\@$gEmailDomain (and *not*
762 to $baddress\@$gEmailDomain).
764 Please do not reply to the address at the top of this message,
765 unless you wish to report a problem with the $gBug-tracking system.
768 (administrator, $gProject $gBugs database)
770 From: $gMaintainerEmail ($gProject $gBug Tracking System)
772 Subject: $gBug#$ref: Acknowledgement ($subject)
773 Message-ID: <handler.$ref.$nn.ack\@$gEmailDomain>
774 In-Reply-To: $header{'message-id'}
775 References: $header{'message-id'}
777 X-$gProject-PR-Message: ack $ref
778 X-$gProject-PR-Package: $data->{package}
779 X-$gProject-PR-Keywords: $data->{keywords}
780 Reply-To: $ref\@$gEmailDomain
782 Thank you for the problem report you have sent regarding $gProject.
783 This is an automatically generated reply, to let you know your message has
784 been received. It is being forwarded to the developers mailing list for
785 their attention; they will reply in due course.
787 If you wish to submit further information on your problem, please send
788 it to $ref\@$gEmailDomain (and *not* to
789 $baddress\@$gEmailDomain).
791 Please do not reply to the address at the top of this message,
792 unless you wish to report a problem with the $gBug-tracking system.
795 (administrator, $gProject $gBugs database)
797 } elsif ($codeletter ne 'U' and
798 $header{'precedence'} !~ /\b(?:bulk|junk|list)\b/) {
799 &htmllog("Acknowledgement","sent",$replyto,
800 ($veryquiet ? "Extra info received and filed, but not forwarded." :
801 $codeletter eq 'M' ? "Extra info received and forwarded to maintainer." :
802 "Extra info received and forwarded to list."). $htmlbreak);
803 &sendmessage($veryquiet ? <<END : $codeletter eq 'M' ? <<END : <<END,'');
804 From: $gMaintainerEmail ($gProject $gBug Tracking System)
806 Subject: $gBug#$ref: Info received and FILED only
808 Message-ID: <handler.$ref.$nn.ackinfoquiet\@$gEmailDomain>
809 In-Reply-To: $header{'message-id'}
810 References: $header{'message-id'}
812 X-$gProject-PR-Message: ack-info-quiet $ref
813 X-$gProject-PR-Package: $data->{package}
814 X-$gProject-PR-Keywords: $data->{keywords}
815 Reply-To: $ref-quiet\@$gEmailDomain
817 Thank you for the additional information you have supplied regarding
818 this problem report. It has NOT been forwarded to the developers, but
819 will accompany the original report in the $gBug tracking system. Please
820 ensure that you yourself have sent a copy of the additional
821 information to any relevant developers or mailing lists.
823 If you wish to continue to submit further information on your problem,
824 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
826 Please do not reply to the address at the top of this message,
827 unless you wish to report a problem with the $gBug-tracking system.
830 (administrator, $gProject $gBugs database)
832 From: $gMaintainerEmail ($gProject $gBug Tracking System)
834 Subject: $gBug#$ref: Info received for maintainer only
836 Message-ID: <handler.$ref.$nn.ackinfomaint\@$gEmailDomain>
837 In-Reply-To: $header{'message-id'}
838 References: $header{'message-id'}
840 X-$gProject-PR-Message: ack-info-maintonly $ref
841 X-$gProject-PR-Package: $data->{package}
842 X-$gProject-PR-Keywords: $data->{keywords}
843 Reply-To: $ref-maintonly\@$gEmailDomain
845 Thank you for the additional information you have supplied regarding
846 this problem report. It has been forwarded to the developer(s) (but
847 not to the mailing list) to accompany the original report.
849 If you wish to continue to submit further information on your problem,
850 please send it to $ref-$baddressroot\@$gEmailDomain, as before.
852 Please do not reply to the address at the top of this message,
853 unless you wish to report a problem with the $gBug-tracking system.
856 (administrator, $gProject $gBugs database)
858 From: $gMaintainerEmail ($gProject $gBug Tracking System)
860 Subject: $gBug#$ref: Info received (was $subject)
861 Message-ID: <handler.$ref.$nn.ackinfo\@$gEmailDomain>
862 In-Reply-To: $header{'message-id'}
863 References: $header{'message-id'}
865 X-$gProject-PR-Message: ack-info $ref
866 X-$gProject-PR-Package: $data->{package}
867 X-$gProject-PR-Keywords: $data->{keywords}
868 Disabled-Doogie-Reply-To: $ref\@$gEmailDomain
870 Thank you for the additional information you have supplied regarding
871 this problem report. It has been forwarded to the developer(s) and
872 to the developers mailing list to accompany the original report.
874 If you wish to continue to submit further information on your problem,
875 please send it to $ref\@$gEmailDomain, as before.
877 Please do not reply to the address at the top of this message,
878 unless you wish to report a problem with the $gBug-tracking system.
881 (administrator, $gProject $gBugs database)
890 open(NEW,">$f.new") || &quit("$f.new: create: $!");
891 print(NEW "$v") || &quit("$f.new: write: $!");
892 close(NEW) || &quit("$f.new: close: $!");
893 rename("$f.new","$f") || &quit("rename $f.new to $f: $!");
897 my $hash = get_hashname($ref);
898 if (!open(AP,">>db-h/$hash/$ref.log")) {
899 print DEBUG "failed open log<\n";
900 print DEBUG "failed open log err $!<\n";
901 &quit("opening db-h/$hash/$ref.log (li): $!");
903 print(AP "\7\n",@{escapelog(@log)},"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!");
904 close(AP) || &quit("closing db-h/$hash/$ref.log (li): $!");
908 utime(time,time,"db");
910 while ($u= $cleanups[$#cleanups]) { &$u; }
911 unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!");
915 &quit("wot no exit");
917 sub chldhandle { $chldexit = 'yes'; }
920 local ($whatobj,$whatverb,$where,$desc) = @_;
921 my $hash = get_hashname($ref);
922 open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lh): $!");
925 "<strong>$whatobj $whatverb</strong>".
926 ($where eq '' ? "" : " to <code>".&sani($where)."</code>").
928 "\n\3\n") || &quit("writing db-h/$hash/$ref.log (lh): $!");
929 close(AP) || &quit("closing db-h/$hash/$ref.log (lh): $!");
934 map { $_->address() }
935 map { Mail::Address->parse($_) } @_;
942 while ($msg =~ s/(.*\n)//) {
949 # strip continuation lines too
963 local ($msg,$recips,$bcc) = @_;
964 if ((!ref($recips) && $recips eq '') || @$recips == 0) {
967 $msg = "X-Loop: $gMaintainerEmail\n" . $msg;
969 my $hash = get_hashname($ref);
970 #save email to the log
971 open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lo): $!");
972 print(AP "\2\n",join("\4",@$recips),"\n\5\n",
973 @{escapelog(stripbccs($msg))},"\n\3\n") ||
974 &quit("writing db-h/$hash/$ref.log (lo): $!");
975 close(AP) || &quit("closing db-h/$hash/$ref.log (lo): $!");
978 shift @$recips if $recips->[0] eq '-t';
979 push @$recips, @$bcc;
982 #if debugging.. save email to a log
983 # open AP, ">>debug";
984 # print AP join( '|', @$recips )."\n>>";
985 # print AP get_addresses( @$recips );
986 # print AP "<<\n".$msg;
987 # print AP "\n--------------------------------------------------------\n";
992 $SIG{'CHLD'}='chldhandle';
993 #print DEBUG "mailing sigchild set up<\n";
996 #print DEBUG "mailing opened pipe fork<\n";
997 defined($c) || die $!;
998 #print DEBUG "mailing opened pipe fork ok $c<\n";
999 if (!$c) { # ie, we are in the child process
1000 #print DEBUG "mailing child<\n";
1001 unless (open(STDERR,">&STDOUT")) {
1002 #print DEBUG "mailing child opened stderr<\n";
1003 print STDOUT "redirect stderr: $!\n";
1004 #print DEBUG "mailing child opened stderr fail<\n";
1006 #print DEBUG "mailing child opened stderr fail exit !?<\n";
1008 #print DEBUG "mailing child opened stderr ok<\n";
1010 #print DEBUG "mailing child forked again<\n";
1011 defined($c) || die $!;
1012 #print DEBUG "mailing child forked again ok $c<\n";
1013 if (!$c) { # ie, we are the child process
1014 #print DEBUG "mailing grandchild<\n";
1015 exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odq','-oem','-oi',get_addresses(@$recips);
1016 #print DEBUG "mailing grandchild exec failed<\n";
1018 #print DEBUG "mailing grandchild died !?<\n";
1020 #print DEBUG "mailing child not grandchild<\n";
1021 print(D $msg) || die $!;
1022 #print DEBUG "mailing child printed msg<\n";
1024 #print DEBUG "mailing child closed pipe<\n";
1025 die "\n*** command returned exit status $?\n" if $?;
1026 #print DEBUG "mailing child exit status ok<\n";
1028 #print DEBUG "mailing child exited ?!<\n";
1030 #print DEBUG "mailing parent<\n";
1032 #print DEBUG "mailing parent results emptied<\n";
1033 while( $chldexit eq 'no' ) { $results.= $_; }
1034 #print DEBUG "mailing parent results read >$results<\n";
1036 #print DEBUG "mailing parent results closed<\n";
1037 $results.= "\n*** child returned exit status $?\n" if $?;
1038 #print DEBUG "mailing parent exit status ok<\n";
1039 $SIG{'CHLD'}='DEFAULT';
1040 #print DEBUG "mailing parent sigchild default<\n";
1041 if (length($results)) { &quit("running sendmail: $results"); }
1042 #print DEBUG "mailing parent results ok<\n";
1045 sub checkmaintainers {
1046 return if $maintainerschecked++;
1047 return if !length($data->{package});
1048 open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!");
1052 m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers bogus \`$_'");
1053 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
1054 $maintainerof{$1}= $2;
1057 open(MAINT,"$gMaintainerFileOverride") || die &quit("maintainers.override open: $!");
1061 m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers.override bogus \`$_'");
1062 $a= $1; $b= $2; $a =~ y/A-Z/a-z/;
1063 $maintainerof{$1}= $2;
1066 open(SOURCES,"$gPackageSource") || &quit("pkgsrc open: $!");
1068 next unless m/^(\S+)\s+\S+\s+(\S.*\S)\s*$/;
1074 $anymaintfound=0; $anymaintnotfound=0;
1075 for $p (split(m/[ \t?,()]+/,$data->{package})) {
1077 if (defined $gSubscriptionDomain) {
1078 if (defined($pkgsrc{$p})) {
1079 push @addsrcaddrs, "$pkgsrc{$p}\@$gSubscriptionDomain";
1081 push @addsrcaddrs, "$p\@$gSubscriptionDomain";
1084 if (defined($maintainerof{$p})) {
1085 print DEBUG "maintainer add >$p|$maintainerof{$p}<\n";
1086 $addmaint= $maintainerof{$p};
1087 push(@maintaddrs,$addmaint) unless
1088 $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs);
1091 print DEBUG "maintainer none >$p<\n";
1092 push(@maintaddrs,$gUnknownMaintainerEmail) unless $anymaintnotfound;
1093 $anymaintnotfound++;