Skip non-regular files in embedding and comment on the chrootEnv map

This commit is contained in:
Alex Dadgar
2015-09-24 16:17:58 -07:00
parent 66fd821af5
commit 6d7afcd1ff
2 changed files with 4 additions and 3 deletions

View File

@@ -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)

View File

@@ -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",