On Tue, 2007-01-02 at 14:17 -0500, Joe Smith wrote:
Mikkel L. Ellertson wrote:
> .... But as you have
> noticed, it does not work out as well when editing shared files.
Oddly perhaps, Unix has never really provided shared writeable files.
What? If you have write permission you can write.
Perhaps there are good theoretical reasons for it; perhaps it was
one of those simplifying assumptions that Unix was born with, I don't know.
Initially there was no file locking and the only really atomic
operation was creating a file or making a hard link to an existing
file. Later, about a dozen different file locking methods were
added and the applications never really converged on how to do
it across versions and network mounts. Plus, a lot of stuff depends
on the unix filesystem semantics where you can create a new file
under a temporary name, rename it, which atomically replaces the
old name, and processes that opened before the rename continue to
see the old file contents while subsequent opens get the new contents.
People seem to want to do things like this--they keep asking for
applications to mediate between users editing the same file, like
Windows does it, but I wonder if it's such a great idea.
You can do this if you only run one OS version and don't use
networks to access the file - but a dedicated server process to
provide the arbitration is usually better anyway.