cmd/buildlet: set USER and HOME if unset on the arm5 builder
Fixes golang/go#28041
Change-Id: I5ee13b2278bf7689e2648938a19207cd07cabf27
Reviewed-on: https://go-review.googlesource.com/c/140177
Reviewed-by: Katie Hockman <katie@golang.org>
diff --git a/cmd/buildlet/buildlet.go b/cmd/buildlet/buildlet.go
index 296af9e..6b33546 100644
--- a/cmd/buildlet/buildlet.go
+++ b/cmd/buildlet/buildlet.go
@@ -104,6 +104,8 @@
switch os.Getenv("GO_BUILDER_ENV") {
case "macstadium_vm":
configureMacStadium()
+ case "linux-arm-arm5spacemonkey":
+ initBaseUnixEnv() // Issue 28041
}
onGCE := metadata.OnGCE()
switch runtime.GOOS {
@@ -1740,3 +1742,12 @@
// It is set non-nil on operating systems where the functionality is
// needed & available. Currently we only use it on Linux.
var setWorkdirToTmpfs func()
+
+func initBaseUnixEnv() {
+ if os.Getenv("USER") == "" {
+ os.Setenv("USER", "root")
+ }
+ if os.Getenv("HOME") == "" {
+ os.Setenv("HOME", "/root")
+ }
+}