-
Notifications
You must be signed in to change notification settings - Fork 18k
x/sys/unix: TestGetwd is improperly written #26678
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
Comments
In general there is no protection against this, as Unix does not keep a canonical path for a file. (Shameless plug: See https://9p.io/sys/doc/lexnames.html.) The test could perhaps find a safer solution but sysadmin creativity will eventually defeat it. Maybe use /etc? I don't know. Needs thought. |
A suggestion:
|
Of course one can do that, but that depends on mkdir working, which if you think about it is a far higher bar than checking whether getwd is working. It's like proving the circle's circumference is 2πr using calculus. And the proposed test only tests that it is consistent, not that it is correct. That's a lot of work for almost no information. I'm not saying you're wrong, just that it's not a very good test. It may be hard to do better. |
|
The test is brittle, as discussed, but it can be strengthened by adding more directory test targets, then examining each one in the testing loop and skipping any that don't exist or contain symbolic links. I have revised test code that does this. |
Change https://golang.org/cl/147777 mentions this issue: |
Second try in the correct repo. I'll check the previous gerrit comments again to see if I addressed the feedback completely. golang/sys#22 |
Change https://golang.org/cl/148537 mentions this issue: |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?1.11beta2
Does this issue reproduce with the latest release?
unsure
What operating system and processor architecture are you using (
go env
)?freebsd/amd64
What did you do?
ran
bash all.bash
in the src sub-directory (building from the git repo)What did you expect to see?
all tests succeeded
What did you see instead?
Extra information: on my machine
/usr
is a symlink to/data/usr
. This is pretty common on unix systems with multiple filesystems. The test should not be sensitive to this.The text was updated successfully, but these errors were encountered: