containers / containers/podlet
Bug: podlet generate preserves ~ in paths, causing invalid Quadlet-generated systemd services
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 48
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 1
Description
When using `podlet generate` on a `podman run` command that contains paths starting with `~`, the generated Quadlet (`.container`) file preserves `~` verbatim. When this Quadlet is later processed by the Podman Quadlet generator, the resulting systemd service contains an **invalid relative path**, causing the service to fail at runtime.
Replacing `~` with `%h` resolves the issue.
---
### Environment
- **podlet**: _(version used)_
- **podman**: rootless
- **systemd**: user services
- Target: Quadlet (`.container`) generation
---
### Problem Description
I encountered this issue while using `podlet generate` to convert a working `podman run` command into a Quadlet file.
Example input command:
```bash
podman run \
-v ~/infra/pi-hole/etc-pihole:/etc/pihole:Z \
docker.io/pihole/pihole:latest
```
Generated Quadlet (.container) output:
```ini
[Container]
Volume=~/infra/pi-hole/etc-pihole:/etc/pihole:Z
```
expanded, because systemd does not perform shell-style expansion.
As a result, the generated service passes an invalid relative path to Podman, and the container fails to start.
---
### Expected Behavior
- podlet generate should avoid emitting ~ in generated Quadlet files
- Generated Quadlets should produce valid systemd services without manual editing
---
### Actual Behavior
- ~ is preserved literally in the generated Quadlet
- systemd does not expand ~
- Podman receives an invalid path
- Generated service fails to start
---
### Solution / Workaround
Manually replacing ~ with %h resolves the issue:
```ini
[Container]
Volume=%h/infra/pi-hole/etc-pihole:/etc/pihole:Z
```
### Suggestion
One of the following would prevent this issue:)
1. Translate ~ → %h during podlet generate
2. Emit a warning when ~ is detected in paths
3. Document clearly that ~ is not valid in Quadlet paths
Given that podlet targets systemd/Quadlet output, emitting systemd-compatible paths (%h) seems like the most robust solution.
---
# Contribution Note
If this approach sounds reasonable to the maintainers, I’d be happy to take on this issue and submit a PR.
I can:
- Update `podlet generate` to translate `~` into `%h` for Quadlet-compatible paths, or
- Add validation/warnings when unsupported path expansions are detected, depending on preferred behavior.
Please let me know if you’d like me to proceed and if there are any design or implementation guidelines I should follow.
Contributor guide
Assessment
This issue has not been assessed yet.