From bb6f34eb868c93436579ae501ce024a6a900a39b Mon Sep 17 00:00:00 2001 From: Benoit Boissinot Date: Sun, 7 Sep 2008 15:10:11 +0200 Subject: [PATCH 1/3] inotify: add client code for long pathname handling --- hgext/inotify/client.py | 9 ++++++++- tests/test-inotify-issue1208.out | 4 +--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hgext/inotify/client.py b/hgext/inotify/client.py index fc3f0e0ce5..e86395bf83 100644 --- a/hgext/inotify/client.py +++ b/hgext/inotify/client.py @@ -14,7 +14,14 @@ import os, select, socket, stat, struct, sys def query(ui, repo, names, match, list_ignored, list_clean, list_unknown=True): sock = socket.socket(socket.AF_UNIX) sockpath = repo.join('inotify.sock') - sock.connect(sockpath) + try: + sock.connect(sockpath) + except socket.error, err: + if err[0] == "AF_UNIX path too long": + sockpath = os.readlink(sockpath) + sock.connect(sockpath) + else: + raise def genquery(): for n in names or []: diff --git a/tests/test-inotify-issue1208.out b/tests/test-inotify-issue1208.out index e05c655f07..2fb7288cb5 100644 --- a/tests/test-inotify-issue1208.out +++ b/tests/test-inotify-issue1208.out @@ -1,9 +1,7 @@ % fail -failed to contact inotify server: AF_UNIX path too long +failed to contact inotify server: No such file or directory deactivating inotify abort: could not start server: File exists % inserve % status -failed to contact inotify server: AF_UNIX path too long -deactivating inotify ? hg.pid From fdb31340ceb94340a02682b1e5936aa72a3b16dc Mon Sep 17 00:00:00 2001 From: Benoit Boissinot Date: Wed, 10 Sep 2008 13:52:33 +0200 Subject: [PATCH 2/3] run-tests.py: fix the check for the hg installation with -jn (n > 1) --- tests/run-tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/run-tests.py b/tests/run-tests.py index 3c462964d9..6a0d53ed37 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -471,6 +471,8 @@ hgpkg = None def run_children(tests): if not options.with_hg: install_hg() + if hgpkg != expecthg: + print '# Testing unexpected mercurial: %s' % hgpkg optcopy = dict(options.__dict__) optcopy['jobs'] = 1 @@ -540,8 +542,8 @@ def run_tests(tests): if not options.with_hg: install_hg() - if hgpkg != expecthg: - print '# Testing unexpected mercurial: %s' % hgpkg + if hgpkg != expecthg: + print '# Testing unexpected mercurial: %s' % hgpkg if options.timeout > 0: try: From 0833f4e74bd29d000f8ec86a16f0df8461b66c25 Mon Sep 17 00:00:00 2001 From: Benoit Boissinot Date: Wed, 10 Sep 2008 22:37:07 +0200 Subject: [PATCH 3/3] osutil: proper error checking and reporting --- mercurial/osutil.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mercurial/osutil.c b/mercurial/osutil.c index 01b5225f54..91aa212afe 100644 --- a/mercurial/osutil.c +++ b/mercurial/osutil.c @@ -255,7 +255,8 @@ static PyObject *listdir(PyObject *self, PyObject *args, PyObject *kwargs) #ifdef AT_SYMLINK_NOFOLLOW dfd = open(path, O_RDONLY); - dir = fdopendir(dfd); + if (dfd != -1) + dir = fdopendir(dfd); #else dir = opendir(path); dfd = -1;