The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/346
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) ===
From 797e1813f34ebe0f7713a380fa09958e863dccbe Mon Sep 17 00:00:00 2001 From: Thomas Hipp <thomas.h...@canonical.com> Date: Thu, 18 Jun 2020 13:06:59 +0200 Subject: [PATCH] shared/chroot: Fix parent directory symlink again Signed-off-by: Thomas Hipp <thomas.h...@canonical.com> --- shared/chroot.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/shared/chroot.go b/shared/chroot.go index ff42b0c..263f707 100644 --- a/shared/chroot.go +++ b/shared/chroot.go @@ -92,24 +92,26 @@ func moveMounts(mounts []ChrootMount) error { // If the target's parent directory is a symlink, we need to resolve that as well. targetDir := filepath.Dir(target) - // Get information on current target - fi, err := os.Lstat(targetDir) - if err != nil { - return err - } - - // If a symlink, resolve it - if fi.Mode()&os.ModeSymlink != 0 { - newTarget, err := os.Readlink(targetDir) + if lxd.PathExists(targetDir) { + // Get information on current target + fi, err := os.Lstat(targetDir) if err != nil { return err } - targetDir = newTarget + // If a symlink, resolve it + if fi.Mode()&os.ModeSymlink != 0 { + newTarget, err := os.Readlink(targetDir) + if err != nil { + return err + } + + targetDir = newTarget + } } // Create parent paths if missing - err = os.MkdirAll(targetDir, 0755) + err := os.MkdirAll(targetDir, 0755) if err != nil { return err }
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel