GNOME Bugzilla – Bug 528409
Add IPv6 and IDN support to open files dialog
Last modified: 2011-11-11 10:03:55 UTC
This patch adds IPv6 and IDN support to the open files dialog. It replaces the call to the deprecated gethostbyname() with new functions that have proper IPv6 and IDN support. I must admit that there are three potential concerns with this patch: 1. It doesn't #ifdef out the code that depends on GLIBTOP_FILE_TYPE_INET6SOCKET. Therefore, it will not compile without a libgtop that defines that. If that requirement is acceptable, the minimum libgtop version listed in Configure.in and any package spec files will have to be updated. 2. IDN support isn't tested since I haven't yet found an IP that reverse-resolves to one. I'll try to add one to my own nameserver later today. 3. The open files dialog hangs on a socket with an IPv6 address that has no PTR record, and where the call to getnameinfo() takes a while. I have determined that the appropriate failsafe in friendlier_hostname() is being taken, and that it doesn't hang when the getnameinfo() call fails quickly on other addresses, so I think there must be a preexisting race condition or timeout with no fallback somewhere in the GUI. Please let me know if you have any problems or concerns with this patch.
Created attachment 109367 [details] [review] IPv6 / IDN patch
1) since everything is for 2.23, that's no problem to bump the dependency 2) ok 3) the hangup is another problem. anyway, why not use NI_NUMERICHOST instead of the fallback ? wouldn't it be nicer to also resolve the port numbers ? then shouldn't the hints type be set to SOCK_STREAM ? 4) res is leaked when the lookup succeeds I'm sorry, i can't really test/help anything for the moment, i've just moved in, i' still don't have internet @home and can only webbrowse @work. Very nice patch. (This is actually about the "Open files" dialog. I'm not sure it may be desirable to list sockets in the real "lsof" dialog.)
Created attachment 109418 [details] [review] IPv6 / IDN patch (v5) Here's a new patch that adds service name resolution, fixes all known issues, and removes some unnecessary code. The hang was apparently not due to my patch; pulling the network cable out before opening the dialog causes the same thing without the patch (there mustn't be a caching-nameserver running on the local system of course). I also tested IDN support and it works great!
Do you know any POSIX or GNOME API to do the DNS lookup asynchronously ?
I don't, but you could run the lookup in a separate thread, and set the "busy" mouse pointer while the thread is running. That would at least make it obvious that the app isn't dead. The same thing would improve the user experience in the main "lsof" dialog too (searches can take almost 10s for me, during which time the main System Monitor window doesn't refresh). What's strange is that even after getnameinfo times out and returns the numeric IP, the dialog still doesn't appear. Maybe this happens because the timer retriggers before the lookup can complete? The fix might be to use a one-shot timer that gets rearmed at the bottom of openfiles_timer(). I'd be glad work on fixing this if you don't have the time to right now.
I'm looking for guidelines / design pattern to asynchronously update a gtk treeview so we don't create our own stuff. Or maybe use libsoup if it is IPv6 ready.
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report. Done. libsoup doesn't do reverse lookup ... i'll see later for the async lookup.