LOGAPPEND, LOGFILE, LOGTEXT

Jay R. Ashworth jra at baylink.com
Mon Jul 23 12:21:24 PDT 2007


On Mon, Jul 23, 2007 at 02:31:24PM -0400, Fairlight wrote:
> This public service announcement was brought to you by Don Coleman:
> > When using the above commands, since I am appending to the file, what
> > happens to the entries that are being logged while I have the file open with
> > a text editor viewing its contents?  Are they stored and written to the file
> > when I close it?  That appears to be what I am seeing.
> 
> On *nix, any process can view the file if nothing has the file (or segments
> of it) locked.  If they're all editors or at least capable of writing, you
> have a race condition in which the last program that writes changes is the
> program whose copy you end up with.  
> 
> It's not so much that changes are written when you close it--they're
> written while you're viewing it, you just don't see it.  If you make edits
> and resave after something has been logged, you'll lose what was appended
> while you were in the editor that didn't do that appending.
> 
> Race conditions of this sort are the entire reasons programs like vipw
> exist for editing the password file.

If all you're doing is viewing it, Don, use less +F.

And if you do have it open in vi, and extra stuff gets written, not
only won't you see it, but if you write out of vi, you'll stomp it, as
Mark points out.

Cheers,
-- jra
-- 
Jay R. Ashworth                   Baylink                      jra at baylink.com
Designer                     The Things I Think                       RFC 2100
Ashworth & Associates     http://baylink.pitas.com                     '87 e24
St Petersburg FL USA      http://photo.imageinc.us             +1 727 647 1274


More information about the Filepro-list mailing list