Re: Solution: Serious bug on perl 5.8 may cause file/folder corruption

"Tod D. Ihde" <[email protected]> Wed, 10 Sep 2003 23:32:56 -0500
Newsgroups gmane.mail.neomail.general
Message-ID <[email protected]>
My god, it's full of stars!

Sorry - what I meant to say was this:

 This has got to be the absolute BEST error report I have ever seen. 
Bravo! This is going in my UFAQ, if you don't mind. I'll put up a 
patchfile, too. Wow.

 Thanks!

 Tod.


Paulo Matos wrote:

>Hello again!
>
>* This post is intended to answer to questions and misbeahvior reports 
>such as stated in messages like:
>
>+ Dianna Brown's post ("Corrupt folder", 2003-07-02)
>http://sourceforge.net/mailarchive/forum.php?thread_id=2704006&forum_id=7155
>
>+ When I try to read a message after a period of time, another message 
>is shown instead of the one I clicked?
>
>+ Scott Raun's post ("Problem using Pine folder mode", 2003-09-06)
>http://sourceforge.net/mailarchive/forum.php?thread_id=3087517&forum_id=7155
>
>+ Pine does not recognize anymore a folder I moved some messages, now I 
>have a huge message with all inside?
>
>
>* And Why is this happening?
>
>This misterious folder corruptions are caused because there is a bug in 
>tell() in perl 5.8 which would return wrong offset if it is called after 
>open(F, ">>file");
>
>This is a serious bug which may corrupt the folder file in some cases when 
>using perl 5.8 (eg: RedHat 8.0 ships it by default)
>
>
>* The Solution:
>
>There is only a quick fix, but it implies changing the code. I would not 
>call it solution but a safer way of programming... 
>
>Using
>	open(F, "+>>file");	# same behavior as "a+" on "C"'s fopen() 
>instead of 
>	open(F, ">>file");
>seems to address the issue.
>
>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.
>
>
>Watch the complete perl bug report here:
>	
>http://rt.perl.org/rt2//Ticket/Display.html?id=18711
>
>
>Regards,
>
>  
>



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