]> git.donarmstrong.com Git - debbugs.git/commitdiff
* Remove getmaintainers from Debbugs::CGI
authorDon Armstrong <don@volo>
Wed, 7 Mar 2007 04:09:01 +0000 (20:09 -0800)
committerDon Armstrong <don@volo>
Wed, 7 Mar 2007 04:09:01 +0000 (20:09 -0800)
 * Add post_process_all and text_instructions to Debbugs::Config
 * Make receive.in use Debbugs::Config and warnings/strict
 * Output more debbuging information in the tests that are run

Debbugs/CGI.pm
Debbugs/Config.pm
cgi/bugreport.cgi
scripts/processall.in
scripts/receive.in
t/06_mail_handling.t
t/lib/DebbugsTest.pm

index e8321299cc7debab922a980e108df2dbedc0a9f5..0fd19af97670d145bd6895b8782084faeab78346 100644 (file)
@@ -53,7 +53,7 @@ BEGIN{
                                qw(maybelink htmlize_addresslinks htmlize_maintlinks),
                               ],
                     util   => [qw(cgi_parameters quitcgi),
-                               qw(getmaintainers getpseudodesc)
+                               qw(getpseudodesc)
                               ],
                     #status => [qw(getbugstatus)],
                    );
@@ -460,35 +460,6 @@ sub htmlize_maintlinks {
 
 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 {
index 6f869e8efb317b526a456da38f70862ca47d4fa8..e8231f114d3bc57c15bf1ad2d16bb0c9a832f0ac 100644 (file)
@@ -52,6 +52,7 @@ BEGIN {
                                 qw($gSendmail $gLibPath),
                                 qw(%gSeverityDisplay @gTags @gSeverityList @gStrongSeverities),
                                 qw(%gSearchEstraier),
+                                qw(@gPostProcessall),
                                ],
                     text     => [qw($gBadEmailPrefix $gHTMLTail $gHTMLExpireNote),
                                 ],
@@ -377,6 +378,8 @@ set_default(\%config,'package_source',$config{config_dir}.'/indices/sources');
 
 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
@@ -410,6 +413,15 @@ This prefixes the text of all lines in a bad e-mail message ack.
 
 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
index bdca6122a685aee07795ad7bc8a6401fe93f0ef3..01f6934067f45e93a22d99802959a0ecc57c83d6 100755 (executable)
@@ -14,7 +14,7 @@ use Debbugs::Config qw(:globals :text);
 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);
 
index 326bc6652c649d607e9e88437ebb134421101edc..2606b26e26bcf06afaefc44904157a8d7bd4550a 100755 (executable)
@@ -8,27 +8,28 @@
 # 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') {
@@ -42,8 +43,8 @@ for (;;) {
         @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";
@@ -51,8 +52,9 @@ for (;;) {
         $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]/) {
@@ -62,8 +64,8 @@ for (;;) {
     } 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 $!;
     }
index df602bbf036f0bbd0a1d04e470217eb967a068d7..eb101a4029fe5cf681c1c5f2b6fe60ceb8c62c61 100755 (executable)
@@ -5,7 +5,7 @@
 #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'};
@@ -26,7 +26,6 @@ if ( $gMailer eq 'exim' )
        s/\>//;
        s/\<//;
 }
-require("/etc/debbugs/text");
 
 #remove everything from @ to end of line
 s/\@.*$//;
index c254d23d1057934b62499c8a611581fbe2751c50..c5be8477c87af4633bc13308c7531dde2b4aec90 100644 (file)
@@ -23,6 +23,8 @@ use lib qw(t/lib);
 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);
@@ -107,7 +109,7 @@ $SD_SIZE_NOW = dirsize($sendmail_dir);
 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
@@ -175,7 +177,7 @@ EOF
      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);
index f7dbe6d8f9abb55c6fabdd11e647add589f4d358..a2e0537d7336480d31f89edda01c72b9e859e9aa 100644 (file)
@@ -30,6 +30,7 @@ use Cwd qw(getcwd);
 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);
 
@@ -146,13 +147,19 @@ sub send_message{
      $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);
@@ -161,7 +168,7 @@ sub send_message{
          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