From 6d7afcd1ff4e6db0c07c3fd2ec8fe2798e526ae2 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 24 Sep 2015 16:17:58 -0700 Subject: [PATCH] Skip non-regular files in embedding and comment on the chrootEnv map --- client/allocdir/alloc_dir.go | 5 ++--- client/executor/exec_linux.go | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/allocdir/alloc_dir.go b/client/allocdir/alloc_dir.go index ac03f6efa..c23c67194 100644 --- a/client/allocdir/alloc_dir.go +++ b/client/allocdir/alloc_dir.go @@ -144,10 +144,9 @@ func (d *AllocDir) Embed(task string, dirs map[string]string) error { subdirs[hostEntry] = filepath.Join(dest, filepath.Base(hostEntry)) continue } else if !entry.Mode().IsRegular() { - // If it is a symlink we can create it, otherwise it is an - // error. + // If it is a symlink we can create it, otherwise we skip it. if entry.Mode()&os.ModeSymlink == 0 { - return fmt.Errorf("Can't embed non-regular file (%v): %v", entry.Mode().String(), hostEntry) + continue } link, err := os.Readlink(hostEntry) diff --git a/client/executor/exec_linux.go b/client/executor/exec_linux.go index 3f68ccfa8..e762b056d 100644 --- a/client/executor/exec_linux.go +++ b/client/executor/exec_linux.go @@ -29,6 +29,8 @@ const ( ) var ( + // A mapping of directories on the host OS to attempt to embed inside each + // task's chroot. chrootEnv = map[string]string{ "/bin": "/bin", "/etc": "/etc",