diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/files/rkt-1.29.0-allow-multiple-hosts-entry-host.patch b/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/files/rkt-1.29.0-allow-multiple-hosts-entry-host.patch new file mode 100644 index 0000000000..40470d94ee --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/files/rkt-1.29.0-allow-multiple-hosts-entry-host.patch @@ -0,0 +1,68 @@ +From ce936a91678b77a2b91440e0198c895519ca8b24 Mon Sep 17 00:00:00 2001 +From: Luca Bruno +Date: Mon, 23 Oct 2017 08:49:09 +0000 +Subject: [PATCH] stage0/run: relax '--hosts-entry' parser + +This tweaks the '--hosts-entry' CLI flag parser to accept multiple +time the special value "host" when there are no other conflicting +settings. +--- + rkt/run.go | 14 +++++++------- + tests/rkt_etc_hosts_test.go | 5 +++++ + 2 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/rkt/run.go b/rkt/run.go +index b852e13a6..ab4121475 100644 +--- a/rkt/run.go ++++ b/rkt/run.go +@@ -18,6 +18,7 @@ package main + + import ( + "bufio" ++ "errors" + "fmt" + "net" + "os" +@@ -643,13 +644,8 @@ func parseDNSFlags(flagHostsEntries, flagDNS, flagDNSSearch, flagDNSOpt []string + // Parse out --hosts-entries, also looking for the magic value "host" + for _, entry := range flagHostsEntries { + if entry == "host" { +- if len(flagHostsEntries) == 1 { +- DNSConfMode.Hosts = "host" +- } else { +- return DNSConfMode, DNSConfig, &HostsEntries, +- fmt.Errorf("cannot pass --hosts-entry=host with multiple hosts-entries") +- } +- break ++ DNSConfMode.Hosts = "host" ++ continue + } + for _, entry := range strings.Split(entry, ",") { + vals := strings.SplitN(entry, "=", 2) +@@ -677,6 +673,10 @@ func parseDNSFlags(flagHostsEntries, flagDNS, flagDNSSearch, flagDNSOpt []string + } + + if len(HostsEntries) > 0 { ++ if DNSConfMode.Hosts == "host" { ++ return DNSConfMode, DNSConfig, &HostsEntries, ++ errors.New("cannot pass --hosts-entry=host with multiple hosts-entries") ++ } + DNSConfMode.Hosts = "stage0" + } + +diff --git a/tests/rkt_etc_hosts_test.go b/tests/rkt_etc_hosts_test.go +index 374916834..b3967cf6e 100644 +--- a/tests/rkt_etc_hosts_test.go ++++ b/tests/rkt_etc_hosts_test.go +@@ -80,6 +80,11 @@ func TestEtcHosts(t *testing.T) { + "--exec=/inspect -- -file-name=/etc/hosts -hash-file", + sum, + }, ++ { // Test that multiple '--hosts-entry=host' entries are fine ++ "--hosts-entry=host --hosts-entry=host", ++ "--exec=/inspect -- -file-name=/etc/hosts -hash-file", ++ sum, ++ }, + { // test that we create our own + "--hosts-entry=128.66.0.99=host1", + "--exec=/inspect -- -file-name=/etc/hosts -read-file", diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-1.29.0.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-1.29.0-r1.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-1.29.0.ebuild rename to sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-1.29.0-r1.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-9999.ebuild index 7bb56004d2..64495549e4 100644 --- a/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/app-emulation/rkt/rkt-9999.ebuild @@ -84,6 +84,8 @@ src_prepare() { die "CoreOS versions in ebuild and rkt build scripts are mismatched, expecting ${rkt_coreos_version}!" fi + epatch "${FILESDIR}/${PN}-1.29.0-allow-multiple-hosts-entry-host.patch" + autotools-utils_src_prepare }