#!/usr/bin/perl # $Id: process.in,v 1.39 2001/09/18 20:59:36 joy Exp $ # # Usage: process nn # Temps: incoming/Pnn use Mail::Address; $config_path = '/org/bugs.debian.org/etc'; $lib_path = '/org/bugs.debian.org/scripts'; require "$config_path/config"; require "$lib_path/errorlib"; $ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'}; chdir( "$gSpoolDir" ) || die 'chdir spool: $!\n'; #open(DEBUG,"> /tmp/debbugs.debug"); umask(002); open DEBUG, ">/dev/null"; defined( $intdate= time ) || &quit( "failed to get time: $!" ); $_=shift; m/^([BMQFDU])(\d*)\.\d+$/ || &quit("bad argument"); $codeletter= $1; $tryref= length($2) ? $2+0 : -1; $nn= $_; if (!rename("incoming/G$nn","incoming/P$nn")) { $_=$!.''; m/no such file or directory/i && exit 0; &quit("renaming to lock: $!"); } $baddress= 'submit' if $codeletter eq 'B'; $baddress= 'maintonly' if $codeletter eq 'M'; $baddress= 'quiet' if $codeletter eq 'Q'; $baddress= 'forwarded' if $codeletter eq 'F'; $baddress= 'done' if $codeletter eq 'D'; $baddress= 'submitter' if $codeletter eq 'U'; $baddress || &quit("bad codeletter $codeletter"); $baddressroot= $baddress; $baddress= "$tryref-$baddress" if $tryref>=0; open(M,"incoming/P$nn"); @log=; close(M); @msg=@log; grep(s/\n+$//,@msg); print DEBUG "###\n",join("##\n",@msg),"\n###\n"; chop($tdate= `date -u '+%a, %d %h %Y %T GMT'`); $fwd= <$_<\n"; if (s/^(\S+):\s*//) { $v= $1; $v =~ y/A-Z/a-z/; print DEBUG ">$v=$_<\n"; $header{$v}= $_; } else { print DEBUG "!>$_<\n"; } } #remove blank lines while ($i <= $#msg && !length($msg[$i])) { $fwd .= "\n"; $i++; } #skips the "this is mime" message and any blank space after it if ( $msg[$i] =~ /^This is a multi-part message in MIME format./ ) { while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; } while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; } } #if the lines starts with -- or is nothing but blank space... #skip to the next blank line(s) then skip past the blank line(s) if ( $msg[$i] =~ /^--/ || $msg[$i] =~ /^\s*$/ ) { while ( $i <= $#msg && length( $msg[$i] ) ) { $fwd .= $msg[$i] . "\n"; $i++; } while ( $i <= $#msg && !length( $msg[$i] ) ) { $fwd .= "\n"; $i++; } } while (defined ($msg[$i] ) ) { last if ( $msg[$i] !~ m/^([\w]+):\s*(\S.*)/ ); $i++; $fn = $1; $fv = $2; print DEBUG ">$fn|$'|\n"; $fwd .= $fn.': '.$fv."\n"; $fn =~ y/A-Z/a-z/; $fv =~ y/A-Z/a-z/; $pheader{$fn}= $fv; print DEBUG ">$fn~$fv<\n"; } $fwd .= join("\n",@msg[$i..$#msg]); print DEBUG "***\n$fwd\n***\n"; if (defined $header{'resent-from'} && !defined $header{'from'}) { $header{'from'} = $header{'resent-from'}; } defined($header{'from'}) || &quit("no From header"); $replyto= defined($header{'reply-to'}) ? $header{'reply-to'} : $header{'from'}; $_= $replyto; $_= "$2 <$1>" if m/^([^\<\> \t\n\(\)]+) \(([^\(\)\<\>]+)\)$/; $replytocompare= $_; print DEBUG "replytocompare >$replytocompare<\n"; if (!defined($header{'subject'})) { $brokenness.= <= 0) { $bfound= &lockreadbugmerge($tryref); if ($bfound) { $ref= $tryref; } else { &htmllog("Reply","sent", $replyto,"Unknown problem report number $tryref."); &sendmessage(< In-Reply-To: $header{'message-id'} References: $header{'message-id'} $s_msgid X-$gProject-PR-Message: error You sent a message to the $gBug tracking system which gave (in the Subject line or encoded into the recipient at $gEmailDomain), the number of a nonexistent $gBug report (#$tryref). This may be because that $gBug report has been resolved for more than $gRemoveAge days, and the record of it has been expunged, or because you mistyped the $gBug report number. Your message was dated $header{'date'} and was sent to $baddress\@$gEmailDomain. It had Message-ID $header{'message-id'} and Subject $subject. It has been filed (under junk) but otherwise ignored. Please consult your records to find the correct $gBug report number, or contact me, the system administrator, for assistance. $gMaintainer (administrator, $gProject $gBugs database) (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) END &appendlog; &finish; } } else { &filelock('lock/-1'); } if ($codeletter eq 'D' || $codeletter eq 'F') { if ($replyto =~ m/$gBounceFroms/o || $header{'from'} =~ m/$gBounceFroms/o) { &quit("bounce detected ! Mwaap! Mwaap!"); } $markedby= $header{'from'} eq $replyto ? $replyto : "$header{'from'} (reply to $replyto)"; if ($codeletter eq 'F') { (&appendlog,&finish) if length($s_forwarded); $receivedat= "forwarded\@$gEmailDomain"; $markaswhat= 'forwarded'; $set_forwarded= $header{'to'}; if ( length( $gListDomain ) > 0 && length( $gFowardList ) > 0 ) { $generalcc= "$gFowardList\@$gListDomain"; } else { $generalcc=''; } } else { (&appendlog,&finish) if length($s_done); $receivedat= "done\@$gEmailDomain"; $markaswhat= 'done'; $set_done= $header{'from'}; if ( length( $gListDomain ) > 0 && length( $gDoneList ) > 0 ) { $generalcc= "$gDoneList\@$gListDomain"; } else { $generalcc=''; } } if ($ref<0) { &htmllog("Warning","sent",$replyto,"Message ignored."); &sendmessage(< In-Reply-To: $header{'message-id'} References: $header{'message-id'} $s_msgid X-$gProject-PR-Message: error You sent a message to the $gProject $gBug tracking system old-style unified mark as $markaswhat address ($receivedat), without a recognisable $gBug number in the Subject. Your message has been filed under junk but otherwise ignored. If you don't know what I'm talking about then probably either: (a) you unwittingly sent a message to done\@$gEmailDomain because you replied to all recipients of the message a developer used to mark a $gBug as done and you modified the Subject. In this case, please do not be alarmed. To avoid confusion do not do it again, but there is no need to apologise or mail anyone asking for an explanation. (b) you are a system administrator, reading this because the $gBug tracking system is responding to a misdirected bounce message. In this case there is a serious mail system misconfiguration somewhere - please contact me immediately. Your message was dated $header{'date'} and had message-id $header{'message-id'} and subject $subject. If you need any assistance or explanation please contact me. $gMaintainer (administrator, $gProject $gBugs database) END &appendlog; &finish; } &checkmaintainers; $noticeccval.= join(', ', grep($_ ne $replyto,@maintaddrs)); $noticeccval =~ s/\s+\n\s+/ /g; $noticeccval =~ s/^\s+/ /; $noticeccval =~ s/\s+$//; if (length($noticeccval)) { $noticecc= "Cc: $noticeccval\n"; } if (length($generalcc)) { $noticecc.= "Bcc: $generalcc\n"; } @process= ($ref,split(/ /,$s_mergedwith)); $orgref= $ref; for $ref (@process) { if ($ref != $orgref) { &unfilelock; &lockreadbug($ref) || die "huh ? $ref from $orgref out of @process"; } $s_done= $set_done if defined($set_done); $s_forwarded= $set_forwarded if defined($set_forwarded); my $hash = get_hashname($ref); &overwrite("db-h/$hash/$ref.status", "$s_originator\n$s_date\n$s_subject\n$s_msgid\n". "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n"); &bughook('change',$ref, "$s_originator\n$s_date\n$s_subject\n$s_msgid\n". "$s_package\n$s_keywords\n$s_done\n$s_forwarded\n$s_mergedwith\n$s_severity\n"); open(O,"db-h/$hash/$ref.report") || &quit("read original report: $!"); $x= join('',); close(O); if ($codeletter eq 'F') { &htmllog("Reply","sent",$replyto,"You have marked $gBug as forwarded."); &sendmessage(< In-Reply-To: $header{'message-id'} References: $header{'message-id'} $s_msgid X-$gProject-PR-Message: forwarded $ref Your message dated $header{'date'} with message-id $header{'message-id'} has caused the $gProject $gBug report #$ref, regarding $s_subject to be marked as having been forwarded to the upstream software author(s) $s_forwarded. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) $gMaintainer (administrator, $gProject $gBugs database) END } else { &htmllog("Reply","sent",$replyto,"You have taken responsibility."); &sendmessage(< In-Reply-To: $header{'message-id'} References: $header{'message-id'} $s_msgid X-$gProject-PR-Message: closed $ref Your message dated $header{'date'} with message-id $header{'message-id'} and subject line $subject has caused the attached $gBug report to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the $gBug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) $gMaintainer (administrator, $gProject $gBugs database) END &htmllog("Notification","sent",$s_originator, "$gBug acknowledged by developer."); &sendmessage(< In-Reply-To: $s_msgid References: $header{'message-id'} $s_msgid X-$gProject-PR-Message: they-closed $ref Reply-To: $ref\@$gEmailDomain This is an automatic notification regarding your $gBug report #$ref: $s_subject, which was filed against the $s_package package. It has been closed by one of the developers, namely $markedby. Their explanation is attached below. If this explanation is unsatisfactory and you have not received a better one in a separate message then please contact the developer, by replying to this email. $gMaintainer (administrator, $gProject $gBugs database) END } &appendlog; } &finish; } if ($ref<0) { if ($codeletter eq 'U') { &htmllog("Warning","sent",$replyto,"Message not forwarded."); &sendmessage(< In-Reply-To: $header{'message-id'} References: $header{'message-id'} $s_msgid X-$gProject-PR-Message: error You sent a message to the $gProject $gBug tracking system send to $gBug report submitter address $baddress\@$gEmailDomain, without a recognisable $gBug number in the Subject. Your message has been filed under junk but otherwise ignored. If you don't know what I'm talking about then probably either: (a) you unwittingly sent a message to $baddress\@$gEmailDomain because you replied to all recipients of the message a developer sent to a $gBug's submitter and you modified the Subject. In this case, please do not be alarmed. To avoid confusion do not do it again, but there is no need to apologise or mail anyone asking for an explanation. (b) you are a system administrator, reading this because the $gBug tracking system is responding to a misdirected bounce message. In this case there is a serious mail system misconfiguration somewhere - please contact me immediately. Your message was dated $header{'date'} and had message-id $header{'message-id'} and subject $subject. If you need any assistance or explanation please contact me. $gMaintainer (administrator, $gProject $gBugs database) END &appendlog; &finish; } if (!defined($pheader{'package'})) { &htmllog("Warning","sent",$replyto,"Message not forwarded."); &sendmessage(< In-Reply-To: $header{'message-id'} References: $header{'message-id'} $s_msgid X-$gProject-PR-Message: error Your message didn't have a Package: line at the start (in the pseudo-header following the real mail header), or didn't have a pseudo-header at all. This makes it much harder for us to categorise and deal with your problem report. Please _resubmit_ your report and tell us which package the report is on. For help, check out http://$gWebDomain/Reporting.html. Your message was dated $header{'date'} and had message-id $header{'message-id'} and subject $subject. The complete text of it is attached to this message. If you need any assistance or explanation please contact me. $gMaintainer (administrator, $gProject $gBugs database) END &appendlog; &finish; } else { $s_package= $pheader{'package'}; } $s_keywords= ''; if (defined($pheader{'keywords'})) { $s_keywords= $pheader{'keywords'}; } elsif (defined($pheader{'tags'})) { $s_keywords= $pheader{'tags'}; } if (length($s_keywords)) { my @kws; my %gkws = map { ($_, 1) } @gTags; foreach my $kw (sort split(/[,\s]+/, lc($s_keywords))) { push @kws, $kw if (defined $gkws{$kw}); } $s_keywords = join(" ", @kws); } $s_severity= ''; if (defined($pheader{'severity'}) || defined($pheader{'priority'})) { $s_severity= $pheader{'severity'}; $s_severity= $pheader{'priority'} unless ($s_severity); if (!grep($_ eq $s_severity, @severities, "$gDefaultSeverity")) { $brokenness.= <; $v =~ s/\n$// || &quit("nextnumber bad format"); $ref= $v+0; $v += 1; $newref=1; &overwrite('nextnumber', "$v\n"); &unfilelock; my $hash = get_hashname($ref); &overwrite("db-h/$hash/$ref.log",''); &overwrite("db-h/$hash/$ref.status", "$replyto\n$intdate\n$subject\n$header{'message-id'}\n". "$s_package\n$s_keywords\n\n\n\n$s_severity\n"); &bughook('new',$ref, "$replyto\n$intdate\n$subject\n$header{'message-id'}\n". "$s_package\n$s_keywords\n\n\n\n$s_severity\n"); &overwrite("db-h/$hash/$ref.report", join("\n",@msg)."\n"); } &checkmaintainers; print DEBUG "maintainers >@maintaddrs<\n"; $orgsender= defined($header{'sender'}) ? "Original-Sender: $header{'sender'}\n" : ''; $newsubject= $subject; $newsubject =~ s/^$gBug#$ref\W*\s*//; $xcchdr= $header{ 'x-debbugs-cc' }; if ($xcchdr =~ m/\S/) { push(@resentccs,$xcchdr); $resentccexplain.= < Resent-Sender: $gMaintainerEmail X-$gProject-PR-Message: report $ref X-$gProject-PR-Package: $s_package X-$gProject-PR-Keywords: $s_keywords $fwd END } elsif ($codeletter eq 'B') { &htmllog($newref ? "Report" : "Information", "forwarded", join(', ',"$gSubmitList\@$gListDomain",@resentccs), "$gBug#$ref". (length($s_package)? "; Package ".&sani($s_package)."" : ''). "."); &sendmessage(< Resent-Sender: $gMaintainerEmail X-$gProject-PR-Message: report $ref X-$gProject-PR-Package: $s_package X-$gProject-PR-Keywords: $s_keywords $fwd END } elsif (@resentccs) { # D and F done far earlier; B just done - so this must be M or Q # We preserve whichever it was in the Reply-To (possibly adding # the $gBug#). &htmllog($newref ? "Report" : "Information", "forwarded", $resentccval, "$gBug#$ref". (length($s_package)? "; Package ".&sani($s_package)."" : ''). "."); &sendmessage(< Resent-Sender: $gMaintainerEmail X-$gProject-PR-Message: report $ref X-$gProject-PR-Package: $s_package X-$gProject-PR-Keywords: $s_keywords $fwd END } $htmlbreak= length($brokenness) ? "

\n".&sani($brokenness)."\n

\n" : ''; $htmlbreak =~ s/\n\n/\n

\n\n/g; if (length($resentccval)) { $htmlbreak = " Copy sent to ".&sani($resentccval).".". $htmlbreak; } if ($newref) { &htmllog("Acknowledgement","sent",$replyto, ($veryquiet ? "New $gBug report received and filed, but not forwarded." : "New $gBug report received and forwarded."). $htmlbreak); &sendmessage($veryquiet ? < In-Reply-To: $header{'message-id'} References: $header{'message-id'} X-$gProject-PR-Message: ack-quiet $ref Reply-To: $ref-quiet\@$gEmailDomain Thank you for the problem report you have sent regarding $gProject. This is an automatically generated reply, to let you know your message has been received. It has not been forwarded to the developers or their mailing list; you should ensure that the developers are aware of the problem you have entered into the system - preferably quoting the $gBug reference number, #$ref. $resentccexplain If you wish to submit further information on your problem, please send it to $ref-$baddressroot\@$gEmailDomain (and *not* to $baddress\@$gEmailDomain). Please do not reply to the address at the top of this message, unless you wish to report a problem with the $gBug-tracking system. $brokenness $gMaintainer (administrator, $gProject $gBugs database) END From: $gMaintainerEmail ($gProject $gBug Tracking System) To: $replyto Subject: $gBug#$ref: Acknowledgement of maintainer-only report ($subject) Message-ID: In-Reply-To: $header{'message-id'} References: $header{'message-id'} X-$gProject-PR-Message: ack-maintonly $ref Reply-To: $ref-maintonly\@$gEmailDomain Thank you for the problem report you have sent regarding $gProject. This is an automatically generated reply, to let you know your message has been received. It is being forwarded to the developers (but not the mailing list, as you requested) for their attention; they will reply in due course. $resentccexplain If you wish to submit further information on your problem, please send it to $ref-$baddressroot\@$gEmailDomain (and *not* to $baddress\@$gEmailDomain). Please do not reply to the address at the top of this message, unless you wish to report a problem with the $gBug-tracking system. $brokenness $gMaintainer (administrator, $gProject $gBugs database) END From: $gMaintainerEmail ($gProject $gBug Tracking System) To: $replyto Subject: $gBug#$ref: Acknowledgement ($subject) Message-ID: In-Reply-To: $header{'message-id'} References: $header{'message-id'} X-$gProject-PR-Message: ack $ref Reply-To: $ref\@$gEmailDomain Thank you for the problem report you have sent regarding $gProject. This is an automatically generated reply, to let you know your message has been received. It is being forwarded to the developers mailing list for their attention; they will reply in due course. $resentccexplain If you wish to submit further information on your problem, please send it to $ref\@$gEmailDomain (and *not* to $baddress\@$gEmailDomain). Please do not reply to the address at the top of this message, unless you wish to report a problem with the $gBug-tracking system. $brokenness $gMaintainer (administrator, $gProject $gBugs database) END } elsif ($codeletter ne 'U') { &htmllog("Acknowledgement","sent",$replyto, ($veryquiet ? "Extra info received and filed, but not forwarded." : $codeletter eq 'M' ? "Extra info received and forwarded to maintainer." : "Extra info received and forwarded to list."). $htmlbreak); &sendmessage($veryquiet ? < In-Reply-To: $header{'message-id'} References: $header{'message-id'} X-$gProject-PR-Message: ack-info-quiet $ref Reply-To: $ref-quiet\@$gEmailDomain Thank you for the additional information you have supplied regarding this problem report. It has NOT been forwarded to the developers, but will accompany the original report in the $gBug tracking system. Please ensure that you yourself have sent a copy of the additional information to any relevant developers or mailing lists. $resentccexplain If you wish to continue to submit further information on your problem, please send it to $ref-$baddressroot\@$gEmailDomain, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the $gBug-tracking system. $brokenness $gMaintainer (administrator, $gProject $gBugs database) END From: $gMaintainerEmail ($gProject $gBug Tracking System) To: $replyto Subject: $gBug#$ref: Info received for maintainer only (was $subject) Message-ID: In-Reply-To: $header{'message-id'} References: $header{'message-id'} X-$gProject-PR-Message: ack-info-maintonly $ref Reply-To: $ref-maintonly\@$gEmailDomain Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) (but not to the mailing list) to accompany the original report. $resentccexplain If you wish to continue to submit further information on your problem, please send it to $ref-$baddressroot\@$gEmailDomain, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the $gBug-tracking system. $brokenness $gMaintainer (administrator, $gProject $gBugs database) END From: $gMaintainerEmail ($gProject $gBug Tracking System) To: $replyto Subject: $gBug#$ref: Info received (was $subject) Message-ID: In-Reply-To: $header{'message-id'} References: $header{'message-id'} X-$gProject-PR-Message: ack-info $ref Reply-To: $ref\@$gEmailDomain Thank you for the additional information you have supplied regarding this problem report. It has been forwarded to the developer(s) and to the developers mailing list to accompany the original report. $resentccexplain If you wish to continue to submit further information on your problem, please send it to $ref\@$gEmailDomain, as before. Please do not reply to the address at the top of this message, unless you wish to report a problem with the $gBug-tracking system. $brokenness $gMaintainer (administrator, $gProject $gBugs database) END } &appendlog; &finish; sub overwrite { local ($f,$v) = @_; open(NEW,">$f.new") || &quit("$f.new: create: $!"); print(NEW "$v") || &quit("$f.new: write: $!"); close(NEW) || &quit("$f.new: close: $!"); rename("$f.new","$f") || &quit("rename $f.new to $f: $!"); } sub appendlog { my $hash = get_hashname($ref); if (!open(AP,">>db-h/$hash/$ref.log")) { print DEBUG "failed open log<\n"; print DEBUG "failed open log err $!<\n"; &quit("opening db-h/$hash/$ref.log (li): $!"); } print(AP "\7\n",@log,"\n\3\n") || &quit("writing db-h/$hash/$ref.log (li): $!"); close(AP) || &quit("closing db-h/$hash/$ref.log (li): $!"); } sub finish { utime(time,time,"db"); local ($u); while ($u= $cleanups[$#cleanups]) { &$u; } unlink("incoming/P$nn") || &quit("unlinking incoming/P$nn: $!"); exit $_[0]; } &quit("wot no exit"); sub chldhandle { $chldexit = 'yes'; } sub htmllog { local ($whatobj,$whatverb,$where,$desc) = @_; my $hash = get_hashname($ref); open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lh): $!"); print(AP "\6\n". "$whatobj $whatverb to ".&sani($where). ":
\n". $desc. "\n\3\n") || &quit("writing db-h/$hash/$ref.log (lh): $!"); close(AP) || &quit("closing db-h/$hash/$ref.log (lh): $!"); } sub get_addresses { return map { $_->address() } map { Mail::Address->parse($_) } @_; } sub sendmessage { local ($msg,@recips) = @_; if ($recips[0] eq '' && $#recips == 0) { @recips= ('-t'); } my $hash = get_hashname($ref); #save email to the log open(AP,">>db-h/$hash/$ref.log") || &quit("opening db-h/$hash/$ref.log (lo): $!"); print(AP "\2\n",join("\4",@recips),"\n\5\n$msg\n\3\n") || &quit("writing db-h/$hash/$ref.log (lo): $!"); close(AP) || &quit("closing db-h/$hash/$ref.log (lo): $!"); #if debbuging.. save email to a log # open AP, ">>debug"; # print AP join( '|', @recips )."\n>>"; # print AP get_addresses( @recips ); # print AP "<<\n".$msg; # print AP "\n--------------------------------------------------------\n"; # close AP; #start mailing $_ = ''; $SIG{'CHLD'}='chldhandle'; #print DEBUG "mailing sigchild set up<\n"; $chldexit = 'no'; $c= open(U,"-|"); #print DEBUG "mailing opened pipe fork<\n"; defined($c) || die $!; #print DEBUG "mailing opened pipe fork ok $c<\n"; if (!$c) { # ie, we are in the child process #print DEBUG "mailing child<\n"; unless (open(STDERR,">&STDOUT")) { #print DEBUG "mailing child opened stderr<\n"; print STDOUT "redirect stderr: $!\n"; #print DEBUG "mailing child opened stderr fail<\n"; exit 1; #print DEBUG "mailing child opened stderr fail exit !?<\n"; } #print DEBUG "mailing child opened stderr ok<\n"; $c= open(D,"|-"); #print DEBUG "mailing child forked again<\n"; defined($c) || die $!; #print DEBUG "mailing child forked again ok $c<\n"; if (!$c) { # ie, we are the child process #print DEBUG "mailing grandchild<\n"; exec '/usr/lib/sendmail','-f'."$gMaintainerEmail",'-odq','-oem','-oi',get_addresses(@recips); #print DEBUG "mailing grandchild exec failed<\n"; die $!; #print DEBUG "mailing grandchild died !?<\n"; } #print DEBUG "mailing child not grandchild<\n"; print(D $msg) || die $!; #print DEBUG "mailing child printed msg<\n"; close(D); #print DEBUG "mailing child closed pipe<\n"; die "\n*** command returned exit status $?\n" if $?; #print DEBUG "mailing child exit status ok<\n"; exit 0; #print DEBUG "mailing child exited ?!<\n"; } #print DEBUG "mailing parent<\n"; $results=''; #print DEBUG "mailing parent results emptied<\n"; while( $chldexit eq 'no' ) { $results.= $_; } #print DEBUG "mailing parent results read >$results<\n"; close(U); #print DEBUG "mailing parent results closed<\n"; $results.= "\n*** child returned exit status $?\n" if $?; #print DEBUG "mailing parent exit status ok<\n"; $SIG{'CHLD'}='DEFAULT'; #print DEBUG "mailing parent sigchild default<\n"; if (length($results)) { &quit("running sendmail: $results"); } #print DEBUG "mailing parent results ok<\n"; } sub checkmaintainers { return if $maintainerschecked++; return if !length($s_package); open(MAINT,"$gMaintainerFile") || die &quit("maintainers open: $!"); while () { m/^\n$/ && next; m/^\s*$/ && next; m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers bogus \`$_'"); $a= $1; $b= $2; $a =~ y/A-Z/a-z/; $maintainerof{$1}= $2; } close(MAINT); open(MAINT,"$gMaintainerFileOverride") || die &quit("maintainers.override open: $!"); while () { m/^\n$/ && next; m/^\s*$/ && next; m/^(\S+)\s+(\S.*\S)\s*\n$/ || &quit("maintainers.override bogus \`$_'"); $a= $1; $b= $2; $a =~ y/A-Z/a-z/; $maintainerof{$1}= $2; } close(MAINT); $anymaintfound=0; $anymaintnotfound=0; for $p (split(m/[ \t?,()]+/,$s_package)) { $p =~ y/A-Z/a-z/; if (defined($maintainerof{$p})) { print DEBUG "maintainer add >$p|$maintainerof{$p}<\n"; $addmaint= $maintainerof{$p}; push(@maintaddrs,$addmaint) unless $addmaint eq $replyto || grep($_ eq $addmaint, @maintaddrs); $anymaintfound++; } else { print DEBUG "maintainer none >$p<\n"; push(@maintaddrs,$gUnknownMaintainerEmail) unless $anymaintnotfound; $anymaintnotfound++; last; } } }