You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running TestProgWideChdir (CL 6382) on Plan 9 leads to a failure
of TestAppend and TestSameFile.
TestAppend and TestSameFile are failing because they are accessing
a file from a relative path, but the current working directory has been
deleted at the end of TestProgWideChdir.
% go test -v -run 'Test(ProgWideChdir|Append|SameFile)'
=== RUN TestProgWideChdir
Chdir /tmp/test401904176
→ getwd /tmp/test401904176
Chdir /usr/go/src/os
→ getwd /usr/go/src/os
Remove /tmp/test401904176
→ getwd /usr/go/src/os
→ Getwd /usr/go/src/os
--- PASS: TestProgWideChdir (0.03s)
=== RUN TestAppend
fixwdLocked
→ getwd err file has been removed
fixwdLocked
→ getwd err file has been removed
Remove append.txt
→ getwd
→ Getwd /usr/go/src/os
--- FAIL: TestAppend (0.01s)
os_test.go:1330: Open: open append.txt: 'append.txt' file has been removed
=== RUN TestSameFile
fixwdLocked getwd err file has been removed
--- FAIL: TestSameFile (0.00s)
os_test.go:1416: Create(a): open a: 'a' file has been removed
FAIL
exit status: 'os.test 631609: 1'
FAIL os 0.095s
At the end of TestProgWideChdir, Chdir is calling chdir to change
the working directory for the current process and set wdStr.
Then the directory is removed.
In TestAppend, it calls Remove, which should fix the working directory.
However, fixwdLocked calls getwd which returns an error, because
the working directory was not yet changed in this process and this
directory was removed.
Running TestProgWideChdir (CL 6382) on Plan 9 leads to a failure
of TestAppend and TestSameFile.
TestAppend and TestSameFile are failing because they are accessing
a file from a relative path, but the current working directory has been
deleted at the end of TestProgWideChdir.
At the end of TestProgWideChdir, Chdir is calling chdir to change
the working directory for the current process and set wdStr.
Then the directory is removed.
In TestAppend, it calls Remove, which should fix the working directory.
However, fixwdLocked calls getwd which returns an error, because
the working directory was not yet changed in this process and this
directory was removed.
https://github.com/golang/go/blob/bc9748ee6b/src/syscall/pwd_plan9.go#L28
Since getwd is returning an error, fixwdLocked returns and never calls
chdir(wdStr) to fix the working directory.
I think we should ignore errors from getwd in fixwdLocked to always
be able to fix the working directory.
The text was updated successfully, but these errors were encountered: