TestAllDependencies uses t.TempDir to get a temporary directory where the Go tree being tested can be safely copied. t.TempDir uses os.TempDir. If the system temporary directory path involves symlinks, this can cause the test to report a false positive.
This is because one of the checks TestAllDependencies performs (when run without -short flag) is that go generate syscall internal/syscall/... in a copy of the GOROOT directory produces a zero diff. Generating the syscall packages results in the execution of golang.org/x/sys/windows/mkwinsyscall. mkwinsyscall has some logic to determine whether it's being called on a file inside the standard library, but that logic may report incorrect results when the standard library is inside a symlinked directory (this is issue #44079).
In practice, on macOS, the default value of $TMPDIR is a symlink:
$ echo $TMPDIR
/var/folders/zb/5p8cwfhj29gf_m8vdy8ylmlr00jwcj/T/
$ ls -la /var
lrwxr-xr-x@ 1 root admin 11 Dec 10 2019 /var -> private/var
This issue is to investigate if anything can be done to improve this. If it's possible to at least detect this situation, then we can skip the test. Or maybe it's not feasible to do anything, then we can apply the label Unfortunate and close this.
I suspect this can be addressed by either fixing cmd/go to set PWD appropriately for generate subcommands (#43862), or fixing mkwinsyscall to either accept an explicit flag for “is the package in std?” or correctly infer the answer itself (#44079).
TestAllDependencies
usest.TempDir
to get a temporary directory where the Go tree being tested can be safely copied.t.TempDir
usesos.TempDir
. If the system temporary directory path involves symlinks, this can cause the test to report a false positive.This is because one of the checks
TestAllDependencies
performs (when run without -short flag) is thatgo generate syscall internal/syscall/...
in a copy of the GOROOT directory produces a zero diff. Generating the syscall packages results in the execution ofgolang.org/x/sys/windows/mkwinsyscall
.mkwinsyscall
has some logic to determine whether it's being called on a file inside the standard library, but that logic may report incorrect results when the standard library is inside a symlinked directory (this is issue #44079).In practice, on macOS, the default value of
$TMPDIR
is a symlink:This issue is to investigate if anything can be done to improve this. If it's possible to at least detect this situation, then we can skip the test. Or maybe it's not feasible to do anything, then we can apply the label Unfortunate and close this.
CC @bcmills, @ianlancetaylor.
The text was updated successfully, but these errors were encountered: