Locking bug on Mac OS X over AFP

Matt Mackall mpm at selenic.com
Sun Mar 9 17:22:44 CDT 2008

On Sun, 2008-03-09 at 15:05 -0700, Jens Alfke wrote:
> On 9 Mar '08, at 9:45 AM, Matt Mackall wrote:
> > What's in .hg/store/lock? We don't actually use any operating system
> > locking here, it's simply a file (usually a symlink). Does AFP support
> > symlinks?
> Yes, it does. (It's not uncommon in enterprise/edu. Mac deployments to  
> have user home directories on AFP servers, so it supports all the  
> standard Unix semantics.) There are some subtle issues with file  
> locking, but then, _every_ network filesystem has subtle issues with  
> file locking :-P

And we don't use file locking. That is, we don't use any operating
system APIs such as flock/lockf, etc. that enforce exclusive access.
Instead, we simply rely on atomic file creation[1]. Using a symlink lets
us simultaneously create a file and store our lock information.

So the error messages seen here:

> 8) hg clone /Volumes/ewing/LOCKBUG LOCKBUG2
> abort: Resource busy: /Volumes/ewing/LOCKBUG/.hg/store/lock

..is quite mysterious.

[1] If your network filesystem lets two users simultaneously create the
same file, you've got Bigger Problems.

Mathematics is the supreme nostalgia of our time.

More information about the Mercurial mailing list