From: Rob Browning Date: Mon, 16 Sep 2013 17:56:27 +0000 (-0500) Subject: Always fall back to socket()/bind() when os.mknod(...S_IFSOCK) fails. X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=168a333164c4107280cb0f2184a5dee6b7e64228;p=packages%2Fb%2Fbup.git Always fall back to socket()/bind() when os.mknod(...S_IFSOCK) fails. Previously bup would use socket()/bind() instead of os.mknod(... | stat.S_IFSOCK) on Cygwin, but this issue isn't Cygwin specific. Remove the platform conditionalization, and fall back to socket()/bind() any time mknod() fails with EINVAL. Thanks to Robert Edmonds for reporting the relevant failure on a Debian kFreeBSD buildd. Signed-off-by: Rob Browning --- diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py index 2c6eb88..e30a663 100644 --- a/lib/bup/metadata.py +++ b/lib/bup/metadata.py @@ -312,11 +312,14 @@ class Metadata: assert(self._recognized_file_type()) os.mknod(path, 0600 | stat.S_IFIFO) elif stat.S_ISSOCK(self.mode): - if not sys.platform.startswith('cygwin'): + try: os.mknod(path, 0600 | stat.S_IFSOCK) - else: - s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) - s.bind(path) + except OSError, e: + if e.errno == errno.EINVAL: + s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + s.bind(path) + else: + raise elif stat.S_ISLNK(self.mode): assert(self._recognized_file_type()) if self.symlink_target and create_symlinks: