GNOME Bugzilla – Bug 794801
/network-monitor/add_networks fails if there is a proxy and glib-networking is installed
Last modified: 2018-04-10 09:38:06 UTC
We just noticed in Ubuntu that glib's testsuite started failing- GLib-GIO:ERROR:../../../../../gio/tests/network-monitor.c:171:reach_cb: assertion failed (error == NULL): Host unreachable (g-io-error-quark, 37) Bail out! GLib-GIO:ERROR:../../../../../gio/tests/network-monitor.c:171:reach_cb: assertion failed (error == NULL): Host unreachable (g-io-error-quark, 37) I'll skip all the tedious investigation, but it turns out that our test environment got glib-networking installed, probably via a dependency on some other package. This means that now glib's installed-tests are using its GIO modules, in particular the libproxy based proxy resolver instead of the dummy one. We don't have all of the addresses that the network-monitor tests are testing in $no_proxy, and so libproxy is correctly telling us to go through the proxy for some of them. Unfortunately in test_add_network we removed all networks from the GNetworkMonitorBase, so as far as it is concerned the proxy cannot be reached. Couple of solutions, I think. - (preferable, patch coming up) The network-monitor tests aren't trying to test the proxy, so unset *_proxy before running them. - Find out what the proxy is - possibly by just calling g_proxy_resolver_lookup() and resolving it to a name - and re-adding that to the GNetworkMonitorBase. We're just checking reachability here, so that is probably enough.
If there's a way to always use the dummy resolver we could use that too, but I'm not aware that there is.
Created attachment 370287 [details] [review] tests/network-monitor: Ignore the system's proxy settings If glib-networking is installed and built with libproxy support, this test will use it. If a proxy is set in the environment, we might get correctly told to go through it for certain acesses. However, this isn't going to work, because the testsuite monkeys with the network monitor to tell it that all addresses - including the proxy - aren't reachable. We're trying to check if adding networks to a GNetworkMonitor works in general. Proxies just get in the way here, so let's unset the environment variables and pretend the system doesn't have one.
Review of attachment 370287 [details] [review]: Not a maintainer, but this makes sense to me.
(In reply to Iain Lane from comment #1) > If there's a way to always use the dummy resolver we could use that too, but > I'm not aware that there is. There seems to be an undocumented $GIO_USE_NETWORK_MONITOR and $GIO_USE_PROXY_RESOLVER, would those help? (Presumably they should be mentioned in docs/reference/gio/overview.xml but aren't yet?)
(In reply to Simon McVittie from comment #4) > There seems to be an undocumented $GIO_USE_NETWORK_MONITOR and > $GIO_USE_PROXY_RESOLVER, would those help? (Presumably they should be > mentioned in docs/reference/gio/overview.xml but aren't yet?) Yes, g_setenv ("GIO_USE_PROXY_RESOLVER", "dummy", TRUE) should do the trick
Created attachment 370710 [details] [review] tests/network-monitor: Always use the dummy proxy resolver Yeah, that works, thanks!
Review of attachment 370710 [details] [review]: Nitpick: s/acesses/accesses/ in the commit message I’ll fix that when I push. Thanks for the patch!
Pushed to master and glib-2-56. Attachment 370710 [details] pushed as ec20cb4 - tests/network-monitor: Always use the dummy proxy resolver