golang/go

cmd/go: TestScript/get_brace: path "$WORK/tmp/ssh-wwIxCtBYvdEE/agent.13077" too long for Unix domain socket

pborman opened this issue · 6 comments

What version of Go are you using (go version)?

$ go version
go version devel +759309029f Mon Jan 11 19:45:02 2021 +0000 darwin/arm64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

Mac mini (M1, 2020)
Chip Apple M1
Memory 8GB
go env Output
$ go env
GOARCH="arm64"
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOOS="darwin"

What did you do?

Pulled latest version of go and built using ./all.bash on an Apple Silicon Mac mini

What did you expect to see?

ALL TESTS PASSED
---
Installed Go for darwin/arm64 in /usr/local/go
Installed commands in /usr/local/go/bin

What did you see instead?

go test proxy running at GOPROXY=http://127.0.0.1:52360/mod
--- FAIL: TestScript (0.01s)
    --- FAIL: TestScript/get_brace (0.05s)
        script_test.go:213: 
            # Set up some empty repositories. (0.043s)
            > cd $WORK/_origin/foo
            $WORK/_origin/foo
            > exec git init
            [stderr]
            unix_listener: path "$WORK/tmp/ssh-UAy2f7A6xFNs/agent.53483" too long for Unix domain socket
            [exit status 1]
            FAIL: testdata/script/get_brace.txt:7: unexpected command failure
...

FAIL
go tool dist: Failed: exit status 1

The path being used is 138 bytes long:

/var/folders/nv/mw87lzt57nbbmpnpv5rvchj40000gn/T/cmd-go-test-2243202799/tmpdir3895905378/script-get_brace/tmp/ssh-UAy2f7A6xFNs/agent.53483

From the UNIX(4) manual page on MacOS says:

UNIX-domain addresses are variable-length filesystem pathnames of at most 104 characters.

On Linux the same manual page says:

The sun_family field always contains AF_UNIX. On Linux sun_path is 108 bytes in size; see also NOTES, below.

The value of TMPDIR is /var/folders/nv/mw87lzt57nbbmpnpv5rvchj40000gn/T. The part that Go is adding is 90 bytes long.

Building using the following:

$ TMPDIR=/tmp ./all.bash

Does work.

This test's multiple levels of unique temporary directories seems a bit excessive.

Couldn't reproduce on darwin/arm64 or amd64. It doesn't look like it's happening in CI either. But the cause seems straightforward, and we could shorten the TMPDIR set in those tests.

cc @matloob

Have you tried it on MacOS directly? Did. you examine what your TMPDIR variable was set to? MacOS sets this variable apparently as part of its login process. I have verified this with a new account on MacOS. This is not new in MacOS 11, this also gets set on MacOS 10.15 (I checked) and as far back as I remember. I assume it will be reproducible on Intel Macs as well. This issue is new for Go, however. I built a Go toolchain when I first got my Mac mini and did not have this issue.

Note that the Go appended part is within 14 bytes of being too long itself. Setting TMPDIR to /tmp is a good initial fix but eventually it should be looked into if you really need 3 additional levels of tmp directories or not.

Anyhow, thank you for looking into it and that you will take action so I don't have to remember to set it each time :-)

Shorter temp directories would probably also help with #46692.

@pborman, it isn't clear to me why git init in that test would be trying to create a Unix domain socket in the first place. From what I understand it mainly uses Unix domain sockets to communicate with credential helpers, but the script test shouldn't be using a credential helper (because its configuration should be isolated from the user's configuration).

Any idea where it might be picking that up?

Timed out in state WaitingForInfo. Closing.

(I am just a bot, though. Please speak up if this is a mistake or you have the requested information.)