Show More
@@ -58,7 +58,7 b' def reposetup(ui, repo):' | |||
|
58 | 58 | list_clean, list_unknown) |
|
59 | 59 | if result is not None: |
|
60 | 60 | return result |
|
61 | except socket.error, err: | |
|
61 | except (OSError, socket.error), err: | |
|
62 | 62 | if err[0] == errno.ECONNREFUSED: |
|
63 | 63 | ui.warn(_('(found dead inotify server socket; ' |
|
64 | 64 | 'removing it)\n')) |
@@ -9,7 +9,7 b'' | |||
|
9 | 9 | from mercurial.i18n import gettext as _ |
|
10 | 10 | from mercurial import osutil, ui, util |
|
11 | 11 | import common |
|
12 | import errno, os, select, socket, stat, struct, sys, time | |
|
12 | import errno, os, select, socket, stat, struct, sys, tempfile, time | |
|
13 | 13 | |
|
14 | 14 | try: |
|
15 | 15 | import linux as inotify |
@@ -556,12 +556,30 b' class Server(object):' | |||
|
556 | 556 | self.timeout = timeout |
|
557 | 557 | self.sock = socket.socket(socket.AF_UNIX) |
|
558 | 558 | self.sockpath = self.repo.join('inotify.sock') |
|
559 | self.realsockpath = None | |
|
559 | 560 | try: |
|
560 | 561 | self.sock.bind(self.sockpath) |
|
561 | 562 | except socket.error, err: |
|
562 | 563 | if err[0] == errno.EADDRINUSE: |
|
563 |
raise AlreadyStartedException(_('could not start server: %s') |
|
|
564 | raise AlreadyStartedException(_('could not start server: %s') | |
|
564 | 565 | % err[1]) |
|
566 | if err[0] == "AF_UNIX path too long": | |
|
567 | tempdir = tempfile.mkdtemp(prefix="hg-inotify-") | |
|
568 | self.realsockpath = os.path.join(tempdir, "inotify.sock") | |
|
569 | try: | |
|
570 | self.sock.bind(self.realsockpath) | |
|
571 | os.symlink(self.realsockpath, self.sockpath) | |
|
572 | except (OSError, socket.error), inst: | |
|
573 | try: | |
|
574 | os.unlink(self.realsockpath) | |
|
575 | except: | |
|
576 | pass | |
|
577 | os.rmdir(tempdir) | |
|
578 | if inst.errno == errno.EEXIST: | |
|
579 | raise AlreadyStartedException(_('could not start server: %s') | |
|
580 | % inst.strerror) | |
|
581 | raise | |
|
582 | else: | |
|
565 | 583 | raise |
|
566 | 584 | self.sock.listen(5) |
|
567 | 585 | self.fileno = self.sock.fileno |
@@ -635,6 +653,9 b' class Server(object):' | |||
|
635 | 653 | self.sock.close() |
|
636 | 654 | try: |
|
637 | 655 | os.unlink(self.sockpath) |
|
656 | if self.realsockpath: | |
|
657 | os.unlink(self.realsockpath) | |
|
658 | os.rmdir(os.path.dirname(self.realsockpath)) | |
|
638 | 659 | except OSError, err: |
|
639 | 660 | if err.errno != errno.ENOENT: |
|
640 | 661 | raise |
@@ -9,7 +9,16 b' p="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |||
|
9 | 9 | hg init $p |
|
10 | 10 | cd $p |
|
11 | 11 | |
|
12 | echo % fail | |
|
13 | ln -sf doesnotexist .hg/inotify.sock | |
|
14 | hg st | |
|
15 | hg inserve | |
|
16 | rm .hg/inotify.sock | |
|
17 | ||
|
12 | 18 | echo % inserve |
|
13 | hg inserve | |
|
19 | hg inserve -d --pid-file=hg.pid | |
|
20 | cat hg.pid >> "$DAEMON_PIDS" | |
|
14 | 21 | echo % status |
|
15 | 22 | hg status |
|
23 | ||
|
24 | kill `cat hg.pid` |
@@ -1,5 +1,9 b'' | |||
|
1 | % fail | |
|
2 | failed to contact inotify server: AF_UNIX path too long | |
|
3 | deactivating inotify | |
|
4 | abort: could not start server: File exists | |
|
1 | 5 | % inserve |
|
2 | abort: AF_UNIX path too long | |
|
3 | 6 | % status |
|
4 | 7 | failed to contact inotify server: AF_UNIX path too long |
|
5 | 8 | deactivating inotify |
|
9 | ? hg.pid |
General Comments 0
You need to be logged in to leave comments.
Login now