Re: Bug under Win32
Martin Raspe <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <[email protected]> |
Hello,
here is something I found after a lot of testing and debugging. The
problem lies in the Win32 line endings. I think they are treated
inhomogeneously in the Mail::Box module, and that leads to problems. I
was mistaken in stating that Mozilla uses Unix line endings on Windows.
Here is a first patch for /Mail/Box/File.pm
392,393c392
< my $size = $old->read($whole, $need);
<
---
> my $size = $old->sysread($whole, $need);
396,399c395,396
< unless $size == $need;
<
< $new->print($whole);
< $new->print("\n");
---
> unless ($size == $need) or ($^O eq 'MSWin32');
> $new->print($whole) or die "Couldn't write to folder: $!";
Folders get corrupted if there is too little disk space.
When *not* in binmode, "read" reads too many characters, while "sysread"
is OK. $size is always too big because it counts newlines twice. The
additional newline (line 399) creates errors on Windows (is it needed on
Unix?)
Some of the tests now run OK (40mbox/10read.t), others are still off by
1 (40mbox/30delay.t)
Martin