Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!wasatch!helios.ee.lbl.gov!ncis.tis.llnl.gov!lll-winken!uunet!wugate!wupost!kuhub.cc.ukans.edu!anu-news!list From: munnari!csc.anu.oz.au!gih900@UUNET.UU.NET (Geoff Huston) Newsgroups: news.software.anu-news Subject: Re: Reading news in a thunderstorm is hazardous. Message-ID: <8908011544.AA20257@uunet.uu.net> Date: 1 Aug 89 15:20:25 GMT Sender: ANU-NEWS Discussion Reply-To: Geoff Huston Lines: 47 Re -- Reading news in a thunderstorm is hazardous. >> In article <430@decus.com.au>, sutton@decus.com.au (Colin Sutton) writes: >>> I am always on teneterhooks reading news from home via dial-up modem, >>> because if the line goes down, all the items I read are now unread again >>> ... Couldn't the NEWSRC file be updated as the news is read? ... I assume >>> that the file would be kept open, so it wouldn't take long to update. And >>> news would be quicker to exit too - just close the file. > >Actually, the problem seems to be one of insufficient paranoia, and the >approach you suggest is unfortunately exactly the one which would most >exacerbate the problem, if it weren't already implemented. It seems >that the file is already being kept open - and when something unexpected >happens the file suffers the consequences. On our DEC-2060, using NEWS >(5.2(1213)) and NNTP to get netnews from a Pyramid, if the Pyramid goes >away unexpectedly, so _may_ your NEWSRC file. It happens fairly often. >Therefore, I recommend to our users that they keep a backup copy, which >is not exactly easy given the filename (^V^?^V[NEWS^V].NEWSRC). > >You _really_ want to open the file for read, slurp it up, and close it >immediately. This is exaclty what NEWS already does - NEWS opens the NEWSRC file and reads it in - then closes it. > Then, when the file is safe, you may parse the text in the >buffer at leisure. Engage the user in their chosen dialogue and maintain >the state in the buffer. When the time comes, open the file for write, >write it all, and close it immediately. Open files are very vulnerable; >closed files are much more likely to survive any odd occurrence. >If you want a command to update the NEWSRC file at the user's whim, then >that should be reasonably easy to add, and its cost would be obvious to >the user when they use it, so they could make a rational decision about >how often to force an update. It is almost always best to do as little as >possible without specific direction to do so, if for no other reason than >to obey The Law of Least Surprise. DIR/RESET does exactly this - it's a case of the wrong command name here! NEWSRC was set up as a text file - not an indexed file - this is both good and bad - the file contents may be changed using a text editor - BUT updates on the fly are a complete dump of the NEWS variables into the file as text. It's all a case of swings and roundabouts. Geoff Huston gih900@csc.anu.oz.au