Newsgroups: gnu.emacs.bug
Path: utzoo!utgpu!jarvis.csri.toronto.edu!snow.white.toronto.edu!cks
From: cks@white.toronto.edu (Chris Siebenmann)
Subject: Re: File locking on shared filesystems
Message-ID: <89May24.155639edt.30763@snow.white.toronto.edu>
Organization: Ziebmef home away from home
References: <8905070035.AA13356@transit.cs.brown.edu> <8905072040.AA04514@odin.think.com>
Distribution: gnu
Date: Wed, 24 May 89 15:56:32 EDT

In article <8905072040.AA04514@odin.think.com> taylor@THINK.COM writes:
| I feel that in an NFS environment, there should be a separate lock
| directory for each diskfull machine -- and emacs should use the lock
| directory that's on the machine that has the file being edited.  That
| way, if the file is accessible, then so is the lock directory.

 But what happens if the lock directory isn't visible from all
machines that mount that partition? Look at the requirements this
imposes on the lock directory:
	- it must be publically writable
	- it must be in a known spot relative to the file
	- you must be able to access it regardless of how you mount
	  the file
One directory per partition doesn't work -- many people export
subpartitions via NFS (for example, our fileserver doesn't export /var
(the actual partition) but does export /var/diskless, /var/spool/mail
and /var/spool/postoffice).

 If you're going to do locking, it's no good doing halfway measures;
reliable locking is an all or nothing proposition.

| Alternatively, perhaps something based on or similar to the lock daemon.

 Ick. Someone has to write it, and what happens when the machine
running the daemon crashes or is rebooted? The only more-or-less
foolproof way of doing locking I can think of is to tie the locking
information fairly closely to the file (so that if the file is
accessable, so is the locking information, and if you see the file you
see the locking information).

| I'd also like a way to say  ``don't lock files in this tree (say, home
| directory on down), but do lock files in this other tree (source code
| being edited by several people)''.

 I think people relying on GNU Emacs to prevent people simultaneously
editing the same source file are at least highly optimistic -- what
about other editors and tools that don't understand Emacs file locking
conventions? People really needing locking probably want some form of
revision control, for which they can use RCS V4 (ftpable from
arthur.cs.purdue.edu, and it works just fine with GNU Diff 1.4) or
SCCS or another real revision control system. With the right Elisp
glue, it's almost as easy to use as file locking and much more
powerful.

-- 
	"I shall clasp my hands together and bow to the corners of the world."
			Number Ten Ox, "Bridge of Birds"
Chris Siebenmann		...!utgpu!{ncrcan,ontmoh!moore}!ziebmef!cks
cks@white.toronto.edu	     or ...!utgpu!{,csri!}cks
