# HG changeset patch # User Bryan O'Sullivan # Date 1355880812 28800 # Node ID cd53e40ab0e2ab9eff4f67508bc47b2a09d5c311 # Parent 8cbe0fed0c1fee0689f3ed2b8413033c9efb0353 inotify: don't fall over just because of a dangling symlink Previously, the inotify server failed to start if .hg/inotify.sock was a symlink that pointed to a non-existent path. This behaviour does not seem to make any sense. Now, if we encounter a broken symlink, we unlink it and continue. diff -r 8cbe0fed0c1f -r cd53e40ab0e2 hgext/inotify/server.py --- a/hgext/inotify/server.py Wed Dec 19 10:40:34 2012 -0800 +++ b/hgext/inotify/server.py Tue Dec 18 17:33:32 2012 -0800 @@ -338,8 +338,7 @@ if os.path.exists(self.sockpath): self.realsockpath = os.readlink(self.sockpath) else: - raise util.Abort('inotify-server: cannot start: ' - '.hg/inotify.sock is a broken symlink') + os.unlink(self.sockpath) try: self.sock.bind(self.realsockpath) except socket.error, err: diff -r 8cbe0fed0c1f -r cd53e40ab0e2 tests/test-inotify-issue1208.t --- a/tests/test-inotify-issue1208.t Wed Dec 19 10:40:34 2012 -0800 +++ b/tests/test-inotify-issue1208.t Tue Dec 18 17:33:32 2012 -0800 @@ -6,16 +6,11 @@ $ hg init $p $ cd $p -fail +dangling symlink should be deleted $ ln -sf doesnotexist .hg/inotify.sock - $ hg st - abort: inotify-server: cannot start: .hg/inotify.sock is a broken symlink - inotify-client: could not start inotify server: child process failed to start - $ hg inserve - abort: inotify-server: cannot start: .hg/inotify.sock is a broken symlink - [255] - $ rm .hg/inotify.sock + $ hg --config inotify.pidfile=../hg.pid st + $ kill `cat ../hg.pid` inserve