Skip to content

Fix listener parsering regression when no addr set#45132

Merged
neersighted merged 1 commit intomoby:masterfrom
cpuguy83:fix_listener_regression
Mar 10, 2023
Merged

Fix listener parsering regression when no addr set#45132
neersighted merged 1 commit intomoby:masterfrom
cpuguy83:fix_listener_regression

Conversation

@cpuguy83
Copy link
Copy Markdown
Member

@cpuguy83 cpuguy83 commented Mar 9, 2023

5008409 introduced the usage of strings.Cut to help parse listener addresses.
Part of that also made it error out if no addr is specified after the protocol spec (e.g. tcp://).

Before the change a proto spec without an address just used the default address for that proto.
e.g. tcp:// would be tcp://127.0.0.1:2375, unix:// would be unix:///var/run/docker.sock.
Critically, socket activation (fd://) never has an address.

This change brings back the old behavior but keeps the usage of strings.Cut.

Closes #44823

@cpuguy83 cpuguy83 force-pushed the fix_listener_regression branch from 55ddac9 to 6eb33d1 Compare March 9, 2023 23:21
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah
Copy link
Copy Markdown
Member

oh! failure on Windows;

cmd\dockerd\main_test.go:10:18: undefined: testListenerNoAddrCmdPhase1
cmd\dockerd\main_test.go:10:47: undefined: initListenerTestPhase1
cmd\dockerd\main_test.go:11:18: undefined: testListenerNoAddrCmdPhase2
cmd\dockerd\main_test.go:11:47: undefined: initListenerTestPhase2

5008409 introduced the usage of
`strings.Cut` to help parse listener addresses.
Part of that also made it error out if no addr is specified after the
protocol spec (e.g. `tcp://`).

Before the change a proto spec without an address just used the default
address for that proto.
e.g. `tcp://` would be `tcp://127.0.0.1:2375`, `unix://` would be
`unix:///var/run/docker.sock`.
Critically, socket activation (`fd://`) never has an address.

This change brings back the old behavior but keeps the usage of
`strings.Cut`.

Signed-off-by: Brian Goff <[email protected]>
@cpuguy83 cpuguy83 force-pushed the fix_listener_regression branch from 6eb33d1 to 37a9d6a Compare March 9, 2023 23:53
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

still LGTM

@thaJeztah thaJeztah added this to the v-next milestone Mar 10, 2023
@neersighted neersighted merged commit 40ff225 into moby:master Mar 10, 2023
@cpuguy83 cpuguy83 deleted the fix_listener_regression branch March 10, 2023 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants