-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: bug369 failing on Plan 9 #9428
Comments
Actually, the path is correct every two
|
When running this program, I can't see any call to syscall.Chdir in Go It works fine when specifying the working directory explicitly
|
I think there's a similar working directory problem with Windows. It'd be good to understand what it happening, but either way, perhaps we should switch to using |
I'd rather understand the problem before hiding from it. |
I don't think we should change this test. It is actually very useful to trigger this particular issue on Plan 9. |
We should probably also add a specific test for this issue once it's understood. |
I'm now able to reproduce this issue with a smaller To reproduce this issue reliably, you need a first program
If you comment
The final working directory in proc1 is either /usr/djc or /sys/src/9/pc. |
I don't see any problems with directory changing on windows:
|
Sorry for the delay. Holidays ... This happens because the runtime on Plan 9 uses distinct Notably, if you call os.Chdir and then the runtime moves https://play.golang.org/p/HPJ_3_82EP To fix this, we'd have to change os.Chdir to notify each (The same problem occurs with with os.Getwd, os.Getpid, and I will fix this but it's not going to be pretty. I'll |
Interesting. Here's a very naive suggestion. Rather than setting the working directory when a goroutine becomes runnable, what if it were set instead at the beginning of every (relevant) syscall? There shouldn't be anything that depends on the cwd, pid, or ppid outside of syscall (right?), and that would keep the change scope limited. |
I was about to reply with the exact same thing. I can only think of a handful of places. We could add a couple new functions to pkg syscall (or an internal/syscall), to set, test, and fix the desired program-wide working directory, protected by a mutex in the syscall package, similar to the ForkLock. |
FWIW, and mostly as a note to myself, I am able to replicate this bug with gomote, even though gomote isn't very polished or easy to use yet:
|
I sent out https://go-review.googlesource.com/6350 which fixes this. |
The test bug369 was enabled as part of change 1774.
It is failing on Plan 9, because the working directory
is changed between two
go tool 8g
calls.The test is run from
/usr/go/test
. When running the test,the working directly is firstly set to
./fixedbugs/bug369.dir
using
os.Chdir
, then it is reset to/usr/go/test
after the firstsuccessfull
go tool 8g
call.The text was updated successfully, but these errors were encountered: