From fdbb9e3e557a9dbbc524a128ac03be18fbeec4e0 Mon Sep 17 00:00:00 2001 From: Danail Branekov Date: Wed, 1 Nov 2017 09:52:05 +0000 Subject: [PATCH] Avoid disk usage explosion when copying busybox When running runc tests with temp directory with size 500M copying busybox without preserving hardlinks causes the folder to inflate to roughly 330M. Copying busybox twice in certain tests causes the /tmp directory to overfill. Using `-a` preserves links which busybox uses to implement its choice of binary to run. Signed-off-by: Tom Godkin --- libcontainer/integration/utils_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcontainer/integration/utils_test.go b/libcontainer/integration/utils_test.go index 74d941352..e209c9bcf 100644 --- a/libcontainer/integration/utils_test.go +++ b/libcontainer/integration/utils_test.go @@ -109,7 +109,7 @@ func remove(dir string) { // copyBusybox copies the rootfs for a busybox container created for the test image // into the new directory for the specific test func copyBusybox(dest string) error { - out, err := exec.Command("sh", "-c", fmt.Sprintf("cp -R /busybox/* %s/", dest)).CombinedOutput() + out, err := exec.Command("sh", "-c", fmt.Sprintf("cp -a /busybox/* %s/", dest)).CombinedOutput() if err != nil { return fmt.Errorf("copy error %q: %q", err, out) }