-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
CL 6350 added a syscall.Fixwd
routine to ensure that a Chdir in one goroutine is propagated to other goroutines before the working directory is referenced in a subsequent syscall. This is needed because each M in Plan 9 runs as a separate OS process with its own working directory.
This mechanism turns out to be not quite sufficient to guarantee that Chdir is effectively program wide. It may be frustrated by preemption of a goroutine and rescheduling onto a different M at an inopportune moment.
Circumstantial evidence includes test failures like this with messages like './testdata' file does not exist', and the observation by @psilva261 in the discussion of #57540 that inserting some runtime.LockOSThread
calls around Fixwd
makes "fs related tests ... much more stable".
I've also found that if the os.TestProgWideChdir
test is made slightly more aggressive, it will
sometimes report errors.