Files
termux-packages/root-packages/docker/resolvconf.patch
2023-10-23 20:31:17 +00:00

1206 lines
59 KiB
Diff

diff -ur ../src.orig/cli/docs/reference/commandline/service_create.md ./cli/docs/reference/commandline/service_create.md
--- ../src.orig/cli/docs/reference/commandline/service_create.md 2023-10-15 10:26:02.791344801 +0000
+++ ./cli/docs/reference/commandline/service_create.md 2023-10-15 10:27:35.195005139 +0000
@@ -305,7 +305,7 @@
A **bind mount** makes a file or directory on the host available to the
container it is mounted within. A bind mount may be either read-only or
read-write. For example, a container might share its host's DNS information by
-means of a bind mount of the host's `/etc/resolv.conf` or a container might
+means of a bind mount of the host's `@TERMUX_PREFIX@/etc/resolv.conf` or a container might
write logs to its host's `/var/log/myContainerLogs` directory. If you use
bind mounts and your host and containers have different notions of permissions,
access controls, or other such details, you will run into portability issues.
diff -ur ../src.orig/cli/docs/reference/run.md ./cli/docs/reference/run.md
--- ../src.orig/cli/docs/reference/run.md 2023-10-15 10:26:02.791344801 +0000
+++ ./cli/docs/reference/run.md 2023-10-15 10:27:35.201671828 +0000
@@ -412,8 +412,8 @@
only change the hostname and domain name inside the container.
Similar to `--hostname`, the `--add-host`, `--dns`, `--dns-search`, and
`--dns-option` options can be used in `host` network mode. These options update
-`/etc/hosts` or `/etc/resolv.conf` inside the container. No change are made to
-`/etc/hosts` and `/etc/resolv.conf` on the host.
+`/etc/hosts` or `@TERMUX_PREFIX@/etc/resolv.conf` inside the container. No change are made to
+`/etc/hosts` and `@TERMUX_PREFIX@/etc/resolv.conf` on the host.
Compared to the default `bridge` mode, the `host` mode gives *significantly*
better networking performance since it uses the host's native networking stack
diff -ur ../src.orig/libnetwork/api/api_test.go ./libnetwork/api/api_test.go
--- ../src.orig/libnetwork/api/api_test.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/api/api_test.go 2023-10-15 10:27:36.505009746 +0000
@@ -132,7 +132,7 @@
hn := "host1"
dn := "docker.com"
hp := "/etc/hosts"
- rc := "/etc/resolv.conf"
+ rc := "@TERMUX_PREFIX@/etc/resolv.conf"
dnss := []string{"8.8.8.8", "172.28.34.5"}
ehs := []extraHost{{Name: "extra1", Address: "172.28.9.1"}, {Name: "extra2", Address: "172.28.9.2"}}
diff -ur ../src.orig/libnetwork/libnetwork_linux_test.go ./libnetwork/libnetwork_linux_test.go
--- ../src.orig/libnetwork/libnetwork_linux_test.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/libnetwork_linux_test.go 2023-10-15 10:27:36.268342246 +0000
@@ -551,13 +551,13 @@
tmpResolvConf := []byte("search pommesfrites.fr\nnameserver 12.34.56.78\nnameserver 2001:4860:4860::8888\n")
expectedResolvConf := []byte("search pommesfrites.fr\nnameserver 127.0.0.11\nnameserver 2001:4860:4860::8888\noptions ndots:0\n")
//take a copy of resolv.conf for restoring after test completes
- resolvConfSystem, err := ioutil.ReadFile("/etc/resolv.conf")
+ resolvConfSystem, err := ioutil.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
t.Fatal(err)
}
//cleanup
defer func() {
- if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := ioutil.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
t.Fatal(err)
}
}()
@@ -585,7 +585,7 @@
t.Fatal(err)
}
- if err := ioutil.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
+ if err := ioutil.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
t.Fatal(err)
}
@@ -629,13 +629,13 @@
tmpResolvConf := []byte("search localhost.net\nnameserver 127.0.0.1\nnameserver 2001:4860:4860::8888\n")
//take a copy of resolv.conf for restoring after test completes
- resolvConfSystem, err := ioutil.ReadFile("/etc/resolv.conf")
+ resolvConfSystem, err := ioutil.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
t.Fatal(err)
}
//cleanup
defer func() {
- if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := ioutil.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
t.Fatal(err)
}
}()
@@ -650,7 +650,7 @@
t.Fatal(err)
}
- if err := ioutil.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
+ if err := ioutil.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
t.Fatal(err)
}
@@ -660,7 +660,7 @@
sb, err := controller.NewSandbox(containerID,
libnetwork.OptionUseDefaultSandbox(),
libnetwork.OptionResolvConfPath(resolvConfPath),
- libnetwork.OptionOriginResolvConfPath("/etc/resolv.conf"))
+ libnetwork.OptionOriginResolvConfPath("@TERMUX_PREFIX@/etc/resolv.conf"))
if err != nil {
t.Fatal(err)
}
@@ -712,13 +712,13 @@
tmpResolvConf3 := []byte("search pommesfrites.fr\nnameserver 113.34.56.78\n")
//take a copy of resolv.conf for restoring after test completes
- resolvConfSystem, err := ioutil.ReadFile("/etc/resolv.conf")
+ resolvConfSystem, err := ioutil.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
t.Fatal(err)
}
//cleanup
defer func() {
- if err := ioutil.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := ioutil.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
t.Fatal(err)
}
}()
@@ -743,7 +743,7 @@
t.Fatal(err)
}
- if err := ioutil.WriteFile("/etc/resolv.conf", tmpResolvConf1, 0644); err != nil {
+ if err := ioutil.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf1, 0644); err != nil {
t.Fatal(err)
}
@@ -790,7 +790,7 @@
t.Fatal(err)
}
- if err := ioutil.WriteFile("/etc/resolv.conf", tmpResolvConf2, 0644); err != nil {
+ if err := ioutil.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf2, 0644); err != nil {
t.Fatal(err)
}
diff -ur ../src.orig/libnetwork/netutils/utils_linux.go ./libnetwork/netutils/utils_linux.go
--- ../src.orig/libnetwork/netutils/utils_linux.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/netutils/utils_linux.go 2023-10-15 10:27:36.268342246 +0000
@@ -113,7 +113,7 @@
// overlap with existing interfaces in the system
func FindAvailableNetwork(list []*net.IPNet) (*net.IPNet, error) {
// We don't check for an error here, because we don't really care if we
- // can't read /etc/resolv.conf. So instead we skip the append if resolvConf
+ // can't read @TERMUX_PREFIX@/etc/resolv.conf. So instead we skip the append if resolvConf
// is nil. It either doesn't exist, or we can't read it for some reason.
var nameservers []string
if rc, err := resolvconf.Get(); err == nil {
diff -ur ../src.orig/libnetwork/resolvconf/README.md ./libnetwork/resolvconf/README.md
--- ../src.orig/libnetwork/resolvconf/README.md 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/resolvconf/README.md 2023-10-15 10:27:36.261675557 +0000
@@ -1 +1 @@
-Package resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf
+Package resolvconf provides utility code to query and update DNS configuration in @TERMUX_PREFIX@/etc/resolv.conf
diff -ur ../src.orig/libnetwork/resolvconf/resolvconf.go ./libnetwork/resolvconf/resolvconf.go
--- ../src.orig/libnetwork/resolvconf/resolvconf.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/resolvconf/resolvconf.go 2023-10-15 10:27:36.261675557 +0000
@@ -1,4 +1,4 @@
-// Package resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf
+// Package resolvconf provides utility code to query and update DNS configuration in @TERMUX_PREFIX@/etc/resolv.conf
package resolvconf
import (
@@ -16,7 +16,7 @@
const (
// defaultPath is the default path to the resolv.conf that contains information to resolve DNS. See Path().
- defaultPath = "/etc/resolv.conf"
+ defaultPath = "@TERMUX_PREFIX@/etc/resolv.conf"
// alternatePath is a path different from defaultPath, that may be used to resolve DNS. See Path().
alternatePath = "/run/systemd/resolve/resolv.conf"
)
@@ -28,15 +28,15 @@
// Path returns the path to the resolv.conf file that libnetwork should use.
//
-// When /etc/resolv.conf contains 127.0.0.53 as the only nameserver, then
+// When @TERMUX_PREFIX@/etc/resolv.conf contains 127.0.0.53 as the only nameserver, then
// it is assumed systemd-resolved manages DNS. Because inside the container 127.0.0.53
// is not a valid DNS server, Path() returns /run/systemd/resolve/resolv.conf
// which is the resolv.conf that systemd-resolved generates and manages.
-// Otherwise Path() returns /etc/resolv.conf.
+// Otherwise Path() returns @TERMUX_PREFIX@/etc/resolv.conf.
//
// Errors are silenced as they will inevitably resurface at future open/read calls.
//
-// More information at https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html#/etc/resolv.conf
+// More information at https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html#@TERMUX_PREFIX@/etc/resolv.conf
func Path() string {
detectSystemdResolvConfOnce.Do(func() {
candidateResolvConf, err := ioutil.ReadFile(defaultPath)
@@ -87,7 +87,7 @@
Hash string
}
-// Get returns the contents of /etc/resolv.conf and its hash
+// Get returns the contents of @TERMUX_PREFIX@/etc/resolv.conf and its hash
func Get() (*File, error) {
return GetSpecific(Path())
}
@@ -105,7 +105,7 @@
return &File{Content: resolv, Hash: hash}, nil
}
-// GetIfChanged retrieves the host /etc/resolv.conf file, checks against the last hash
+// GetIfChanged retrieves the host @TERMUX_PREFIX@/etc/resolv.conf file, checks against the last hash
// and, if modified since last check, returns the bytes and new hash.
// This feature is used by the resolv.conf updater for containers
func GetIfChanged() (*File, error) {
@@ -183,7 +183,7 @@
return output
}
-// GetNameservers returns nameservers (if any) listed in /etc/resolv.conf
+// GetNameservers returns nameservers (if any) listed in @TERMUX_PREFIX@/etc/resolv.conf
func GetNameservers(resolvConf []byte, kind int) []string {
nameservers := []string{}
for _, line := range getLines(resolvConf, []byte("#")) {
@@ -203,7 +203,7 @@
}
// GetNameserversAsCIDR returns nameservers (if any) listed in
-// /etc/resolv.conf as CIDR blocks (e.g., "1.2.3.4/32")
+// @TERMUX_PREFIX@/etc/resolv.conf as CIDR blocks (e.g., "1.2.3.4/32")
// This function's output is intended for net.ParseCIDR
func GetNameserversAsCIDR(resolvConf []byte) []string {
nameservers := []string{}
@@ -220,7 +220,7 @@
return nameservers
}
-// GetSearchDomains returns search domains (if any) listed in /etc/resolv.conf
+// GetSearchDomains returns search domains (if any) listed in @TERMUX_PREFIX@/etc/resolv.conf
// If more than one search line is encountered, only the contents of the last
// one is returned.
func GetSearchDomains(resolvConf []byte) []string {
@@ -235,7 +235,7 @@
return domains
}
-// GetOptions returns options (if any) listed in /etc/resolv.conf
+// GetOptions returns options (if any) listed in @TERMUX_PREFIX@/etc/resolv.conf
// If more than one options line is encountered, only the contents of the last
// one is returned.
func GetOptions(resolvConf []byte) []string {
diff -ur ../src.orig/libnetwork/resolvconf/resolvconf_test.go ./libnetwork/resolvconf/resolvconf_test.go
--- ../src.orig/libnetwork/resolvconf/resolvconf_test.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/resolvconf/resolvconf_test.go 2023-10-15 10:27:36.261675557 +0000
@@ -16,19 +16,19 @@
if err != nil {
t.Fatal(err)
}
- resolvConfSystem, err := ioutil.ReadFile("/etc/resolv.conf")
+ resolvConfSystem, err := ioutil.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
t.Fatal(err)
}
if string(resolvConfUtils.Content) != string(resolvConfSystem) {
- t.Fatalf("/etc/resolv.conf and GetResolvConf have different content.")
+ t.Fatalf("@TERMUX_PREFIX@/etc/resolv.conf and GetResolvConf have different content.")
}
hashSystem, err := ioutils.HashData(bytes.NewReader(resolvConfSystem))
if err != nil {
t.Fatal(err)
}
if resolvConfUtils.Hash != hashSystem {
- t.Fatalf("/etc/resolv.conf and GetResolvConf have different hashes.")
+ t.Fatalf("@TERMUX_PREFIX@/etc/resolv.conf and GetResolvConf have different hashes.")
}
}
diff -ur ../src.orig/libnetwork/sandbox_dns_unix.go ./libnetwork/sandbox_dns_unix.go
--- ../src.orig/libnetwork/sandbox_dns_unix.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/sandbox_dns_unix.go 2023-10-15 10:27:36.268342246 +0000
@@ -225,10 +225,10 @@
if !os.IsNotExist(err) {
return err
}
- // it's ok to continue if /etc/resolv.conf doesn't exist, default resolvers (Google's Public DNS)
+ // it's ok to continue if @TERMUX_PREFIX@/etc/resolv.conf doesn't exist, default resolvers (Google's Public DNS)
// will be used
currRC = &resolvconf.File{}
- logrus.Infof("/etc/resolv.conf does not exist")
+ logrus.Infof("@TERMUX_PREFIX@/etc/resolv.conf does not exist")
}
if len(sb.config.dnsList) > 0 || len(sb.config.dnsSearchList) > 0 || len(sb.config.dnsOptionsList) > 0 {
diff -ur ../src.orig/libnetwork/sandbox.go ./libnetwork/sandbox.go
--- ../src.orig/libnetwork/sandbox.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/sandbox.go 2023-10-15 10:27:36.268342246 +0000
@@ -112,7 +112,7 @@
IP string
}
-// These are the container configs used to customize container /etc/resolv.conf file.
+// These are the container configs used to customize container @TERMUX_PREFIX@/etc/resolv.conf file.
type resolvConfPathConfig struct {
resolvConfPath string
originResolvConfPath string
diff -ur ../src.orig/libnetwork/vendor/github.com/hashicorp/memberlist/config.go ./libnetwork/vendor/github.com/hashicorp/memberlist/config.go
--- ../src.orig/libnetwork/vendor/github.com/hashicorp/memberlist/config.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/vendor/github.com/hashicorp/memberlist/config.go 2023-10-15 10:27:36.435009499 +0000
@@ -188,7 +188,7 @@
Alive AliveDelegate
// DNSConfigPath points to the system's DNS config file, usually located
- // at /etc/resolv.conf. It can be overridden via config for easier testing.
+ // at @TERMUX_PREFIX@/etc/resolv.conf. It can be overridden via config for easier testing.
DNSConfigPath string
// LogOutput is the writer where logs should be sent. If this is not
@@ -254,7 +254,7 @@
SecretKey: nil,
Keyring: nil,
- DNSConfigPath: "/etc/resolv.conf",
+ DNSConfigPath: "@TERMUX_PREFIX@/etc/resolv.conf",
HandoffQueueDepth: 1024,
UDPBufferSize: 1400,
diff -ur ../src.orig/libnetwork/vendor/github.com/miekg/dns/clientconfig.go ./libnetwork/vendor/github.com/miekg/dns/clientconfig.go
--- ../src.orig/libnetwork/vendor/github.com/miekg/dns/clientconfig.go 2023-10-15 10:26:02.794678146 +0000
+++ ./libnetwork/vendor/github.com/miekg/dns/clientconfig.go 2023-10-15 10:27:36.451676225 +0000
@@ -8,7 +8,7 @@
"strings"
)
-// ClientConfig wraps the contents of the /etc/resolv.conf file.
+// ClientConfig wraps the contents of the @TERMUX_PREFIX@/etc/resolv.conf file.
type ClientConfig struct {
Servers []string // servers to use
Search []string // suffixes to append to local name
diff -ur ../src.orig/moby/container/container_unix.go ./moby/container/container_unix.go
--- ../src.orig/moby/container/container_unix.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/container/container_unix.go 2023-10-15 10:27:35.245005315 +0000
@@ -37,7 +37,7 @@
// TrySetNetworkMount attempts to set the network mounts given a provided destination and
// the path to use for it; return true if the given destination was a network mount file
func (container *Container) TrySetNetworkMount(destination string, path string) bool {
- if destination == "/etc/resolv.conf" {
+ if destination == "@TERMUX_PREFIX@/etc/resolv.conf" {
container.ResolvConfPath = path
return true
}
@@ -73,14 +73,14 @@
logrus.Warnf("ResolvConfPath set to %q, but can't stat this filename (err = %v); skipping", container.ResolvConfPath, err)
} else {
writable := !container.HostConfig.ReadonlyRootfs
- if m, exists := container.MountPoints["/etc/resolv.conf"]; exists {
+ if m, exists := container.MountPoints["@TERMUX_PREFIX@/etc/resolv.conf"]; exists {
writable = m.RW
} else {
label.Relabel(container.ResolvConfPath, container.MountLabel, shared)
}
mounts = append(mounts, Mount{
Source: container.ResolvConfPath,
- Destination: "/etc/resolv.conf",
+ Destination: "@TERMUX_PREFIX@/etc/resolv.conf",
Writable: writable,
Propagation: string(parser.DefaultPropagationMode()),
})
diff -ur ../src.orig/moby/contrib/dockerd-rootless.sh ./moby/contrib/dockerd-rootless.sh
--- ../src.orig/moby/contrib/dockerd-rootless.sh 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/contrib/dockerd-rootless.sh 2023-10-15 10:27:35.351672357 +0000
@@ -95,8 +95,8 @@
# Re-exec the script via RootlessKit, so as to create unprivileged {user,mount,network} namespaces.
#
# --copy-up allows removing/creating files in the directories by creating tmpfs and symlinks
- # * /etc: copy-up is required so as to prevent `/etc/resolv.conf` in the
- # namespace from being unexpectedly unmounted when `/etc/resolv.conf` is recreated on the host
+ # * /etc: copy-up is required so as to prevent `@TERMUX_PREFIX@/etc/resolv.conf` in the
+ # namespace from being unexpectedly unmounted when `@TERMUX_PREFIX@/etc/resolv.conf` is recreated on the host
# (by either systemd-networkd or NetworkManager)
# * /run: copy-up is required so that we can create /run/docker (hardcoded for plugins) in our namespace
exec $rootlesskit \
diff -ur ../src.orig/moby/daemon/container_operations_unix.go ./moby/daemon/container_operations_unix.go
--- ../src.orig/moby/daemon/container_operations_unix.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/daemon/container_operations_unix.go 2023-10-15 10:27:35.288338800 +0000
@@ -384,25 +384,25 @@
func (daemon *Daemon) setupPathsAndSandboxOptions(container *container.Container, sboxOptions *[]libnetwork.SandboxOption) error {
var err error
- // Set the correct paths for /etc/hosts and /etc/resolv.conf, based on the
+ // Set the correct paths for /etc/hosts and @TERMUX_PREFIX@/etc/resolv.conf, based on the
// networking-mode of the container. Note that containers with "container"
// networking are already handled in "initializeNetworking()" before we reach
// this function, so do not have to be accounted for here.
switch {
case container.HostConfig.NetworkMode.IsHost():
// In host-mode networking, the container does not have its own networking
- // namespace, so both `/etc/hosts` and `/etc/resolv.conf` should be the same
+ // namespace, so both `/etc/hosts` and `@TERMUX_PREFIX@/etc/resolv.conf` should be the same
// as on the host itself. The container gets a copy of these files.
*sboxOptions = append(
*sboxOptions,
libnetwork.OptionOriginHostsPath("/etc/hosts"),
- libnetwork.OptionOriginResolvConfPath("/etc/resolv.conf"),
+ libnetwork.OptionOriginResolvConfPath("@TERMUX_PREFIX@/etc/resolv.conf"),
)
case container.HostConfig.NetworkMode.IsUserDefined():
// The container uses a user-defined network. We use the embedded DNS
// server for container name resolution and to act as a DNS forwarder
// for external DNS resolution.
- // We parse the DNS server(s) that are defined in /etc/resolv.conf on
+ // We parse the DNS server(s) that are defined in @TERMUX_PREFIX@/etc/resolv.conf on
// the host, which may be a local DNS server (for example, if DNSMasq or
// systemd-resolvd are in use). The embedded DNS server forwards DNS
// resolution to the DNS server configured on the host, which in itself
@@ -412,7 +412,7 @@
// directly, as they can be dynamically reconfigured.
*sboxOptions = append(
*sboxOptions,
- libnetwork.OptionOriginResolvConfPath("/etc/resolv.conf"),
+ libnetwork.OptionOriginResolvConfPath("@TERMUX_PREFIX@/etc/resolv.conf"),
)
default:
// For other situations, such as the default bridge network, container
@@ -425,7 +425,7 @@
// container are not updated after the container is created, but the
// DNS servers on the host can be dynamically updated.
//
- // Copy the host's resolv.conf for the container (/run/systemd/resolve/resolv.conf or /etc/resolv.conf)
+ // Copy the host's resolv.conf for the container (/run/systemd/resolve/resolv.conf or @TERMUX_PREFIX@/etc/resolv.conf)
*sboxOptions = append(
*sboxOptions,
libnetwork.OptionOriginResolvConfPath(daemon.configStore.GetResolvConf()),
diff -ur ../src.orig/moby/daemon/daemon_linux.go ./moby/daemon/daemon_linux.go
--- ../src.orig/moby/daemon/daemon_linux.go 2023-10-15 10:26:02.708011170 +0000
+++ ./moby/daemon/daemon_linux.go 2023-10-15 10:27:35.288338800 +0000
@@ -134,7 +134,7 @@
}
// setupResolvConf sets the appropriate resolv.conf file if not specified
-// When systemd-resolved is running the default /etc/resolv.conf points to
+// When systemd-resolved is running the default @TERMUX_PREFIX@/etc/resolv.conf points to
// localhost. In this case fetch the alternative config file that is in a
// different path so that containers can use it
// In all the other cases fallback to the default one
diff -ur ../src.orig/moby/daemon/daemon_linux_test.go ./moby/daemon/daemon_linux_test.go
--- ../src.orig/moby/daemon/daemon_linux_test.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/daemon/daemon_linux_test.go 2023-10-15 10:27:35.341672321 +0000
@@ -42,7 +42,7 @@
159 142 8:4 /home/mlaventure/gopath /home/mlaventure/gopath rw,relatime - ext4 /dev/disk/by-uuid/d99e196c-1fc4-4b4f-bab9-9962b2b34e99 rw,errors=remount-ro,data=ordered
160 142 8:4 /var/lib/docker/volumes/9a428b651ee4c538130143cad8d87f603a4bf31b928afe7ff3ecd65480692b35/_data /var/lib/docker rw,relatime - ext4 /dev/disk/by-uuid/d99e196c-1fc4-4b4f-bab9-9962b2b34e99 rw,errors=remount-ro,data=ordered
164 142 8:4 /home/mlaventure/gopath/src/github.com/docker/docker /go/src/github.com/docker/docker rw,relatime - ext4 /dev/disk/by-uuid/d99e196c-1fc4-4b4f-bab9-9962b2b34e99 rw,errors=remount-ro,data=ordered
-165 142 8:4 /var/lib/docker/containers/5425782a95e643181d8a485a2bab3c0bb21f51d7dfc03511f0e6fbf3f3aa356a/resolv.conf /etc/resolv.conf rw,relatime - ext4 /dev/disk/by-uuid/d99e196c-1fc4-4b4f-bab9-9962b2b34e99 rw,errors=remount-ro,data=ordered
+165 142 8:4 /var/lib/docker/containers/5425782a95e643181d8a485a2bab3c0bb21f51d7dfc03511f0e6fbf3f3aa356a/resolv.conf @TERMUX_PREFIX@/etc/resolv.conf rw,relatime - ext4 /dev/disk/by-uuid/d99e196c-1fc4-4b4f-bab9-9962b2b34e99 rw,errors=remount-ro,data=ordered
166 142 8:4 /var/lib/docker/containers/5425782a95e643181d8a485a2bab3c0bb21f51d7dfc03511f0e6fbf3f3aa356a/hostname /etc/hostname rw,relatime - ext4 /dev/disk/by-uuid/d99e196c-1fc4-4b4f-bab9-9962b2b34e99 rw,errors=remount-ro,data=ordered
167 142 8:4 /var/lib/docker/containers/5425782a95e643181d8a485a2bab3c0bb21f51d7dfc03511f0e6fbf3f3aa356a/hosts /etc/hosts rw,relatime - ext4 /dev/disk/by-uuid/d99e196c-1fc4-4b4f-bab9-9962b2b34e99 rw,errors=remount-ro,data=ordered
168 144 0:39 / /dev/shm rw,nosuid,nodev,noexec,relatime - tmpfs shm rw,size=65536k
diff -ur ../src.orig/moby/daemon/initlayer/setup_unix.go ./moby/daemon/initlayer/setup_unix.go
--- ../src.orig/moby/daemon/initlayer/setup_unix.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/daemon/initlayer/setup_unix.go 2023-10-15 10:27:35.341672321 +0000
@@ -27,7 +27,7 @@
"/proc": "dir",
"/sys": "dir",
"/.dockerenv": "file",
- "/etc/resolv.conf": "file",
+ "@TERMUX_PREFIX@/etc/resolv.conf": "file",
"/etc/hosts": "file",
"/etc/hostname": "file",
"/dev/console": "file",
diff -ur ../src.orig/moby/daemon/volumes_unix.go ./moby/daemon/volumes_unix.go
--- ../src.orig/moby/daemon/volumes_unix.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/daemon/volumes_unix.go 2023-10-15 10:27:35.331672287 +0000
@@ -17,7 +17,7 @@
// setupMounts iterates through each of the mount points for a container and
// calls Setup() on each. It also looks to see if is a network mount such as
-// /etc/resolv.conf, and if it is not, appends it to the array of mounts.
+// @TERMUX_PREFIX@/etc/resolv.conf, and if it is not, appends it to the array of mounts.
func (daemon *Daemon) setupMounts(c *container.Container) ([]container.Mount, error) {
var mounts []container.Mount
// TODO: tmpfs mounts should be part of Mountpoints
@@ -96,7 +96,7 @@
// sortMounts sorts an array of mounts in lexicographic order. This ensure that
// when mounting, the mounts don't shadow other mounts. For example, if mounting
-// /etc and /etc/resolv.conf, /etc/resolv.conf must not be mounted first.
+// /etc and @TERMUX_PREFIX@/etc/resolv.conf, @TERMUX_PREFIX@/etc/resolv.conf must not be mounted first.
func sortMounts(m []container.Mount) []container.Mount {
sort.Sort(mounts(m))
return m
diff -ur ../src.orig/moby/integration/container/mounts_linux_test.go ./moby/integration/container/mounts_linux_test.go
--- ../src.orig/moby/integration/container/mounts_linux_test.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/integration/container/mounts_linux_test.go 2023-10-15 10:27:35.258338695 +0000
@@ -46,7 +46,7 @@
{
Type: "bind",
Source: tmpNWFileMount,
- Target: "/etc/resolv.conf",
+ Target: "@TERMUX_PREFIX@/etc/resolv.conf",
},
{
Type: "bind",
@@ -77,7 +77,7 @@
// (represented by `daemon.repository` at init time).
// This forces users who want to use user namespaces to handle the
// ownership needs of any external files mounted as network files
- // (/etc/resolv.conf, /etc/hosts, /etc/hostname) separately from the
+ // (@TERMUX_PREFIX@/etc/resolv.conf, /etc/hosts, /etc/hostname) separately from the
// daemon. In all other volume/bind mount situations we have taken this
// same line--we don't chown host file content.
// See GitHub PR 34224 for details.
diff -ur ../src.orig/moby/integration-cli/docker_cli_cp_test.go ./moby/integration-cli/docker_cli_cp_test.go
--- ../src.orig/moby/integration-cli/docker_cli_cp_test.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/integration-cli/docker_cli_cp_test.go 2023-10-15 10:27:36.248342177 +0000
@@ -398,8 +398,8 @@
out, _ = dockerCmd(c, "wait", containerID)
assert.Equal(c, strings.TrimSpace(out), "0", "failed to set up container")
- // Copy actual /etc/resolv.conf
- dockerCmd(c, "cp", containerID+":/etc/resolv.conf", outDir)
+ // Copy actual @TERMUX_PREFIX@/etc/resolv.conf
+ dockerCmd(c, "cp", containerID+":@TERMUX_PREFIX@/etc/resolv.conf", outDir)
expected := readContainerFile(c, containerID, "resolv.conf")
actual, err := os.ReadFile(outDir + "/resolv.conf")
@@ -414,7 +414,7 @@
assert.NilError(c, err)
assert.Assert(c, bytes.Equal(actual, expected), "Expected copied file to be duplicate of the container hosts")
- // Copy actual /etc/resolv.conf
+ // Copy actual @TERMUX_PREFIX@/etc/resolv.conf
dockerCmd(c, "cp", containerID+":/etc/hostname", outDir)
expected = readContainerFile(c, containerID, "hostname")
diff -ur ../src.orig/moby/integration-cli/docker_cli_daemon_test.go ./moby/integration-cli/docker_cli_daemon_test.go
--- ../src.orig/moby/integration-cli/docker_cli_daemon_test.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/integration-cli/docker_cli_daemon_test.go 2023-10-15 10:27:36.245008831 +0000
@@ -2258,7 +2258,7 @@
s.d.StartWithBusybox(c, "--dns", "1.2.3.4", "--dns-search", "example.com", "--dns-opt", "timeout:3")
expectedOutput := "nameserver 1.2.3.4"
- out, _ := s.d.Cmd("run", "--net=host", "busybox", "cat", "/etc/resolv.conf")
+ out, _ := s.d.Cmd("run", "--net=host", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf")
assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out)
expectedOutput = "search example.com"
assert.Assert(c, strings.Contains(out, expectedOutput), "Expected '%s', but got %q", expectedOutput, out)
diff -ur ../src.orig/moby/integration-cli/docker_cli_run_test.go ./moby/integration-cli/docker_cli_run_test.go
--- ../src.orig/moby/integration-cli/docker_cli_run_test.go 2023-10-15 10:26:02.758011348 +0000
+++ ./moby/integration-cli/docker_cli_run_test.go 2023-10-15 10:27:36.238342141 +0000
@@ -1263,13 +1263,13 @@
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
// preserve original resolv.conf for restoring after test
- origResolvConf, err := os.ReadFile("/etc/resolv.conf")
+ origResolvConf, err := os.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if os.IsNotExist(err) {
- c.Fatalf("/etc/resolv.conf does not exist")
+ c.Fatalf("@TERMUX_PREFIX@/etc/resolv.conf does not exist")
}
// defer restored original conf
defer func() {
- if err := os.WriteFile("/etc/resolv.conf", origResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", origResolvConf, 0644); err != nil {
c.Fatal(err)
}
}()
@@ -1278,11 +1278,11 @@
// 2 are removed from the file at container start, and the 3rd (commented out) one is ignored by
// GetNameservers(), leading to a replacement of nameservers with the default set
tmpResolvConf := []byte("nameserver 127.0.0.1\n#nameserver 127.0.2.1\nnameserver ::1")
- if err := os.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
c.Fatal(err)
}
- actual, _ := dockerCmd(c, "run", "busybox", "cat", "/etc/resolv.conf")
+ actual, _ := dockerCmd(c, "run", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf")
// check that the actual defaults are appended to the commented out
// localhost resolver (which should be preserved)
// NOTE: if we ever change the defaults from google dns, this will break
@@ -1296,7 +1296,7 @@
// Not applicable on Windows as Windows does not support --dns*, or
// the Unix-specific functionality of resolv.conf.
testRequires(c, DaemonIsLinux)
- result := cli.DockerCmd(c, "run", "--dns=127.0.0.1", "--dns-search=mydomain", "--dns-opt=ndots:9", "busybox", "cat", "/etc/resolv.conf")
+ result := cli.DockerCmd(c, "run", "--dns=127.0.0.1", "--dns-search=mydomain", "--dns-opt=ndots:9", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf")
// The client will get a warning on stderr when setting DNS to a localhost address; verify this:
if !strings.Contains(result.Stderr(), "Localhost DNS setting") {
@@ -1308,7 +1308,7 @@
c.Fatalf("expected 'search mydomain nameserver 127.0.0.1 options ndots:9', but says: %q", actual)
}
- out := cli.DockerCmd(c, "run", "--dns=1.1.1.1", "--dns-search=.", "--dns-opt=ndots:3", "busybox", "cat", "/etc/resolv.conf").Combined()
+ out := cli.DockerCmd(c, "run", "--dns=1.1.1.1", "--dns-search=.", "--dns-opt=ndots:3", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf").Combined()
actual = strings.ReplaceAll(strings.Trim(strings.Trim(out, "\r\n"), " "), "\n", " ")
if actual != "nameserver 1.1.1.1 options ndots:3" {
@@ -1318,7 +1318,7 @@
func (s *DockerCLIRunSuite) TestRunDNSRepeatOptions(c *testing.T) {
testRequires(c, DaemonIsLinux)
- out := cli.DockerCmd(c, "run", "--dns=1.1.1.1", "--dns=2.2.2.2", "--dns-search=mydomain", "--dns-search=mydomain2", "--dns-opt=ndots:9", "--dns-opt=timeout:3", "busybox", "cat", "/etc/resolv.conf").Stdout()
+ out := cli.DockerCmd(c, "run", "--dns=1.1.1.1", "--dns=2.2.2.2", "--dns-search=mydomain", "--dns-search=mydomain2", "--dns-opt=ndots:9", "--dns-opt=timeout:3", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf").Stdout()
actual := strings.ReplaceAll(strings.Trim(out, "\r\n"), "\n", " ")
if actual != "search mydomain mydomain2 nameserver 1.1.1.1 nameserver 2.2.2.2 options ndots:9 timeout:3" {
@@ -1330,16 +1330,16 @@
// Not applicable on Windows as testing Unix specific functionality
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
- origResolvConf, err := os.ReadFile("/etc/resolv.conf")
+ origResolvConf, err := os.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if os.IsNotExist(err) {
- c.Fatalf("/etc/resolv.conf does not exist")
+ c.Fatalf("@TERMUX_PREFIX@/etc/resolv.conf does not exist")
}
hostNameservers := resolvconf.GetNameservers(origResolvConf, resolvconf.IP)
hostSearch := resolvconf.GetSearchDomains(origResolvConf)
var out string
- out, _ = dockerCmd(c, "run", "--dns=127.0.0.1", "busybox", "cat", "/etc/resolv.conf")
+ out, _ = dockerCmd(c, "run", "--dns=127.0.0.1", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf")
if actualNameservers := resolvconf.GetNameservers([]byte(out), resolvconf.IP); actualNameservers[0] != "127.0.0.1" {
c.Fatalf("expected '127.0.0.1', but says: %q", actualNameservers[0])
@@ -1355,7 +1355,7 @@
}
}
- out, _ = dockerCmd(c, "run", "--dns-search=mydomain", "busybox", "cat", "/etc/resolv.conf")
+ out, _ = dockerCmd(c, "run", "--dns-search=mydomain", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf")
actualNameservers := resolvconf.GetNameservers([]byte(out), resolvconf.IP)
if len(actualNameservers) != len(hostNameservers) {
@@ -1373,24 +1373,24 @@
// test with file
tmpResolvConf := []byte("search example.com\nnameserver 12.34.56.78\nnameserver 127.0.0.1")
- if err := os.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
c.Fatal(err)
}
// put the old resolvconf back
defer func() {
- if err := os.WriteFile("/etc/resolv.conf", origResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", origResolvConf, 0644); err != nil {
c.Fatal(err)
}
}()
- resolvConf, err := os.ReadFile("/etc/resolv.conf")
+ resolvConf, err := os.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if os.IsNotExist(err) {
- c.Fatalf("/etc/resolv.conf does not exist")
+ c.Fatalf("@TERMUX_PREFIX@/etc/resolv.conf does not exist")
}
hostSearch = resolvconf.GetSearchDomains(resolvConf)
- out, _ = dockerCmd(c, "run", "busybox", "cat", "/etc/resolv.conf")
+ out, _ = dockerCmd(c, "run", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf")
if actualNameservers = resolvconf.GetNameservers([]byte(out), resolvconf.IP); actualNameservers[0] != "12.34.56.78" || len(actualNameservers) != 1 {
c.Fatalf("expected '12.34.56.78', but has: %v", actualNameservers)
}
@@ -1428,8 +1428,8 @@
}
// Test if container resolv.conf gets updated the next time it restarts
-// if host /etc/resolv.conf has changed. This only applies if the container
-// uses the host's /etc/resolv.conf and does not have any dns options provided.
+// if host @TERMUX_PREFIX@/etc/resolv.conf has changed. This only applies if the container
+// uses the host's @TERMUX_PREFIX@/etc/resolv.conf and does not have any dns options provided.
func (s *DockerCLIRunSuite) TestRunResolvconfUpdate(c *testing.T) {
// Not applicable on Windows as testing unix specific functionality
testRequires(c, testEnv.IsLocalDaemon, DaemonIsLinux)
@@ -1439,7 +1439,7 @@
tmpLocalhostResolvConf := []byte("nameserver 127.0.0.1")
// take a copy of resolv.conf for restoring after test completes
- resolvConfSystem, err := os.ReadFile("/etc/resolv.conf")
+ resolvConfSystem, err := os.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
c.Fatal(err)
}
@@ -1447,17 +1447,17 @@
// This test case is meant to test monitoring resolv.conf when it is
// a regular file not a bind mounc. So we unmount resolv.conf and replace
// it with a file containing the original settings.
- mounted, err := mountinfo.Mounted("/etc/resolv.conf")
+ mounted, err := mountinfo.Mounted("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
c.Fatal(err)
}
if mounted {
- icmd.RunCommand("umount", "/etc/resolv.conf").Assert(c, icmd.Success)
+ icmd.RunCommand("umount", "@TERMUX_PREFIX@/etc/resolv.conf").Assert(c, icmd.Success)
}
// cleanup
defer func() {
- if err := os.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
c.Fatal(err)
}
}()
@@ -1467,7 +1467,7 @@
containerID1 := getIDByName(c, "first")
// replace resolv.conf with our temporary copy
- if err := os.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
c.Fatal(err)
}
@@ -1481,16 +1481,16 @@
}
/* // make a change to resolv.conf (in this case replacing our tmp copy with orig copy)
- if err := os.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
c.Fatal(err)
} */
// 2. test that a restarting container does not receive resolv.conf updates
// if it modified the container copy of the starting point resolv.conf
- dockerCmd(c, "run", "--name=second", "busybox", "sh", "-c", "echo 'search mylittlepony.com' >>/etc/resolv.conf")
+ dockerCmd(c, "run", "--name=second", "busybox", "sh", "-c", "echo 'search mylittlepony.com' >>@TERMUX_PREFIX@/etc/resolv.conf")
containerID2 := getIDByName(c, "second")
// make a change to resolv.conf (in this case replacing our tmp copy with orig copy)
- if err := os.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
c.Fatal(err)
}
@@ -1508,7 +1508,7 @@
runningContainerID := strings.TrimSpace(out)
// replace resolv.conf
- if err := os.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
c.Fatal(err)
}
@@ -1532,7 +1532,7 @@
// host resolv.conf before updating container's resolv.conf copies
// replace resolv.conf with a localhost-only nameserver copy
- if err = os.WriteFile("/etc/resolv.conf", tmpLocalhostResolvConf, 0644); err != nil {
+ if err = os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpLocalhostResolvConf, 0644); err != nil {
c.Fatal(err)
}
@@ -1551,7 +1551,7 @@
// of containers' resolv.conf.
// Restore the original resolv.conf
- if err := os.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
c.Fatal(err)
}
@@ -1560,11 +1560,11 @@
containerID3 := getIDByName(c, "third")
// Create a modified resolv.conf.aside and override resolv.conf with it
- if err := os.WriteFile("/etc/resolv.conf.aside", tmpResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf.aside", tmpResolvConf, 0644); err != nil {
c.Fatal(err)
}
- err = os.Rename("/etc/resolv.conf.aside", "/etc/resolv.conf")
+ err = os.Rename("@TERMUX_PREFIX@/etc/resolv.conf.aside", "@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
c.Fatal(err)
}
@@ -1813,7 +1813,7 @@
testRunWriteSpecialFilesAndNotCommit(c, "writehosts", "/etc/hosts")
testRunWriteSpecialFilesAndNotCommit(c, "writehostname", "/etc/hostname")
- testRunWriteSpecialFilesAndNotCommit(c, "writeresolv", "/etc/resolv.conf")
+ testRunWriteSpecialFilesAndNotCommit(c, "writeresolv", "@TERMUX_PREFIX@/etc/resolv.conf")
}
func testRunWriteSpecialFilesAndNotCommit(c *testing.T, name, path string) {
@@ -2153,9 +2153,9 @@
// While Windows supports volumes, it does not support --add-host hence
// this test is not applicable on Windows.
testRequires(c, DaemonIsLinux)
- out, _ := dockerCmd(c, "run", "--dns=127.0.0.1", "-v", "/etc", "busybox", "cat", "/etc/resolv.conf")
+ out, _ := dockerCmd(c, "run", "--dns=127.0.0.1", "-v", "/etc", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf")
if !strings.Contains(out, "nameserver 127.0.0.1") {
- c.Fatal("/etc volume mount hides /etc/resolv.conf")
+ c.Fatal("/etc volume mount hides @TERMUX_PREFIX@/etc/resolv.conf")
}
out, _ = dockerCmd(c, "run", "-h=test123", "-v", "/etc", "busybox", "cat", "/etc/hostname")
@@ -2665,7 +2665,7 @@
if root := os.Getenv("DOCKER_REMAP_ROOT"); root != "" {
testPriv = false
}
- testReadOnlyFile(c, testPriv, "/file", "/etc/hosts", "/etc/resolv.conf", "/etc/hostname")
+ testReadOnlyFile(c, testPriv, "/file", "/etc/hosts", "@TERMUX_PREFIX@/etc/resolv.conf", "/etc/hostname")
}
func (s *DockerCLIRunSuite) TestPermissionsPtsReadonlyRootfs(c *testing.T) {
@@ -2723,9 +2723,9 @@
// Not applicable on Windows which does not support either --read-only or --dns.
testRequires(c, DaemonIsLinux, UserNamespaceROMount)
- out, _ := dockerCmd(c, "run", "--read-only", "--dns", "1.1.1.1", "busybox", "/bin/cat", "/etc/resolv.conf")
+ out, _ := dockerCmd(c, "run", "--read-only", "--dns", "1.1.1.1", "busybox", "/bin/cat", "@TERMUX_PREFIX@/etc/resolv.conf")
if !strings.Contains(out, "1.1.1.1") {
- c.Fatal("Expected /etc/resolv.conf to be updated even if --read-only enabled and --dns flag used")
+ c.Fatal("Expected @TERMUX_PREFIX@/etc/resolv.conf to be updated even if --read-only enabled and --dns flag used")
}
}
@@ -3059,7 +3059,7 @@
c.Fatalf("error modifying permissions of %s: %v", filename, err)
}
- nwfiles := []string{"/etc/resolv.conf", "/etc/hosts", "/etc/hostname"}
+ nwfiles := []string{"@TERMUX_PREFIX@/etc/resolv.conf", "/etc/hosts", "/etc/hostname"}
for i := range nwfiles {
actual, _ := dockerCmd(c, "run", "-v", filename+":"+nwfiles[i], "busybox", "cat", nwfiles[i])
@@ -3081,7 +3081,7 @@
c.Fatalf("error modifying permissions of %s: %v", filename, err)
}
- nwfiles := []string{"/etc/resolv.conf", "/etc/hosts", "/etc/hostname"}
+ nwfiles := []string{"@TERMUX_PREFIX@/etc/resolv.conf", "/etc/hosts", "/etc/hostname"}
for i := range nwfiles {
_, exitCode, err := dockerCmdWithError("run", "-v", filename+":"+nwfiles[i]+":ro", "busybox", "touch", nwfiles[i])
@@ -3103,7 +3103,7 @@
c.Fatalf("error modifying permissions of %s: %v", filename, err)
}
- nwfiles := []string{"/etc/resolv.conf", "/etc/hosts", "/etc/hostname"}
+ nwfiles := []string{"@TERMUX_PREFIX@/etc/resolv.conf", "/etc/hosts", "/etc/hostname"}
for i := range nwfiles {
_, exitCode := dockerCmd(c, "run", "-v", filename+":"+nwfiles[i], "--read-only", "busybox", "touch", nwfiles[i])
@@ -3891,30 +3891,30 @@
expectedOutput := "nameserver 127.0.0.1"
expectedWarning := "Localhost DNS setting"
- cli.DockerCmd(c, "run", "--dns=127.0.0.1", "--net=host", "busybox", "cat", "/etc/resolv.conf").Assert(c, icmd.Expected{
+ cli.DockerCmd(c, "run", "--dns=127.0.0.1", "--net=host", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf").Assert(c, icmd.Expected{
Out: expectedOutput,
Err: expectedWarning,
})
expectedOutput = "nameserver 1.2.3.4"
- cli.DockerCmd(c, "run", "--dns=1.2.3.4", "--net=host", "busybox", "cat", "/etc/resolv.conf").Assert(c, icmd.Expected{
+ cli.DockerCmd(c, "run", "--dns=1.2.3.4", "--net=host", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf").Assert(c, icmd.Expected{
Out: expectedOutput,
})
expectedOutput = "search example.com"
- cli.DockerCmd(c, "run", "--dns-search=example.com", "--net=host", "busybox", "cat", "/etc/resolv.conf").Assert(c, icmd.Expected{
+ cli.DockerCmd(c, "run", "--dns-search=example.com", "--net=host", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf").Assert(c, icmd.Expected{
Out: expectedOutput,
})
expectedOutput = "options timeout:3"
- cli.DockerCmd(c, "run", "--dns-opt=timeout:3", "--net=host", "busybox", "cat", "/etc/resolv.conf").Assert(c, icmd.Expected{
+ cli.DockerCmd(c, "run", "--dns-opt=timeout:3", "--net=host", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf").Assert(c, icmd.Expected{
Out: expectedOutput,
})
expectedOutput1 := "nameserver 1.2.3.4"
expectedOutput2 := "search example.com"
expectedOutput3 := "options timeout:3"
- out := cli.DockerCmd(c, "run", "--dns=1.2.3.4", "--dns-search=example.com", "--dns-opt=timeout:3", "--net=host", "busybox", "cat", "/etc/resolv.conf").Combined()
+ out := cli.DockerCmd(c, "run", "--dns=1.2.3.4", "--dns-search=example.com", "--dns-opt=timeout:3", "--net=host", "busybox", "cat", "@TERMUX_PREFIX@/etc/resolv.conf").Combined()
assert.Assert(c, strings.Contains(out, expectedOutput1), "Expected '%s', but got %q", expectedOutput1, out)
assert.Assert(c, strings.Contains(out, expectedOutput2), "Expected '%s', but got %q", expectedOutput2, out)
assert.Assert(c, strings.Contains(out, expectedOutput3), "Expected '%s', but got %q", expectedOutput3, out)
diff -ur ../src.orig/moby/integration-cli/docker_cli_swarm_test.go ./moby/integration-cli/docker_cli_swarm_test.go
--- ../src.orig/moby/integration-cli/docker_cli_swarm_test.go 2023-10-15 10:26:02.758011348 +0000
+++ ./moby/integration-cli/docker_cli_swarm_test.go 2023-10-15 10:27:36.251675521 +0000
@@ -944,7 +944,7 @@
expectedOutput1 := "nameserver 1.2.3.4"
expectedOutput2 := "search example.com"
expectedOutput3 := "options timeout:3"
- out, err = d.Cmd("exec", id, "cat", "/etc/resolv.conf")
+ out, err = d.Cmd("exec", id, "cat", "@TERMUX_PREFIX@/etc/resolv.conf")
assert.NilError(c, err, out)
assert.Assert(c, strings.Contains(out, expectedOutput1), "Expected '%s', but got %q", expectedOutput1, out)
assert.Assert(c, strings.Contains(out, expectedOutput2), "Expected '%s', but got %q", expectedOutput2, out)
diff -ur ../src.orig/moby/libnetwork/libnetwork_linux_test.go ./moby/libnetwork/libnetwork_linux_test.go
--- ../src.orig/moby/libnetwork/libnetwork_linux_test.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/libnetwork/libnetwork_linux_test.go 2023-10-15 10:27:36.148341825 +0000
@@ -558,13 +558,13 @@
tmpResolvConf := []byte("search pommesfrites.fr\nnameserver 12.34.56.78\nnameserver 2001:4860:4860::8888\n")
expectedResolvConf := []byte("search pommesfrites.fr\nnameserver 127.0.0.11\nnameserver 2001:4860:4860::8888\noptions ndots:0\n")
// take a copy of resolv.conf for restoring after test completes
- resolvConfSystem, err := os.ReadFile("/etc/resolv.conf")
+ resolvConfSystem, err := os.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
t.Fatal(err)
}
// cleanup
defer func() {
- if err := os.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
t.Fatal(err)
}
}()
@@ -592,7 +592,7 @@
t.Fatal(err)
}
- if err := os.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
t.Fatal(err)
}
@@ -635,13 +635,13 @@
tmpResolvConf := []byte("search localhost.net\nnameserver 127.0.0.1\nnameserver 2001:4860:4860::8888\n")
// take a copy of resolv.conf for restoring after test completes
- resolvConfSystem, err := os.ReadFile("/etc/resolv.conf")
+ resolvConfSystem, err := os.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
t.Fatal(err)
}
// cleanup
defer func() {
- if err := os.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
t.Fatal(err)
}
}()
@@ -652,7 +652,7 @@
t.Fatal(err)
}
- if err := os.WriteFile("/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf, 0644); err != nil {
t.Fatal(err)
}
@@ -662,7 +662,7 @@
sb, err := controller.NewSandbox(containerID,
libnetwork.OptionUseDefaultSandbox(),
libnetwork.OptionResolvConfPath(resolvConfPath),
- libnetwork.OptionOriginResolvConfPath("/etc/resolv.conf"))
+ libnetwork.OptionOriginResolvConfPath("@TERMUX_PREFIX@/etc/resolv.conf"))
if err != nil {
t.Fatal(err)
}
@@ -713,13 +713,13 @@
tmpResolvConf3 := []byte("search pommesfrites.fr\nnameserver 113.34.56.78\n")
// take a copy of resolv.conf for restoring after test completes
- resolvConfSystem, err := os.ReadFile("/etc/resolv.conf")
+ resolvConfSystem, err := os.ReadFile("@TERMUX_PREFIX@/etc/resolv.conf")
if err != nil {
t.Fatal(err)
}
// cleanup
defer func() {
- if err := os.WriteFile("/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", resolvConfSystem, 0644); err != nil {
t.Fatal(err)
}
}()
@@ -744,7 +744,7 @@
t.Fatal(err)
}
- if err := os.WriteFile("/etc/resolv.conf", tmpResolvConf1, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf1, 0644); err != nil {
t.Fatal(err)
}
@@ -791,7 +791,7 @@
t.Fatal(err)
}
- if err := os.WriteFile("/etc/resolv.conf", tmpResolvConf2, 0644); err != nil {
+ if err := os.WriteFile("@TERMUX_PREFIX@/etc/resolv.conf", tmpResolvConf2, 0644); err != nil {
t.Fatal(err)
}
diff -ur ../src.orig/moby/libnetwork/netutils/utils_linux.go ./moby/libnetwork/netutils/utils_linux.go
--- ../src.orig/moby/libnetwork/netutils/utils_linux.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/libnetwork/netutils/utils_linux.go 2023-10-15 10:27:36.148341825 +0000
@@ -64,7 +64,7 @@
// overlap with existing interfaces in the system
func FindAvailableNetwork(list []*net.IPNet) (*net.IPNet, error) {
// We don't check for an error here, because we don't really care if we
- // can't read /etc/resolv.conf. So instead we skip the append if resolvConf
+ // can't read @TERMUX_PREFIX@/etc/resolv.conf. So instead we skip the append if resolvConf
// is nil. It either doesn't exist, or we can't read it for some reason.
var nameservers []string
if rc, err := os.ReadFile(resolvconf.Path()); err == nil {
diff -ur ../src.orig/moby/libnetwork/resolvconf/resolvconf.go ./moby/libnetwork/resolvconf/resolvconf.go
--- ../src.orig/moby/libnetwork/resolvconf/resolvconf.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/libnetwork/resolvconf/resolvconf.go 2023-10-15 10:27:36.141675134 +0000
@@ -1,4 +1,4 @@
-// Package resolvconf provides utility code to query and update DNS configuration in /etc/resolv.conf
+// Package resolvconf provides utility code to query and update DNS configuration in @TERMUX_PREFIX@/etc/resolv.conf
package resolvconf
import (
@@ -13,7 +13,7 @@
const (
// defaultPath is the default path to the resolv.conf that contains information to resolve DNS. See Path().
- defaultPath = "/etc/resolv.conf"
+ defaultPath = "@TERMUX_PREFIX@/etc/resolv.conf"
// alternatePath is a path different from defaultPath, that may be used to resolve DNS. See Path().
alternatePath = "/run/systemd/resolve/resolv.conf"
)
@@ -32,15 +32,15 @@
// Path returns the path to the resolv.conf file that libnetwork should use.
//
-// When /etc/resolv.conf contains 127.0.0.53 as the only nameserver, then
+// When @TERMUX_PREFIX@/etc/resolv.conf contains 127.0.0.53 as the only nameserver, then
// it is assumed systemd-resolved manages DNS. Because inside the container 127.0.0.53
// is not a valid DNS server, Path() returns /run/systemd/resolve/resolv.conf
// which is the resolv.conf that systemd-resolved generates and manages.
-// Otherwise Path() returns /etc/resolv.conf.
+// Otherwise Path() returns @TERMUX_PREFIX@/etc/resolv.conf.
//
// Errors are silenced as they will inevitably resurface at future open/read calls.
//
-// More information at https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html#/etc/resolv.conf
+// More information at https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html#@TERMUX_PREFIX@/etc/resolv.conf
func Path() string {
detectSystemdResolvConfOnce.Do(func() {
candidateResolvConf, err := os.ReadFile(defaultPath)
@@ -91,7 +91,7 @@
Hash []byte
}
-// Get returns the contents of /etc/resolv.conf and its hash
+// Get returns the contents of @TERMUX_PREFIX@/etc/resolv.conf and its hash
func Get() (*File, error) {
return GetSpecific(Path())
}
@@ -146,7 +146,7 @@
return output
}
-// GetNameservers returns nameservers (if any) listed in /etc/resolv.conf
+// GetNameservers returns nameservers (if any) listed in @TERMUX_PREFIX@/etc/resolv.conf
func GetNameservers(resolvConf []byte, kind int) []string {
var nameservers []string
for _, line := range getLines(resolvConf, []byte("#")) {
@@ -166,7 +166,7 @@
}
// GetNameserversAsCIDR returns nameservers (if any) listed in
-// /etc/resolv.conf as CIDR blocks (e.g., "1.2.3.4/32")
+// @TERMUX_PREFIX@/etc/resolv.conf as CIDR blocks (e.g., "1.2.3.4/32")
// This function's output is intended for net.ParseCIDR
func GetNameserversAsCIDR(resolvConf []byte) []string {
var nameservers []string
@@ -183,7 +183,7 @@
return nameservers
}
-// GetSearchDomains returns search domains (if any) listed in /etc/resolv.conf
+// GetSearchDomains returns search domains (if any) listed in @TERMUX_PREFIX@/etc/resolv.conf
// If more than one search line is encountered, only the contents of the last
// one is returned.
func GetSearchDomains(resolvConf []byte) []string {
@@ -198,7 +198,7 @@
return domains
}
-// GetOptions returns options (if any) listed in /etc/resolv.conf
+// GetOptions returns options (if any) listed in @TERMUX_PREFIX@/etc/resolv.conf
// If more than one options line is encountered, only the contents of the last
// one is returned.
func GetOptions(resolvConf []byte) []string {
diff -ur ../src.orig/moby/libnetwork/sandbox_dns_unix.go ./moby/libnetwork/sandbox_dns_unix.go
--- ../src.orig/moby/libnetwork/sandbox_dns_unix.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/libnetwork/sandbox_dns_unix.go 2023-10-15 10:27:36.148341825 +0000
@@ -232,7 +232,7 @@
if !os.IsNotExist(err) {
return err
}
- // No /etc/resolv.conf found: we'll use the default resolvers (Google's Public DNS).
+ // No @TERMUX_PREFIX@/etc/resolv.conf found: we'll use the default resolvers (Google's Public DNS).
logrus.WithField("path", originResolvConfPath).Infof("no resolv.conf found, falling back to defaults")
}
diff -ur ../src.orig/moby/libnetwork/sandbox.go ./moby/libnetwork/sandbox.go
--- ../src.orig/moby/libnetwork/sandbox.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/libnetwork/sandbox.go 2023-10-15 10:27:36.145008480 +0000
@@ -79,7 +79,7 @@
IP string
}
-// These are the container configs used to customize container /etc/resolv.conf file.
+// These are the container configs used to customize container @TERMUX_PREFIX@/etc/resolv.conf file.
type resolvConfPathConfig struct {
resolvConfPath string
originResolvConfPath string
diff -ur ../src.orig/moby/plugin/v2/plugin_linux.go ./moby/plugin/v2/plugin_linux.go
--- ../src.orig/moby/plugin/v2/plugin_linux.go 2023-10-15 10:26:02.764678039 +0000
+++ ./moby/plugin/v2/plugin_linux.go 2023-10-15 10:27:35.285005456 +0000
@@ -50,12 +50,12 @@
})
if p.PluginObj.Config.Network.Type != "" {
- // TODO: if net == bridge, use libnetwork controller to create a new plugin-specific bridge, bind mount /etc/hosts and /etc/resolv.conf look at the docker code (allocateNetwork, initialize)
+ // TODO: if net == bridge, use libnetwork controller to create a new plugin-specific bridge, bind mount /etc/hosts and @TERMUX_PREFIX@/etc/resolv.conf look at the docker code (allocateNetwork, initialize)
if p.PluginObj.Config.Network.Type == "host" {
oci.RemoveNamespace(&s, specs.LinuxNamespaceType("network"))
}
etcHosts := "/etc/hosts"
- resolvConf := "/etc/resolv.conf"
+ resolvConf := "@TERMUX_PREFIX@/etc/resolv.conf"
mounts = append(mounts,
types.PluginMount{
Source: &etcHosts,
diff -ur ../src.orig/moby/vendor/github.com/containerd/containerd/oci/spec_opts.go ./moby/vendor/github.com/containerd/containerd/oci/spec_opts.go
--- ../src.orig/moby/vendor/github.com/containerd/containerd/oci/spec_opts.go 2023-10-15 10:26:02.768011385 +0000
+++ ./moby/vendor/github.com/containerd/containerd/oci/spec_opts.go 2023-10-15 10:27:35.995007952 +0000
@@ -505,12 +505,12 @@
return nil
}
-// WithHostResolvconf bind-mounts the host's /etc/resolv.conf into the container as readonly
+// WithHostResolvconf bind-mounts the host's @TERMUX_PREFIX@/etc/resolv.conf into the container as readonly
func WithHostResolvconf(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
s.Mounts = append(s.Mounts, specs.Mount{
- Destination: "/etc/resolv.conf",
+ Destination: "@TERMUX_PREFIX@/etc/resolv.conf",
Type: "bind",
- Source: "/etc/resolv.conf",
+ Source: "@TERMUX_PREFIX@/etc/resolv.conf",
Options: []string{"rbind", "ro"},
})
return nil
diff -ur ../src.orig/moby/vendor/github.com/containerd/containerd/rootfs/init_linux.go ./moby/vendor/github.com/containerd/containerd/rootfs/init_linux.go
--- ../src.orig/moby/vendor/github.com/containerd/containerd/rootfs/init_linux.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/vendor/github.com/containerd/containerd/rootfs/init_linux.go 2023-10-15 10:27:35.961674502 +0000
@@ -114,7 +114,7 @@
createDirectory("/proc", uid, gid),
createDirectory("/sys", uid, gid),
createDirectory("/etc", uid, gid),
- touchFile("/etc/resolv.conf", uid, gid),
+ touchFile("@TERMUX_PREFIX@/etc/resolv.conf", uid, gid),
touchFile("/etc/hosts", uid, gid),
touchFile("/etc/hostname", uid, gid),
symlink("/proc/mounts", "/etc/mtab"),
diff -ur ../src.orig/moby/vendor/github.com/hashicorp/memberlist/config.go ./moby/vendor/github.com/hashicorp/memberlist/config.go
--- ../src.orig/moby/vendor/github.com/hashicorp/memberlist/config.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/vendor/github.com/hashicorp/memberlist/config.go 2023-10-15 10:27:35.821674009 +0000
@@ -209,7 +209,7 @@
Alive AliveDelegate
// DNSConfigPath points to the system's DNS config file, usually located
- // at /etc/resolv.conf. It can be overridden via config for easier testing.
+ // at @TERMUX_PREFIX@/etc/resolv.conf. It can be overridden via config for easier testing.
DNSConfigPath string
// LogOutput is the writer where logs should be sent. If this is not
@@ -317,7 +317,7 @@
SecretKey: nil,
Keyring: nil,
- DNSConfigPath: "/etc/resolv.conf",
+ DNSConfigPath: "@TERMUX_PREFIX@/etc/resolv.conf",
HandoffQueueDepth: 1024,
UDPBufferSize: 1400,
diff -ur ../src.orig/moby/vendor/github.com/miekg/dns/clientconfig.go ./moby/vendor/github.com/miekg/dns/clientconfig.go
--- ../src.orig/moby/vendor/github.com/miekg/dns/clientconfig.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/vendor/github.com/miekg/dns/clientconfig.go 2023-10-15 10:27:36.031674748 +0000
@@ -8,7 +8,7 @@
"strings"
)
-// ClientConfig wraps the contents of the /etc/resolv.conf file.
+// ClientConfig wraps the contents of the @TERMUX_PREFIX@/etc/resolv.conf file.
type ClientConfig struct {
Servers []string // servers to use
Search []string // suffixes to append to local name
diff -ur ../src.orig/moby/vendor/github.com/moby/buildkit/executor/oci/spec_unix.go ./moby/vendor/github.com/moby/buildkit/executor/oci/spec_unix.go
--- ../src.orig/moby/vendor/github.com/moby/buildkit/executor/oci/spec_unix.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/vendor/github.com/moby/buildkit/executor/oci/spec_unix.go 2023-10-15 10:27:35.918341016 +0000
@@ -25,7 +25,7 @@
return []oci.SpecOpts{
// https://github.com/moby/buildkit/issues/429
withRemovedMount("/run"),
- withROBind(resolvConf, "/etc/resolv.conf"),
+ withROBind(resolvConf, "@TERMUX_PREFIX@/etc/resolv.conf"),
withROBind(hostsFile, "/etc/hosts"),
withCGroup(),
}, nil
diff -ur ../src.orig/moby/vendor/github.com/moby/buildkit/executor/stubs.go ./moby/vendor/github.com/moby/buildkit/executor/stubs.go
--- ../src.orig/moby/vendor/github.com/moby/buildkit/executor/stubs.go 2023-08-29 19:14:17.000000000 +0000
+++ ./moby/vendor/github.com/moby/buildkit/executor/stubs.go 2023-10-15 10:27:35.918341016 +0000
@@ -12,7 +12,7 @@
)
func MountStubsCleaner(dir string, mounts []Mount, recursive bool) func() {
- names := []string{"/etc/resolv.conf", "/etc/hosts"}
+ names := []string{"@TERMUX_PREFIX@/etc/resolv.conf", "/etc/hosts"}
for _, m := range mounts {
names = append(names, m.Dest)