Re: A script for fixing bare newlines in mailbox files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joseph Brennan wrote:

When moving from U Wash to Cyrus we applied this rewrite to all
mailboxes.  Get rid of any nulls while you're at it.


while(<>) {

   # The \000 character (NUL) is not allowed
   if ($line =~ s/\000//g) {
      print STDERR "WARNING: Removing NUL\n";
   }

   # Change CRLF or bare CR to LF
   $endcr = $midcr = 0;
   $endcr++ if ($line =~ s/\015$//g); # \n already there
   $midcr++ if ($line =~ s/\015/\n/g); # add \n
   if ($endcr || $midcr) {
      print STDERR "WARNING: Correcting CR characters\n";
    }


   print;
}

Did any users report any further corruption of what is arguably already a corrupted message? I'm not familiar with the cause of this problem, but having encountered it before, mainly with messages that have large attachments, I'm wondering if attached files might be unusable after such a scrubbing (assuming they were not encoded properly).

----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux