diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-02-01 14:40:12 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-02-01 14:40:12 +0100 |
commit | 5352df226bc3f345836e78b73063de91d34b4e85 (patch) | |
tree | 4532290710da4bb2d9eb32f7ffe3673d0f5288ac /pkg/systemd/generate/containers.go | |
parent | b045c173756dddcedf6a99a70f520bf423072826 (diff) | |
download | podman-5352df226bc3f345836e78b73063de91d34b4e85.tar.gz podman-5352df226bc3f345836e78b73063de91d34b4e85.tar.bz2 podman-5352df226bc3f345836e78b73063de91d34b4e85.zip |
Fix podman generate systemd --new special char handling
In a systemd unit dollar and percent signs are used for variables. A backslash
is used for escape sequences. If any of these characters are used in the create
command we have to properly escape them so systemd does not try to interpret them.
Fixes #9176
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'pkg/systemd/generate/containers.go')
-rw-r--r-- | pkg/systemd/generate/containers.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/systemd/generate/containers.go b/pkg/systemd/generate/containers.go index 5f52b0a77..abe159812 100644 --- a/pkg/systemd/generate/containers.go +++ b/pkg/systemd/generate/containers.go @@ -204,7 +204,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst startCommand := []string{info.Executable} if index > 2 { // include root flags - info.RootFlags = strings.Join(quoteArguments(info.CreateCommand[1:index-1]), " ") + info.RootFlags = strings.Join(escapeSystemdArguments(info.CreateCommand[1:index-1]), " ") startCommand = append(startCommand, info.CreateCommand[1:index-1]...) } startCommand = append(startCommand, @@ -279,7 +279,7 @@ func executeContainerTemplate(info *containerInfo, options entities.GenerateSyst } } startCommand = append(startCommand, remainingCmd...) - startCommand = quoteArguments(startCommand) + startCommand = escapeSystemdArguments(startCommand) info.ExecStartPre = "/bin/rm -f {{{{.PIDFile}}}} {{{{.ContainerIDFile}}}}" info.ExecStart = strings.Join(startCommand, " ") |