Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 690758 - dev-libs/glib-2.60.6 with FEATURES=network-sandbox fails test glib:gio / gsocketclient-slow
Summary: dev-libs/glib-2.60.6 with FEATURES=network-sandbox fails test glib:gio / gsoc...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, TESTFAILURE
Depends on:
Blocks: 691278
  Show dependency tree
 
Reported: 2019-07-26 11:21 UTC by tka
Modified: 2019-11-02 00:33 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
meson-logs/testlog.txt.xz (testlog.txt.xz,48.75 KB, application/x-xz)
2019-07-26 11:21 UTC, tka
Details
build.log.xz (build.log.xz,33.23 KB, application/x-xz)
2019-07-26 11:23 UTC, tka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tka 2019-07-26 11:21:51 UTC
Created attachment 584680 [details]
meson-logs/testlog.txt.xz

Ok:                  254
Expected Fail:         0
Fail:                  1
Unexpected Pass:       0
Skipped:               0
Timeout:               0

Full log written to /var/tmp/portage/dev-libs/glib-2.60.6/work/glib-2.60.6-abi_x86_64.amd64/meson-logs/testlog.txt

When building with FEATURES=-network-sandbox, all tests pass.
Comment 1 tka 2019-07-26 11:23:07 UTC
Created attachment 584682 [details]
build.log.xz

# emerge -pqv '=dev-libs/glib-2.60.6::gentoo'
[ebuild   R   ] dev-libs/glib-2.60.6  USE="dbus mime test utils xattr -debug (-fam) -gtk-doc (-selinux) -static-libs -systemtap" 


# emerge --info '=dev-libs/glib-2.60.6::gentoo'
Portage 2.3.69 (python 3.6.9-final-0, default/linux/amd64/17.1/no-multilib/hardened, gcc-9.1.0, glibc-2.29-r3, 5.2.3 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.2.3-x86_64-Intel-R-_Core-TM-_i7-3720QM_CPU_@_2.60GHz-with-gentoo-2.6
KiB Mem:    16383144 total,  10839816 free
KiB Swap:   17825788 total,  17825788 free
Timestamp of repository gentoo: Fri, 26 Jul 2019 10:30:01 +0000
Head commit of repository gentoo: c3fd3f85d04568a74d1c02a4e89afefc3a5130b2
sh bash 5.0_p7
ld GNU ld (Gentoo 2.32 p2) 2.32.0
app-shells/bash:          5.0_p7::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.0::gentoo
dev-lang/python:          2.7.16::gentoo, 3.6.9::gentoo
dev-util/cmake:           3.14.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.41.2::gentoo
sys-apps/sandbox:         2.18::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.16.1-r1::gentoo
sys-devel/binutils:       2.32-r1::gentoo
sys-devel/gcc:            8.3.0-r1::gentoo, 9.1.0-r1::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.29-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

local
    location: /var/lib/portage-local/local
    masters: gentoo
    priority: 0

testing
    location: /var/lib/portage-local/testing
    masters: gentoo
    priority: 1

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -mtune=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -mtune=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs cgroup collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
LINGUAS=""
MAKEOPTS="-j8"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 acl acpi alsa amd64 avx bzip2 cairo caps cdda cddb cdparanoia crypt cups cxx dbus dri dts dvd fam ffmpeg fftw flac fontconfig gif gimp gmp gnutls gtk hardened iconv icu idn ipv6 jpeg lame lcms libnotify libtirpc lzma mad matroska mmap mmx mmxext mp3 mpeg ncurses networkmanager nptl ogg opengl openmp pam pcre pie png policykit ppds readline sasl sdl seccomp split-usr sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svg test theora threads tiff truetype udev unicode upower vaapi vorbis wayland x264 xattr xcb xinerama xml xtpax xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-2" POSTGRES_TARGETS="postgres10 postgres11" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="i965 intel nouveau" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

dev-libs/glib-2.60.6::gentoo was built with the following:
USE="dbus mime test utils xattr -debug (-fam) -gtk-doc (-selinux) -static-libs -systemtap"
CFLAGS="-march=native -mtune=native -O2 -pipe -DG_DISABLE_CAST_CHECKS"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs cgroup collision-protect config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict news parallel-fetch pid-sandbox preserve-libs protect-owned sandbox sfperms strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
Comment 2 tka 2019-07-26 11:27:28 UTC
The relevant part of the testlog:

-------

173/255 glib:gio / gsocketclient-slow           FAIL     0.01 s (killed by signal 6 SIGABRT)

--- command ---
G_TEST_SRCDIR='/var/tmp/portage/dev-libs/glib-2.60.6/work/glib-2.60.6/gio/tests' GIO_LAUNCH_DESKTOP='/var/tmp/portage/dev-libs/glib-2.60.6/work/glib-2.60.6-abi_x86_64.amd64/gio/gio-launch-desktop' LD_PRELOAD='libsandbox.so:/var/tmp/portage/dev-libs/glib-2.60.6/work/glib-2.60.6-abi_x86_64.amd64/gio/tests/slow-connect-preload.so' G_TEST_BUILDDIR='/var/tmp/portage/dev-libs/glib-2.60.6/work/glib-2.60.6-abi_x86_64.amd64/gio/tests' GIO_MODULE_DIR='' /var/tmp/portage/dev-libs/glib-2.60.6/work/glib-2.60.6-abi_x86_64.amd64/gio/tests/gsocketclient-slow --tap
--- stdout ---
# random seed: R02S7b6e09ca3ecc40ba69122779df74d7e7
1..3
# Start of socket-client tests
# Start of happy-eyeballs tests
# GLib-GIO-DEBUG: _g_io_module_get_default: Found default implementation dummy (GDummyProxyResolver) for ?gio-proxy-resolver?
# GLib-GIO-DEBUG: IPv6 DNS error: Error resolving ?localhost?: Name or service not known
# GLib-GIO-DEBUG: IPv4 DNS error: Error resolving ?localhost?: Name or service not known
Bail out! GLib-GIO:ERROR:../glib-2.60.6/gio/tests/gsocketclient-slow.c:30:on_connected: assertion failed (error == NULL): Error resolving ?localhost?: Name or service not known (g-resolver-error-quark, 0)
--- stderr ---
**
GLib-GIO:ERROR:../glib-2.60.6/gio/tests/gsocketclient-slow.c:30:on_connected: assertion failed (error == NULL): Error resolving ?localhost?: Name or service not known (g-resolver-error-quark, 0)
-------
Comment 3 Mart Raudsepp gentoo-dev 2019-07-26 15:47:14 UTC
Yeah, I don't know what to do here if localhost doesn't work. And yes, it has to be localhost, not 127.0.0.1, ::1 or anything like that, as it has to resolve to ipv4 and ipv6, as that's the purpose of the test (Happy Eyeballs RFC 8305 implementation).
Before some meson.eclass changes from a few days back I didn't really get to see the assert messages properly, so might get to somewhere with that. Otherwise I'll have to loop in network-sandbox portage people.
Comment 4 Mike Gilbert gentoo-dev 2019-07-26 16:09:10 UTC
Does this code intentionally ignore /etc/hosts? It should not be necessary to query DNS to resolve "localhost".
Comment 5 Mart Raudsepp gentoo-dev 2019-07-26 16:42:52 UTC
According to the docs, if it's not an IP address, a DNS lookup is performed. I don't know yet if it could short-circuit that via /etc/hosts somewhere deep in the implementation or not.
Async version of https://developer.gnome.org/gio/stable/GSocketClient.html#g-socket-client-connect-to-host is called.
Comment 6 Mike Gilbert gentoo-dev 2019-07-26 18:24:05 UTC
So I think this ends up calling do_lookup_by_name() from gio/gthreadedresolver.c.

do_lookup_by_name() calls getaddrinfo() to do the hostname resolution. It passes a hints struct with the AI_ADDRCONFIG flag set.

The getaddrinfo(3) man page says this:

"""
If  hints.ai_flags includes the AI_ADDRCONFIG flag, then IPv4 addresses are returned in the list pointed to by res only if the local system has at  least  one IPv4 address configured, and IPv6 addresses are returned only if the local system has at least one IPv6 address configured.  The loopback  address is not considered for this case as valid as a configured address.  This flag is useful on, for example, IPv4-only  systems, to ensure that getaddrinfo() does not return IPv6 socket addresses that would always fail in connect(2) or bind(2).
"""

With FEATURES="network-sandbox", the only configured interface is the loopback interface, so getaddrinfo() will never return a result.

To get this to work, glib would need to be modified to not set AI_ADDRCONFIG, or portage would need to set up a dummy interface with some arbitrary IP address.
Comment 7 Mart Raudsepp gentoo-dev 2019-07-26 20:12:00 UTC
glib probably uses it for a reason, likely the one documented in the man page too: "This flag is useful on, for example, IPv4-only systems, to ensure that getaddrinfo() does not return IPv6 socket addresses that would always fail in connect(2) or bind(2).". It has had that ever since GResolver was introduced without any specific comments about it on the relevant bug reports or commits that I could see.
It also relies on getting back a list with both IPv4 and IPv6 when possible, and this is crucial for this particular test case too (as is the core point of Happy Eyes). If it weren't localhost, it wouldn't want to go poking at IPv6 resolved addresses with that Happy Eyes implementation when the interface doesn't work, so the AI_ADDRINFO helps.


So I don't see glib changing here about the flag passing outright, so the options I see would be:

1) Ignore the problem and skip the test, at least if FEATURES contains network-sandbox
2) Portage setting that stuff up
3) glib upstream agreeing to do something special in case of INADDR_LOOPBACK cases

In this specific case the test properly sets up its own localhost server and then connects to it; there's no outside network access going on, thus I would say this should work and I can't really agree to a long-term solution 1.
Comment 8 Mike Gilbert gentoo-dev 2019-07-31 17:47:37 UTC
I sent a patch to configure a dummy interface to the portage development list.

https://archives.gentoo.org/gentoo-portage-dev/message/eb7f4f3c8bdc554d69b8d161688a6d51
Comment 9 Larry the Git Cow gentoo-dev 2019-08-01 19:02:36 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=590e32d05fce225dfdab6308555f4a7668378d79

commit 590e32d05fce225dfdab6308555f4a7668378d79
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2019-07-31 19:51:34 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2019-08-01 19:01:21 +0000

    Configure additional addresses on the lo interface for network-sandbox
    
    This works around some strange behavior in glibc's getaddrinfo()
    implementation when the AI_ADDRCONFIG flag is set.
    
    For example:
    
      struct addrinfo *res, hints = { .ai_family = AF_INET, .ai_flags = AI_ADDRCONFIG };
      getaddrinfo("localhost", NULL, &hints, &res);
    
    This returns no results if there are no non-loopback addresses configured.
    
    Bug: https://bugs.gentoo.org/690758
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=12377#c13
    Reviewed-by: Zac Medico <zmedico@gentoo.org>
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 lib/portage/process.py | 50 +++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 37 insertions(+), 13 deletions(-)
Comment 10 Larry the Git Cow gentoo-dev 2019-08-02 03:46:33 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ea52ac5964e3242159373adf567ff61403b31f96

commit ea52ac5964e3242159373adf567ff61403b31f96
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-08-02 03:41:26 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-08-02 03:46:19 +0000

    sys-apps/portage: Bump to version 2.3.70
    
     #233589 Support PROPERTIES=live
     #690304 dispatch-conf unicode safety
     #690446 emaint -c binhost support for binpkg-multi-instance
     #690758 network-sandbox support for AI_ADDRCONFIG
    
    Bug: https://bugs.gentoo.org/233589
    Bug: https://bugs.gentoo.org/690304
    Bug: https://bugs.gentoo.org/690446
    Bug: https://bugs.gentoo.org/690758
    Bug: https://bugs.gentoo.org/691278
    Package-Manager: Portage-2.3.70, Repoman-2.3.16
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-2.3.70.ebuild | 260 +++++++++++++++++++++++++++++++++
 2 files changed, 261 insertions(+)
Comment 11 Martin Väth 2019-08-04 14:44:19 UTC
This bugfix is horribly bad:

I get now regularly messages of the type

RTNETLINK answers: Operation not supported

during emerge. The reason is that portage attempts to set an ipv6 address which cannot be done on my non-ipv6 kernel. I do not intend to enable ipv6 system-wide just to make portage happy.
Comment 12 Mike Gilbert gentoo-dev 2019-08-04 14:58:14 UTC
(In reply to Martin Väth from comment #11)

It's just a harmless error message, and it has already been fixed on the Portage master branch.
Comment 13 Larry the Git Cow gentoo-dev 2019-08-31 03:10:50 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=70ec13029e5cc8a1decfab7134d3addea8612bd7

commit 70ec13029e5cc8a1decfab7134d3addea8612bd7
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2019-08-30 18:24:47 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-08-31 03:10:03 +0000

    Use RTNETLINK to configure the loopback interface
    
    This eliminates the dependency on iproute2 on Linux.
    
    Bug: https://bugs.gentoo.org/690758
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/process.py      | 26 +++++-------
 lib/portage/util/netlink.py | 98 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 108 insertions(+), 16 deletions(-)
Comment 14 Larry the Git Cow gentoo-dev 2019-08-31 06:22:03 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05d4de36535c74df5e27784886a7de8d0d8afddb

commit 05d4de36535c74df5e27784886a7de8d0d8afddb
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2019-08-31 06:13:47 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-08-31 06:21:36 +0000

    sys-apps/portage: Bump to version 2.3.74
    
     #587930 glsa-check: add exit code for affected GLSAs
     #688902 Add FEATURES=pkgdir-index-trusted
     #690758 Use RTNETLINK to configure the loopback interface
     #692872 glsa-check: forward port --quiet option from gentoolkit
     #693026 rsync: proxychains compatibility
     #693088 glsa-check: forward port remaining changes from gentoolkit
     #693096 emerge: deprecate --changelog option
    
    Bug: https://bugs.gentoo.org/691278
    Bug: https://bugs.gentoo.org/587930
    Bug: https://bugs.gentoo.org/688902
    Bug: https://bugs.gentoo.org/690758
    Bug: https://bugs.gentoo.org/692872
    Bug: https://bugs.gentoo.org/693026
    Bug: https://bugs.gentoo.org/693088
    Bug: https://bugs.gentoo.org/693096
    Package-Manager: Portage-2.3.74, Repoman-2.3.17
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-2.3.74.ebuild | 261 +++++++++++++++++++++++++++++++++
 2 files changed, 262 insertions(+)