[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
For me, this fails on Ubuntu 13.04 both with system Python and upstream's hg trunk, so it's unlikely to be an Ubuntu delta to Python. It does *not* fail for me with hg trunk on Wheezy. I've closed the Python bug as invalid. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/python/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
The problem is that getaddrinfo() returns different error codes on Ubuntu. On Wheezy, getaddrinfo() returns -2 with errno set to 2 (ENOENT). On Raring, getaddrinfo() returns -11 (EAI_SYSTEM) with errno also set to 2 (ENOENT). Python has this bit of code to set the error type based on the return value of getaddrinfo() -- see Modules/socketmodule.c: static PyObject * set_gaierror(int error) { PyObject *v; #ifdef EAI_SYSTEM /* EAI_SYSTEM is not available on Windows XP. */ if (error == EAI_SYSTEM) return set_error(); #endif #ifdef HAVE_GAI_STRERROR v = Py_BuildValue((is), error, gai_strerror(error)); #else v = Py_BuildValue((is), error, getaddrinfo failed); #endif if (v != NULL) { PyErr_SetObject(socket_gaierror, v); Py_DECREF(v); } return NULL; } So now it should be obvious why a different error type is getting raised in Python (i.e. socket.error vs socket.gaierror). This is likely a change in glibc's getaddrinfo() and nothing to do with Python. Wheezy has libc6 2.13-38, Raring has libc6 2.17-0ubuntu4 ** Bug watch added: Sourceware.org Bugzilla #15272 http://sourceware.org/bugzilla/show_bug.cgi?id=15272 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/python/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
Possibly related: http://sourceware.org/bugzilla/show_bug.cgi?id=15272 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/python/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
Reproducible with pure C, so this has nothing to do with Python. ** No longer affects: python ** Package changed: python2.7 (Ubuntu) = eglibc (Ubuntu) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: getaddrinfo() returns -11 (EAI_SYSTEM) instead of -2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
$ gcc -g -o gaitest gaitest.c ./gaitest Wheezy: % ./gaitest status = -2, errno = 2 Raring: % ./gaitest status = -11, errno = 2 ** Attachment added: gaitest.c https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1154599/+attachment/3615897/+files/gaitest.c ** Summary changed: - dns lookup failure raises socket.error not socket.gaierror + getaddrinfo() returns -11 instead of -2 ** Summary changed: - getaddrinfo() returns -11 instead of -2 + getaddrinfo() returns -11 (EAI_SYSTEM) instead of -2 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: getaddrinfo() returns -11 (EAI_SYSTEM) instead of -2 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/eglibc/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
** Bug watch added: Python Roundup #1159051 http://bugs.python.org/issue1159051 ** Also affects: python via http://bugs.python.org/issue1159051 Importance: Unknown Status: Unknown -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/python/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
** Changed in: python Status: Unknown = New -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/python/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
** Changed in: python2.7 (Ubuntu) Importance: Undecided = Medium -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
Works for me. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
simplified a little bit: #!/usr/bin/python import sys, socket names = [slashdot.org., foowhi.com.] if len(sys.argv) 1: names = sys.argv[1:] for iname in names: try: sys.stdout.write(== %s ==\n % iname) result = socket.getaddrinfo(iname, None) for (fam, stype, proto, cname, sockaddr) in result: sys.stdout.write( sockaddr=%s\n % str(sockaddr)) except socket.gaierror as error: sys.stderr.write(%s failed lookup\n % iname) It must be local networking related, because it works for me elsewhere also. But here: == slashdot.org. == sockaddr=('216.34.181.45', 0) sockaddr=('216.34.181.45', 0) sockaddr=('216.34.181.45', 0) == foowhi.com. == Traceback (most recent call last): File /tmp/lookup.py, line 9, in module result = socket.getaddrinfo(iname, None) socket.error: [Errno 2] No such file or directory I'm not really sure what it is that differs between the 2 systems that are failing. I even tried installing dnsmasq oas my failing system was a desktop system. -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
[Bug 1154599] Re: dns lookup failure raises socket.error not socket.gaierror
** Branch linked: lp:cloud-init -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1154599 Title: dns lookup failure raises socket.error not socket.gaierror To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/python2.7/+bug/1154599/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs