unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob c631400cbe97db292b136ffd58abc29ebac68b56 4161 bytes (raw)
name: gnu/packages/patches/docker-use-fewer-modprobes.patch 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
 
This patch makes docker find out whether a filesystem type is supported
by trying to mount a filesystem of that type rather than invoking "modprobe".
--- docker-18.09.0-checkout/daemon/graphdriver/overlay/overlay.go.orig	1970-01-01 01:00:00.000000000 +0100
+++ docker-18.09.0-checkout/daemon/graphdriver/overlay/overlay.go	2019-03-19 09:16:03.487087490 +0100
@@ -8,7 +8,6 @@
 	"io"
 	"io/ioutil"
 	"os"
-	"os/exec"
 	"path"
 	"path/filepath"
 	"strconv"
@@ -201,9 +200,16 @@
 }
 
 func supportsOverlay() error {
-	// We can try to modprobe overlay first before looking at
-	// proc/filesystems for when overlay is supported
-	exec.Command("modprobe", "overlay").Run()
+	// Access overlay filesystem so that Linux loads it (if possible).
+	mountTarget, err := ioutil.TempDir("", "supportsOverlay")
+	if err != nil {
+		logrus.WithField("storage-driver", "overlay2").Error("Could not create temporary directory, so assuming that 'overlay' is not supported.")
+		return graphdriver.ErrNotSupported
+	} else {
+		/* The mounting will fail--after the module has been loaded.*/
+		defer os.RemoveAll(mountTarget)
+		unix.Mount("overlay", mountTarget, "overlay", 0, "")
+	}
 
 	f, err := os.Open("/proc/filesystems")
 	if err != nil {
--- docker-18.09.0-checkout/daemon/graphdriver/overlay2/overlay.go.orig	2019-03-18 23:42:23.728525231 +0100
+++ docker-18.09.0-checkout/daemon/graphdriver/overlay2/overlay.go	2019-03-19 08:54:31.411906113 +0100
@@ -10,7 +10,6 @@
 	"io"
 	"io/ioutil"
 	"os"
-	"os/exec"
 	"path"
 	"path/filepath"
 	"strconv"
@@ -261,9 +260,16 @@
 }
 
 func supportsOverlay() error {
-	// We can try to modprobe overlay first before looking at
-	// proc/filesystems for when overlay is supported
-	exec.Command("modprobe", "overlay").Run()
+	// Access overlay filesystem so that Linux loads it (if possible).
+	mountTarget, err := ioutil.TempDir("", "supportsOverlay")
+	if err != nil {
+		logrus.WithField("storage-driver", "overlay2").Error("Could not create temporary directory, so assuming that 'overlay' is not supported.")
+		return graphdriver.ErrNotSupported
+	} else {
+		/* The mounting will fail--after the module has been loaded.*/
+		defer os.RemoveAll(mountTarget)
+		unix.Mount("overlay", mountTarget, "overlay", 0, "")
+	}
 
 	f, err := os.Open("/proc/filesystems")
 	if err != nil {
--- docker-18.09.0-checkout/daemon/graphdriver/devmapper/deviceset.go.orig	2019-03-19 09:19:16.592844887 +0100
+++ docker-18.09.0-checkout/daemon/graphdriver/devmapper/deviceset.go	2019-03-19 09:21:18.019361761 +0100
@@ -540,8 +539,14 @@
 		return err // error text is descriptive enough
 	}
 
-	// Check if kernel supports xfs filesystem or not.
-	exec.Command("modprobe", "xfs").Run()
+        mountTarget, err := ioutil.TempDir("", "supportsOverlay")
+        if err != nil {
+		return errors.Wrapf(err, "error checking for xfs support")
+        } else {
+                /* The mounting will fail--after the module has been loaded.*/
+                defer os.RemoveAll(mountTarget)
+                unix.Mount("none", mountTarget, "xfs", 0, "")
+        }
 
 	f, err := os.Open("/proc/filesystems")
 	if err != nil {
--- docker-18.09.0-checkout/vendor/github.com/docker/libnetwork/iptables/iptables.go.orig	2019-03-19 09:47:19.430111170 +0100
+++ docker-18.09.0-checkout/vendor/github.com/docker/libnetwork/iptables/iptables.go	2019-03-19 10:38:01.445136177 +0100
@@ -72,11 +71,12 @@
 }
 
 func probe() {
-	if out, err := exec.Command("modprobe", "-va", "nf_nat").CombinedOutput(); err != nil {
-		logrus.Warnf("Running modprobe nf_nat failed with message: `%s`, error: %v", strings.TrimSpace(string(out)), err)
+	path, err := exec.LookPath("iptables")
+	if err != nil {
+		return
 	}
-	if out, err := exec.Command("modprobe", "-va", "xt_conntrack").CombinedOutput(); err != nil {
-		logrus.Warnf("Running modprobe xt_conntrack failed with message: `%s`, error: %v", strings.TrimSpace(string(out)), err)
+	if out, err := exec.Command(path, "--wait", "-t", "nat", "-L", "-n").CombinedOutput(); err != nil {
+		logrus.Warnf("Running iptables --wait -t nat -L -n failed with message: `%s`, error: %v", strings.TrimSpace(string(out)), err)
 	}
 }
 

debug log:

solving c631400cb ...
found c631400cb in https://yhetil.org/guix-patches/20190319182053.20524-1-dannym@scratchpost.org/

applying [1/1] https://yhetil.org/guix-patches/20190319182053.20524-1-dannym@scratchpost.org/
diff --git a/gnu/packages/patches/docker-use-fewer-modprobes.patch b/gnu/packages/patches/docker-use-fewer-modprobes.patch
new file mode 100644
index 000000000..c631400cb

1:12: space before tab in indent.
 	"io"
1:13: space before tab in indent.
 	"io/ioutil"
1:14: space before tab in indent.
 	"os"
1:16: space before tab in indent.
 	"path"
1:17: space before tab in indent.
 	"path/filepath"
Checking patch gnu/packages/patches/docker-use-fewer-modprobes.patch...
Applied patch gnu/packages/patches/docker-use-fewer-modprobes.patch cleanly.
warning: squelched 26 whitespace errors
warning: 31 lines add whitespace errors.

index at:
100644 c631400cbe97db292b136ffd58abc29ebac68b56	gnu/packages/patches/docker-use-fewer-modprobes.patch

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).