Commit d2f5ea07 authored by Jérome Perrin's avatar Jérome Perrin

component/userhosts: use github.com/figiel/hosts for compatibility with recent libc

In ubuntu 21.04 (libc6 2.33-0ubuntu5) or current debian testing
(libc6 2.32-5) no longer use open to open /etc/hosts, but what appears
as "openat" in strace output - but can not be replaced by defining an
openat function.

This uses https://github.com/figiel/hosts which uses another approach
of replacing getaddrinfo, gethostbyname* and inet_aton.

Users have been updated a bit, because there are some small differences:
 - the /etc/hosts replacement file is defined by HOSTS_FILE environment
   variable, not HOSTS
 - the library name is libuserhosts.so, not userhosts.so

Other notable differences, for which we did not need code change are:
 - the new library also try to load a file when HOSTS_FILE is not set
 - the new library still use original /etc/hosts file
 - the new library supports aliases to hostnames, not only ip addresses
parent ad4b2e8b
[userhosts]
recipe = slapos.recipe.cmmi
shared = true
url = https://lab.nexedi.com/nexedi/userhosts/repository/${:revision}/archive.tar.gz
revision = a05fe5a3a5cb7005351ef4ec41460089f3ce4d0a
md5sum = 5a80b4d962d975f290a60cf790c3334d
url = https://github.com/figiel/hosts/archive/${:revision}.tar.gz
revision = fdb45fe219593d63453f4be55cfc2a1199c18f59
md5sum = 9ff5407132a2a67200ef1036a02f0ee2
configure-command = true
make-options = PREFIX=@@LOCATION@@
make-targets = check install
make-targets = test install
......@@ -70,7 +70,7 @@ md5sum = cc19560b9400cecbd23064d55c501eec
[template]
filename = instance.cfg.in
md5sum = 9c417abd68f232b20b3cc1288155f0ae
md5sum = 81c26ad203d943d3b6c46f3de4d7c34a
[monitor-template-dummy]
filename = dummy.cfg
......@@ -86,7 +86,7 @@ md5sum = 0648e38bd5d3a15bb9f93264932740b9
[template-zope]
filename = instance-zope.cfg.in
md5sum = 82d14f1a98197eaf986bcde3318dc870
md5sum = a3b1f274569cec373d711a2f802a16ab
[template-balancer]
filename = instance-balancer.cfg.in
......
......@@ -176,7 +176,7 @@ context = key host_dict hosts-parameter:host-dict
recipe = slapos.recipe.template:jinja2
mode = 755
template = inline:#!{{ parameter_dict['dash'] }}/bin/dash
export HOSTS=${hosts:rendered}
export HOSTS_FILE=${hosts:rendered}
export LD_PRELOAD={{ parameter_dict['userhosts'] }}:$LD_PRELOAD
exec "$@"
rendered = ${directory:bin}/userhosts
......
......@@ -103,7 +103,7 @@ link-binary = {{ dumps(zope_link_binary) }}
fonts = {{ dumps(zope_fonts) }}
fontconfig-includes = {{ dumps(zope_fontconfig_includes) }}
template-fonts-conf = {{ dumps(template_fonts_conf) }}
userhosts = {{ userhosts_location }}/lib/userhosts.so
userhosts = {{ userhosts_location }}/lib/libuserhosts.so
site-zcml = {{ site_zcml }}
extra-path-list = {{ dumps(extra_path_list) }}
matplotlibrc = {{ matplotlibrc_location }}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment