From: Richard Miller Date: Wed, 24 Jan 2018 16:17:05 +0000 (+0000) Subject: os: use the syscall version of Getwd for Plan 9 X-Git-Tag: go1.10rc1~2 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e72e69a3f65232b5b8352259d58a31d30e521efa;p=gostls13.git os: use the syscall version of Getwd for Plan 9 In Plan 9, each OS thread has its own independent working directory, so the Go runtime for Plan 9 needs to coordinate Chdir and Getwd operations to keep the working directory consistent for all goroutines. The function os.Getwd in Plan 9 should always call syscall.Getwd to retrieve the common working directory. Failure to do this was the cause of (at least some of) the intermittent failures in the Plan 9 builders with a seemingly spurious "file does not exist" message, when a thread's working directory had been removed in another thread. Change-Id: Ifb834ad025ee39578234ad3b04d08bc98e939291 Reviewed-on: https://go-review.googlesource.com/89575 Reviewed-by: David du Colombier <0intro@gmail.com> Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot --- diff --git a/src/os/getwd.go b/src/os/getwd.go index 87ad8eb137..6d25466bb4 100644 --- a/src/os/getwd.go +++ b/src/os/getwd.go @@ -24,7 +24,7 @@ var useSyscallwd = func(error) bool { return true } // reached via multiple paths (due to symbolic links), // Getwd may return any one of them. func Getwd() (dir string, err error) { - if runtime.GOOS == "windows" { + if runtime.GOOS == "windows" || runtime.GOOS == "plan9" { return syscall.Getwd() }