From 10e564a98e533a8e8da706033d0a17aa9e9be79b Mon Sep 17 00:00:00 2001 From: Diego Wilson Date: Wed, 15 Apr 2020 17:42:59 +0000 Subject: [PATCH] Dereference paths to be mounted into soong sandbox Bind mounts require source paths without symbolic links. Fixes: 153378837 Test: lunch aosp_cf_x86_phone-userdebug && make dist Change-Id: I5c128f94233d81c52ec5692241b711b3e9d15a85 --- ui/build/sandbox_linux.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go index 4c3bac307..98eb028a8 100644 --- a/ui/build/sandbox_linux.go +++ b/ui/build/sandbox_linux.go @@ -19,6 +19,7 @@ import ( "os" "os/exec" "os/user" + "path/filepath" "strings" "sync" ) @@ -75,9 +76,20 @@ func (c *Cmd) sandboxSupported() bool { sandboxConfig.group = "nobody" } + // These directories will be bind mounted + // so we need full non-symlink paths sandboxConfig.srcDir = absPath(c.ctx, ".") + if derefPath, err := filepath.EvalSymlinks(sandboxConfig.srcDir); err == nil { + sandboxConfig.srcDir = absPath(c.ctx, derefPath) + } sandboxConfig.outDir = absPath(c.ctx, c.config.OutDir()) + if derefPath, err := filepath.EvalSymlinks(sandboxConfig.outDir); err == nil { + sandboxConfig.outDir = absPath(c.ctx, derefPath) + } sandboxConfig.distDir = absPath(c.ctx, c.config.DistDir()) + if derefPath, err := filepath.EvalSymlinks(sandboxConfig.distDir); err == nil { + sandboxConfig.distDir = absPath(c.ctx, derefPath) + } sandboxArgs := []string{ "-H", "android-build",