Skip to content

sockets: improve abstract Unix socket handling - #162

Merged
thaJeztah merged 1 commit into
docker:mainfrom
thaJeztah:abstract_sockets
Jul 24, 2026
Merged

sockets: improve abstract Unix socket handling#162
thaJeztah merged 1 commit into
docker:mainfrom
thaJeztah:abstract_sockets

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Jul 24, 2026

Copy link
Copy Markdown
Member

sockets: improve abstract Unix socket handling

Improve handling of abstract Unix socket addresses across platforms.

On Linux, abstract sockets are supported but do not have a filesystem
representation, so filesystem-specific operations such as unlinking an
existing socket or applying ownership and permissions are skipped or
rejected as appropriate.

On platforms without abstract socket support, attempts to create an
abstract socket now fail with a clear unsupported error instead of
falling through to platform-specific failures.

Add regression tests covering abstract socket behavior, including both
Go's Linux-specific "@" shorthand and the native leading-NUL
representation. The tests verify the expected behavior on supported and
unsupported platforms and guard against regressions in permission
handling.

The new tests verify that abstract sockets:

  • can be created and used like regular Unix sockets;
  • do not create a filesystem entry while the listener is active; and
  • do not leave a filesystem entry behind after the listener is closed.

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@thaJeztah
thaJeztah force-pushed the abstract_sockets branch 4 times, most recently from b41a60d to c5a78d5 Compare July 24, 2026 16:33
@thaJeztah thaJeztah changed the title sockets: add abstract Unix socket tests sockets: improve abstract Unix socket handling Jul 24, 2026
@thaJeztah
thaJeztah force-pushed the abstract_sockets branch 2 times, most recently from 528c083 to f8a57bb Compare July 24, 2026 17:16
@thaJeztah
thaJeztah marked this pull request as ready for review July 24, 2026 17:18
Comment thread sockets/unix_socket_unix.go Outdated
return func(path string) error {
if isAbstractSocket(path) {
return &os.PathError{
Op: "chmod",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Op: "chmod",
Op: "chown",

?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh! copy/pasta; fixed

Improve handling of abstract Unix socket addresses across platforms.

On Linux, abstract sockets are supported but do not have a filesystem
representation, so filesystem-specific operations such as unlinking an
existing socket or applying ownership and permissions are skipped or
rejected as appropriate.

On platforms without abstract socket support, attempts to create an
abstract socket now fail with a clear unsupported error instead of
falling through to platform-specific failures.

Add regression tests covering abstract socket behavior, including both
Go's Linux-specific "@" shorthand and the native leading-NUL
representation. The tests verify the expected behavior on supported and
unsupported platforms and guard against regressions in permission
handling.

The new tests verify that abstract sockets:

- can be created and used like regular Unix sockets;
- do not create a filesystem entry while the listener is active; and
- do not leave a filesystem entry behind after the listener is closed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah
thaJeztah requested a review from vvoland July 24, 2026 17:52
@thaJeztah
thaJeztah merged commit 32c72ec into docker:main Jul 24, 2026
10 checks passed
@thaJeztah
thaJeztah deleted the abstract_sockets branch July 24, 2026 18:08
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.

2 participants