Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!CS.BROWN.EDU!cs126045 From: cs126045@CS.BROWN.EDU Newsgroups: gnu.emacs.bug Subject: File locking on shared filesystems Message-ID: <8905070035.AA13356@transit.cs.brown.edu> Date: 7 May 89 00:35:50 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 24 Problem: In the file locking code for GNU Emacs version 18.54, the current_lock_owner routine in filelock.c checks to see if a lock is obsolete by making a 'kill' system call with the process id found in the lock to see if the process which created the lock is still active. If the lock was put there by someone on another machine, the process which locked the file will not be found whether it is still around or not, and emacs will steal the lock without warning. Easy solution: unconditionally return(owner) in current_lock_owner before looking to see if the process is still around. If the lock actually is obsolete the user always has the option of stealing it. Better solution: allow users to set a lisp variable to select how cautious file locking should be. If there's no risk of their files being edited by someone on another machine, the current code is fine. Best solution (?): store the hostname in the file along with the process id, and rsh over to that host to see if the process is still around. This might be unacceptably slow... is there a better way? Nick Thompson cs126045@cs.brown.edu