MCPcopy
hub / github.com/opencontainers/runc / newRootfs

Function newRootfs

libcontainer/integration/utils_test.go:99–113  ·  view source on GitHub ↗

newRootfs creates a new tmp directory and copies the busybox root filesystem to it.

(t testing.TB)

Source from the content-addressed store, hash-verified

97// newRootfs creates a new tmp directory and copies the busybox root
98// filesystem to it.
99func newRootfs(t testing.TB) string {
100 t.Helper()
101 dir := t.TempDir()
102 if err := copyBusybox(dir); err != nil {
103 t.Fatal(err)
104 }
105
106 // Make sure others can read+exec, so all tests (inside userns too) can
107 // read the rootfs.
108 if err := traversePath(dir); err != nil {
109 t.Fatalf("Error making newRootfs path traversable by others: %v", err)
110 }
111
112 return dir
113}
114
115// traversePath gives read+execute permissions to others for all elements in tPath below
116// os.TempDir() and errors out if elements above it don't have read+exec permissions for others.

Callers 1

newTemplateConfigFunction · 0.85

Calls 2

copyBusyboxFunction · 0.85
traversePathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…