Problem with MailScanner, postfix and corrupt mails

Julian Field MailScanner at
Tue Mar 15 17:32:46 GMT 2005

    [ The following text is in the "ISO-8859-1" character set. ]
    [ Your display is set for the "US-ASCII" character set.  ]
    [ Some characters may be displayed incorrectly. ]

Robert Waldner wrote:

 On Tue, 15 Mar 2005 14:17:18 +0100, =?iso-8859-1?Q?D=F6rfler_Andreas?= writes:

 u sure it isnt a postfix problem ?

 It "smells" like a race condition of some kind, or a Perl bug. I only
 see this on machines that
 - are i386
 - actually notice the mails in their load
 - run MailScanner
 - run postfix

On machines that only meet three of the above criteria, this ain't a

There is only 1 statement in the code that print the "PreDataString"
which is where this text is put. After writing it (once) it forks off a
pipe to print the message body, then prints the "PostDataString". To get
2 copies of the PreDataString, something somewhere must duplicate it in
the buffers.

As 1 last attempt, try adding this:
---     2005-03-12 20:15:18.000000000 +0000
+++      2005-03-15 17:30:47.980045912 +0000
@@ -261,6 +261,7 @@
     if (not defined $pipe or not defined ($pid = fork)) {
       MailScanner::Log::WarnLog("Pipe creation failed in WriteHeader,
%s", $!);
     } elsif ($pid) { # Parent
+      $Tf->flush(); # JKF 20050317
       # Read the pipe a line at a time and write an N record for each
       while(<$pipe>) {
@@ -276,6 +277,7 @@
       $Tf->flush(); # JKF 20050307
       waitpid $pid, 0;
     } else { # Child
+      $Tf->flush(); # JKF 20050317
         or MailScanner::Log::WarnLog("WriteMIMEBody to %s possibly
failed, %s",

So there are just those 2 "+"-marked lines to add.
If this doesn't fix it, then it really is beyond my control. I'm forcing
it to flush the buffers absolutely everywhere, none of this should be

Julian Field
Buy the MailScanner book at
Professional Support Services at
MailScanner thanks transtec Computers for their support

PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654
------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at with the words:
'leave mailscanner' in the body of the email.
Before posting, read the MAQ (
and the archives (

Support MailScanner development - buy the book off the website!

More information about the MailScanner mailing list