Skip to content

Convert a leading ~ in host paths to the systemd %h specifier - #228

Open
dualfroz wants to merge 1 commit into
containers:mainfrom
dualfroz:fix-tilde-home-specifier
Open

dualfroz wants to merge 1 commit into
containers:mainfrom
dualfroz:fix-tilde-home-specifier

Conversation

@dualfroz

Copy link
Copy Markdown

systemd does not expand ~, so Volume=~/data:/data from podlet generate gave Podman a relative path and the service failed, and a leading ~ now becomes %h.
This also fixes absolute_clean_path(), which compared path components and so never treated %h/data as absolute.

Closes #166

systemd does not perform shell-style tilde expansion, so a host path
starting with `~/` left in a generated Quadlet file is passed to Podman
as an invalid relative path and the service fails to start. Replace the
leading `~` with the systemd `%h` specifier instead.

Also fix the systemd specifier check in `absolute_clean_path()`, which
used `Path::starts_with()` and therefore only matched a path whose first
component was exactly `%`, causing `--absolute-host-paths` to prepend the
resolve directory to paths such as `%h/data`.

Closes: containers#166

Signed-off-by: DualFroz <me@dualfroz.com>
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.

Bug: podlet generate preserves ~ in paths, causing invalid Quadlet-generated systemd services

1 participant