LOGAPPEND, LOGFILE, LOGTEXT

Fairlight fairlite at fairlite.com
Mon Jul 23 11:31:24 PDT 2007


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.

mark->
-- 
The latest synth mixdown...
http://media.fairlite.com/Isolation_Voiceless_Cry_Mix.mp3


More information about the Filepro-list mailing list