diff options
author | Colin Cross <ccross@android.com> | 2018-02-21 14:07:48 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2018-02-21 14:55:34 -0800 |
commit | baccf5b984dad86af5fab06bc43a32f663fc4722 (patch) | |
tree | cd24ac70d218b1b8e2991320f98185761a57be49 /cmd | |
parent | 52226ad920fc848927070561a96a931157764d5b (diff) | |
download | build_soong-baccf5b984dad86af5fab06bc43a32f663fc4722.tar.gz build_soong-baccf5b984dad86af5fab06bc43a32f663fc4722.tar.bz2 build_soong-baccf5b984dad86af5fab06bc43a32f663fc4722.zip |
Use __SBOX_OUT_DIR__ in sbox output file list
The path to the output directory may be arbitrarily long, use
__SBOX_OUT_DIR__ in the list of output files passed to sbox
to avoid expanding it multiple times in the command line.
Fixes:
ninja: fatal: posix_spawn: Argument list too long
09:40:14 ninja failed with: exit status 1
when building libchrome with a long OUT or OUT_DIR_COMMON_BASE.
Bug: 73726635
Test: m checkbuild
Change-Id: I59024b2164287c8e531711afd9273b692ce9c28a
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/sbox/sbox.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/cmd/sbox/sbox.go b/cmd/sbox/sbox.go index 3b41c908..0af18863 100644 --- a/cmd/sbox/sbox.go +++ b/cmd/sbox/sbox.go @@ -136,14 +136,11 @@ func run() error { tempDir, err := ioutil.TempDir(sandboxesRoot, "sbox") - // Rewrite output file paths to be relative to output root - // This facilitates matching them up against the corresponding paths in the temporary directory in case they're absolute for i, filePath := range outputsVarEntries { - relativePath, err := filepath.Rel(outputRoot, filePath) - if err != nil { - return err + if !strings.HasPrefix(filePath, "__SBOX_OUT_DIR__/") { + return fmt.Errorf("output files must start with `__SBOX_OUT_DIR__/`") } - outputsVarEntries[i] = relativePath + outputsVarEntries[i] = strings.TrimPrefix(filePath, "__SBOX_OUT_DIR__/") } allOutputs = append([]string(nil), outputsVarEntries...) |