[request-tracker-maintainers] Bug#674865: request-tracker3.8: Cannot send mail after DSA-2480

paul.szabo at sydney.edu.au paul.szabo at sydney.edu.au
Mon May 28 21:10:54 UTC 2012


Dear Dominic,

> This should be addressed shortly in an erratum DSA; see
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=674522

Sorry I did not notice that bug before I submitted mine, I guess the
title did not seem relevant...

I now slightly updated my patch (simpler cmd, neater error message),
as below. I would like to argue that my patch is "better": simpler,
and keeps STDOUT and STDERR.

Cheers, Paul

Paul Szabo   psz at maths.usyd.edu.au   http://www.maths.usyd.edu.au/u/psz/
School of Mathematics and Statistics   University of Sydney    Australia


# diff -u /usr/share/request-tracker3.8/lib/RT/Interface/Email.pm.bak /usr/share/request-tracker3.8/lib/RT/Interface/Email.pm
--- /usr/share/request-tracker3.8/lib/RT/Interface/Email.pm.bak 2012-05-19 22:37:07.000000000 +1000
+++ /usr/share/request-tracker3.8/lib/RT/Interface/Email.pm     2012-05-29 06:40:37.000000000 +1000
@@ -443,28 +443,40 @@
         }
 
         eval {
-            # don't ignore CHLD signal to get proper exit code
-            local $SIG{'CHLD'} = 'DEFAULT';
-
-            # if something wrong with $mail->print we will get PIPE signal, handle it
-            local $SIG{'PIPE'} = sub { die "program unexpectedly closed pipe" };
-
-            require IPC::Open2;
-            my ($mail, $stdout);
-            my $pid = IPC::Open2::open2( $stdout, $mail, $path, @args )
-                or die "couldn't execute program: $!";
-
-            $args{'Entity'}->print($mail);
-            close $mail or die "close pipe failed: $!";
-
-            waitpid($pid, 0);
-            if ($?) {
-                # sendmail exit statuses mostly errors with data not software
-                # TODO: status parsing: core dump, exit on signal or EX_*
-                my $msg = "$msgid: `$path @args` exited with code ". ($?>>8);
-                $msg = ", interrupted by signal ". ($?&127) if $?&127;
-                $RT::Logger->error( $msg );
-            }
+            ## don't ignore CHLD signal to get proper exit code
+            #local $SIG{'CHLD'} = 'DEFAULT';
+            #
+            ## if something wrong with $mail->print we will get PIPE signal, handle it
+            #local $SIG{'PIPE'} = sub { die "program unexpectedly closed pipe" };
+            #
+            #require IPC::Open2;
+            #my ($mail, $stdout);
+            #my $pid = IPC::Open2::open2( $stdout, $mail, $path, @args )
+            #    or die "couldn't execute program: $!";
+            #
+            #$args{'Entity'}->print($mail);
+            #close $mail or die "close pipe failed: $!";
+            #
+            #waitpid($pid, 0);
+            #if ($?) {
+            #    # sendmail exit statuses mostly errors with data not software
+            #    # TODO: status parsing: core dump, exit on signal or EX_*
+            #    my $msg = "$msgid: `$path @args` exited with code ". ($?>>8);
+            #    $msg = ", interrupted by signal ". ($?&127) if $?&127;
+            #    $RT::Logger->error( $msg );
+            #}
+            #####
+            #use File::Temp;    # Done above
+            my $tmp_fh = File::Temp->new() or die "Cannot create temp file for sendmail data\n";
+            my $tmp_fn = $tmp_fh->filename or die "Nameless temp file for sendmail data\n";
+            $args{'Entity'}->print($tmp_fh) or die "Cannot write temp file for sendmail data\n";
+            close ($tmp_fh) or die "Cannot close temp file for sendmail data\n";
+            my $cmd = "$path @args < $tmp_fn 2>&1";
+            #$RT::Logger->info( "PSz using command: $cmd" );
+            my $msg = `$cmd`;
+            $? and $msg .= "sendmail status: $? (exit code " . ($?>>8) . ", signal " . ($?&127) .")";
+            $msg and die "sendmail output: $msg\n";
+            unlink ($tmp_fn) or die "Cannot delete temp file for sendmail data\n";
         };
         if ( $@ ) {
             $RT::Logger->crit( "$msgid: Could not send mail with command `$path @args`: " . $@ );





More information about the pkg-request-tracker-maintainers mailing list