Skip to content
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

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

Open
pborman opened this issue Jan 12, 2021 · 3 comments

Comments

@pborman
Copy link
Contributor

@pborman pborman commented Jan 12, 2021

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.

@ianlancetaylor ianlancetaylor changed the title unix_listener: path "$WORK/tmp/ssh-wwIxCtBYvdEE/agent.13077" too long for Unix domain socket cmd/go: TestScript/get_brace: path "$WORK/tmp/ssh-wwIxCtBYvdEE/agent.13077" too long for Unix domain socket Jan 12, 2021
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Jan 12, 2021

@ianlancetaylor ianlancetaylor added this to the Go1.16 milestone Jan 12, 2021
@jayconrod
Copy link
Contributor

@jayconrod jayconrod commented Jan 12, 2021

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

@jayconrod jayconrod modified the milestones: Go1.16, Backlog Jan 12, 2021
@jayconrod jayconrod added the Testing label Jan 12, 2021
@pborman
Copy link
Contributor Author

@pborman pborman commented Jan 12, 2021

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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.