Skip to content

[Bug]: --publish-socket rejects host paths that contain a colon #2133

Description

@thebenmerlin

I have done the following

  • I have searched the existing issues
  • If possible, I've reproduced the issue using the 'main' branch of this project

Steps to reproduce

--publish-socket takes host_path:container_path. If the host path itself
contains a colon, parsing fails.

container run --publish-socket "/tmp/backup-2026-08-18T10:30:00.sock:/var/run/app.sock" alpine sleep 100

Current output:

Error: invalid publish-socket format /tmp/backup-2026-08-18T10:30:00.sock:/var/run/app.sock. Expected: host_path:container_path

Problem description

The host path in --publish-socket can legitimately contain a colon (for
example a timestamped filename), but the parser splits the argument on
every ':' and only accepts exactly 2 parts. Any host path with more than
one colon is rejected as an "invalid publish-socket format", even though
it's a valid path.

The fix should split on the last colon instead of every colon. The
container-side path is always a plain absolute path, so the last colon is
always the correct split point.

This is the same class of bug already fixed for container cp in #1969 /
#1970 (paths split on every colon instead of the first one), just not
applied to --publish-socket.

Parsing lives in Parser.publishSocket in
Sources/Services/ContainerAPIService/Client/Parser.swift.

Environment

- OS: macOS 26.5.1 (25F80)
- Xcode: Command Line Tools 26.2.0 
- Container: main branch (built from source)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions