Skip to content

Brev 8959/fix unix socket len macos#366

Open
abhtripathi wants to merge 2 commits intomainfrom
BREV-8959/fix-unix-socket-len-macos
Open

Brev 8959/fix unix socket len macos#366
abhtripathi wants to merge 2 commits intomainfrom
BREV-8959/fix-unix-socket-len-macos

Conversation

@abhtripathi
Copy link
Copy Markdown

Problem

ControlPath for SSH ControlMaster is a Unix domain socket. The previous format ~/.ssh/brev-control-%r@%h-%p built the path from remote user, host, and port. On long hostnames (e.g. some AWS EC2 names such as ec2-3-90-240-200.compute-1.amazonaws.com), the path could exceed 104 characters—macOS’s limit for Unix socket paths—leading to:

unix_listener: path "..." too long for Unix domain socket

brev shell did not surface this well: it failed with only an SSH exit code and no clear message.

Changes

ControlPath (ssh.go, sshconfigurer.go, sshconfigurer_test.go)

  • Before: ControlPath ~/.ssh/brev-control-%r@%h-%p
  • After: ControlPath ~/.ssh/brev-control-%C

%C is SSH’s 40‑character SHA1 of the connection parameters, so the path no longer depends on hostname length. It remains unique per connection, same as %r@%h-%p, with no other behavior change.

Error handling (pkg/cmd/shell/shell.go)

  • SSH stderr is handled with io.MultiWriter so output still appears on the terminal in real time, while failures can be explained.
  • If the error matches a ControlPath / socket path length problem, the message tells users to run brev refresh so their SSH config is regenerated.
  • For other SSH failures, a short generic hint also points to brev refresh.

Users who have not run brev refresh and still have the old ControlPath in their SSH config will see a clear explanation instead of a silent or opaque failure.

@abhtripathi abhtripathi requested a review from a team as a code owner April 23, 2026 07:12
@abhtripathi abhtripathi marked this pull request as draft April 23, 2026 07:13
@abhtripathi abhtripathi marked this pull request as ready for review April 23, 2026 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant