Vendor in latest containers/buildah

Fixes issues with builtin volumes having correct ownership and permissions
when doing podman builds.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>

Closes: #1525
Approved by: giuseppe
This commit is contained in:
Daniel J Walsh
2018-09-21 06:45:28 -04:00
committed by Atomic Bot
parent c4b15ce46b
commit 2d1b3e6c30
4 changed files with 13 additions and 4 deletions

View File

@ -506,10 +506,19 @@ func runSetupBuiltinVolumes(mountLabel, mountPoint, containerDir string, copyWit
return nil, errors.Wrapf(err, "error relabeling directory %q for volume %q", volumePath, volume)
}
srcPath := filepath.Join(mountPoint, volume)
stat, err := os.Stat(srcPath)
if err != nil {
return nil, errors.Wrapf(err, "failed to stat %q for volume %q", srcPath, volume)
}
if err = os.Chmod(volumePath, stat.Mode().Perm()); err != nil {
return nil, errors.Wrapf(err, "failed to chmod %q for volume %q", volumePath, volume)
}
if err = os.Chown(volumePath, int(stat.Sys().(*syscall.Stat_t).Uid), int(stat.Sys().(*syscall.Stat_t).Gid)); err != nil {
return nil, errors.Wrapf(err, "error chowning directory %q for volume %q", volumePath, volume)
}
if err = copyWithTar(srcPath, volumePath); err != nil && !os.IsNotExist(err) {
return nil, errors.Wrapf(err, "error populating directory %q for volume %q using contents of %q", volumePath, volume, srcPath)
}
}
// Add the bind mount.
mounts = append(mounts, specs.Mount{