Solution [UPDATE]: Serious bug on perl 5.8 may cause file/folder corruption

Paulo Matos <[email protected]> Fri, 12 Sep 2003 15:13:13 +0100 (WEST)
Newsgroups gmane.mail.neomail.general
Message-ID <[email protected]>
On Thu, 11 Sep 2003, Paulo Matos wrote:

> A way to do this changes quickly, will be:
> 
> # perl perl -pi'.bak' -e 's#>>#+>>#gs' neomail.pl neomail-prefs.pl
> 
> this will replace any occurances of ">>" with "+>>", and will save a copy 
> of the files with the '.bak' appended to its name.

Back from the beginning, move backuped files to original names and do:

perl -pi'.bak' -e 's#>>#+>>:unix","#gs' neomail.pl neomail-prefs.pl

or

perl -pi'.bak' -e 's#>>#+>>:stdio","#gs' neomail.pl neomail-prefs.pl


On Linux both ':unix' or ':stdio' layer solved the issue, I did NOT tested 
it under win32 systems, please someone do and confirm me that!

This can be done, with this simple code:

--- cut here ---
#!/usr/bin/perl

open(F, "+>>:stdio","somefile"); # somefile is a file with some text in it

$a=tell(F);        # return 0
print "$a\n";

print F "end";     # the str will be appended at tail correctly
$a=tell(F);        # return 3,6,9,12 (1st, 2nd, 3rd time runned)
print "$a\n";

close(F);
--- end here ---

run it several times, you should get this results if everything is ok:
# perl tellbug.pl
0
3
# perl tellbug.pl
0
6
# perl tellbug.pl
0
9

You might ask yourself why does it has 0 value on the start? Just because 
tell only give you the current position after the first operation. Before 
that it has no position at all, right?


IMPORTANT:
-------------------------------------------------------------------------
Dont forget to remove var/users/*/*.db, because there might be stored
incorrect information about folders due to prior operations.
-------------------------------------------------------------------------


Hope now things are ok!

Regards,

-- 
Paulo Matos



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf