apple / apple/container

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

Open Beginner friendly
#2,133 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
49.9k
Forks
1.8k
Avg merge
1d 20h
Merged PRs (30d)
22

Description

### I have done the following

- [x] I have searched the existing issues
- [x] 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

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

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start in Sources/Services/ContainerAPIService/Client/Parser.swift at Parser.publishSocket, then run the reported --publish-socket command to observe the parsing failure. Verify that a host path containing a colon is accepted while the container path remains /var/run/app.sock, and confirm the existing invalid-format behavior still works for malformed input.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
85/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.