qw(maybelink htmlize_addresslinks htmlize_maintlinks),
],
util => [qw(cgi_parameters quitcgi),
- qw(getmaintainers getpseudodesc)
+ qw(getpseudodesc)
],
#status => [qw(getbugstatus)],
);
my $_maintainer;
my $_maintainer_rev;
-sub getmaintainers {
- return $_maintainer if $_maintainer;
- my %maintainer;
- my %maintainer_rev;
- for my $file (@config{qw(maintainer_file maintainer_file_override)}) {
- next unless defined $file;
- my $maintfile = new IO::File $file,'r' or
- &quitcgi("Unable to open $file: $!");
- while(<$maintfile>) {
- next unless m/^(\S+)\s+(\S.*\S)\s*$/;
- ($a,$b)=($1,$2);
- $a =~ y/A-Z/a-z/;
- $maintainer{$a}= $b;
- for my $maint (map {lc($_->address)} getparsedaddrs($b)) {
- push @{$maintainer_rev{$maint}},$a;
- }
- }
- close($maintfile);
- }
- $_maintainer = \%maintainer;
- $_maintainer_rev = \%maintainer_rev;
- return $_maintainer;
-}
-sub getmaintainers_reverse{
- return $_maintainer_rev if $_maintainer_rev;
- getmaintainers();
- return $_maintainer_rev;
-}
-
my $_pseudodesc;
sub getpseudodesc {
qw($gSendmail $gLibPath),
qw(%gSeverityDisplay @gTags @gSeverityList @gStrongSeverities),
qw(%gSearchEstraier),
+ qw(@gPostProcessall),
],
text => [qw($gBadEmailPrefix $gHTMLTail $gHTMLExpireNote),
],
set_default(\%config,'version_packages_dir',$config{spool_dir}.'/../versions/pkg');
+set_default(\%config,'post_processall',[]);
+
=item sendmail
Sets the sendmail binary to execute; defaults to /usr/lib/sendmail
set_default(\%config,'bad_email_prefix','');
+
+=item text_instructions
+
+This gives more information about bad e-mails to receive.in
+
+=cut
+
+set_default(\%config,'text_instructions',$config{bad_email_prefix});
+
=item html_tail
This shows up at the end of (most) html pages
use Debbugs::Log;
use Debbugs::MIME qw(convert_to_utf8 decode_rfc1522 create_mime_message);
use Debbugs::CGI qw(:url :html :util);
-use Debbugs::Common qw(buglog);
+use Debbugs::Common qw(buglog getmaintainers);
use Debbugs::Packages qw(getpkgsrc);
use Debbugs::Status qw(splitpackages get_bug_status isstrongseverity);
# Creates: incoming/E.nn
# Stop: stop
+use warnings;
+use strict;
+
use Debbugs::Config qw(:globals);
+use Debbugs::Common qw(:lock);
my $lib_path = $gLibPath;
-
-require "$lib_path/errorlib";
-$ENV{'PATH'} = $lib_path.':'.$ENV{'PATH'};
-
use File::Path;
chdir( $gSpoolDir ) || die "chdir spool: $!\n";
-push( @INC, $lib_path );
#open(DEBUG,">&4");
umask(002);
$|=1;
-undef %fudged;
+my %fudged;
+my @ids;
+my $ndone = 0;
&filelock('incoming-cleaner');
for (;;) {
if (-f 'stop') {
@ids= sort(@ids);
}
stat("$gMaintainerFile") || die "stat $gMaintainerFile: $!\n";
- $nf= @ids;
- $id= shift(@ids);
+ my $nf= @ids;
+ my $id= shift(@ids);
unless (rename("incoming/I$id","incoming/G$id")) {
if ($fudged{$id}) {
die "$id already fudged once! $!\n";
$fudged{$id}= 1;
next;
}
+ my $c;
if ($id =~ m/^[RC]/) {
- print(STDOUT "[$nf] $id service ...") || die $!;
+ print(STDOUT "[$nf] $id service ...") || die $!;
defined($c=fork) || die $!;
if (!$c) { exec("$lib_path/service",$id); die "unable to execute $lib_path/service: $!"; }
} elsif ($id =~ m/^[BMQFDUL]/) {
} else {
die "bad name $id";
}
- $cc=waitpid($c,0); $cc == $c || die "$cc $c $!";
- $status=$?;
+ my $cc=waitpid($c,0); $cc == $c || die "$cc $c $!";
+ my $status=$?;
if ($status) {
print(STDERR "$id: process failed ($status $!) - now in [PG]$id\n") || die $!;
}
#set umask in order to have group-writable incoming/*
#umask(002);
-use Debbugs::Config qw(:globals);
+use Debbugs::Config qw(:globals :text);
my $lib_path = $gLibPath;
$ENV{'PATH'} = '/usr/lib/debbugs:'.$ENV{'PATH'};
s/\>//;
s/\<//;
}
-require("/etc/debbugs/text");
#remove everything from @ to end of line
s/\@.*$//;
use DebbugsTest qw(:all);
use Data::Dumper;
+# HTTP::Server:::Simple defines a SIG{CHLD} handler that breaks system; undef it here.
+$SIG{CHLD} = sub {};
my %config;
eval {
%config = create_debbugs_configuration(debug => exists $ENV{DEBUG}?$ENV{DEBUG}:0);
ok($SD_SIZE_NOW-$SD_SIZE_PREV >= 1,'control@bugs.something messages appear to have been sent out properly');
$SD_SIZE_PREV=$SD_SIZE_NOW;
# now we need to check to make sure the control message was processed without errors
-ok(system("sh -c 'find ".$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug"')) == 0,
+ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug")) == 0,
'control@bugs.something message was parsed without errors');
# now we need to check to make sure that the control message actually did anything
# This is an eval because $ENV{DEBBUGS_CONFIG_FILE} isn't set at BEGIN{} time
ok($SD_SIZE_NOW-$SD_SIZE_PREV >= 1,'control@bugs.something messages appear to have been sent out properly');
$SD_SIZE_PREV=$SD_SIZE_NOW;
# now we need to check to make sure the control message was processed without errors
- ok(system("sh -c 'find ".$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug with $command"')) == 0,
+ ok(system('sh','-c','find '.$sendmail_dir.q( -type f | xargs grep -q "Subject: Processed: Munging a bug with $command")) == 0,
'control@bugs.something'. "$command message was parsed without errors");
# now we need to check to make sure that the control message actually did anything
my $status = read_bug(bug=>1);
use Debbugs::MIME qw(create_mime_message);
use File::Basename qw(dirname basename);
use IPC::Open3;
+use IO::Handle;
use Params::Validate qw(validate_with :types);
$ENV{LOCAL_PART} = $param{to};
my ($rfd,$wfd);
my $output='';
+ local $SIG{PIPE} = 'IGNORE';
+ local $SIG{CHLD} = sub {};
my $pid = open3($wfd,$rfd,$rfd,'scripts/receive.in')
or die "Unable to start receive.in: $!";
print {$wfd} create_mime_message($param{headers},
$param{body}) or die "Unable to to print to receive.in";
close($wfd) or die "Unable to close receive.in";
- waitpid($pid,0);
- my $err = $?>>8;
+ my $err = $? >> 8;
+ my $childpid = waitpid($pid,0);
+ if ($childpid != -1) {
+ $err = $? >> 8;
+ print STDERR "receive.in pid: $pid doesn't match childpid: $childpid\n" if $childpid != $pid;
+ }
if ($err != 0 ) {
my $rfh = IO::Handle->new_from_fd($rfd,'r') or die "Unable to create filehandle: $!";
$rfh->blocking(0);
if (not defined $rv) {
print STDERR "Reading from STDOUT/STDERR would have blocked.";
}
- print STDERR $output;
+ print STDERR $output,qq(\n);
die "receive.in failed with exit status $err";
}
# now we should run processall to see if the message gets processed