-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression: "unterminated quoted string" using escape sequences in inspect template #13446
Comments
@jwhonce PTAL |
Release candidates of podman v4 are unable to handle escape sequences inside strings. See: containers/podman#13446 Work around this by using the println function instead.
Hi @owtaylor I think this change was intentionally added here containers/common#831 so Your use-case is already documented here in tests: containers/common#831 So something like this should work I'm closing this issue but feel free to re-open. |
OK, dug into this some, and I believe that the situation is:
So we see that the behavior of I can see where the docker behavior where different --format= arguments are treated differently could be considered a bit wonky. But it seems that, for the case of |
I think for consistency I'll also re-open this issue since this needs more clarification. |
A friendly reminder that this issue had no activity for 30 days. |
@flouthoc Lets match docker inspect. |
@rhatdan I was not entirely sure about the above PR and changed seemed intentional hence requested @jwhonce to take a look. |
A friendly reminder that this issue had no activity for 30 days. |
A friendly reminder that this issue had no activity for 30 days. |
A friendly reminder that this issue had no activity for 30 days. |
Docker tries to be smart and replaces \n with the actual newline character. For compat we do the same but this will break formats such as '{{printf "\n"}}' To be backwards compatible with the previous behavior we try to replace and parse the template. If it fails use the original text and parse again. This fix will not be enough. It requires many changes in podman since most commands will do their own NormalizeFormat() call before using this backend which seems wrong and creates a lof of duplication. This has to be fixed in Podman. Required for https://bugzilla.redhat.com/show_bug.cgi?id=2059658 and containers/podman#13446. Signed-off-by: Paul Holzinger <[email protected]>
Docker tries to be smart and replaces \n with the actual newline character. For compat we do the same but this will break formats such as '{{printf "\n"}}' To be backwards compatible with the previous behavior we try to replace and parse the template. If it fails use the original text and parse again. This fix will not be enough. It requires many changes in podman since most commands will do their own NormalizeFormat() call before using this backend which seems wrong and creates a lot of duplication. This has to be fixed in Podman. Required for https://bugzilla.redhat.com/show_bug.cgi?id=2059658 and containers/podman#13446. Signed-off-by: Paul Holzinger <[email protected]>
This includes a fix for the go template parsing to allow `\n` in template strings. Fixes containers#13446 Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2059658 Signed-off-by: Paul Holzinger <[email protected]>
why does this does not work?
|
Because this was fixed in v4.3 |
Thanks for the quick reply - I am still struggling finding out which GitHub Issue actually fixed in which version / tag / branch. |
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Steps to reproduce the issue:
`podman pull registry.access.redhat.com/ubi8'
podman inspect registry.access.redhat.com/ubi8 --format='{{ range .Config.Env }}{{ . }}{{"\n"}}{{ end }}'
Describe the results you received:
Describe the results you expected:
Additional information you deem important (e.g. issue happens only occasionally):
Works fine with "podman version 3.4.4"
The example above isn't minimal -
podman info -f '{{ "hello world\n" }}'
will reproduce too. But showing it as a more realistic example.A workaround is to use
{{ println . }}
instead of{{ . }}{{ "\n" }}
See Unterminated quoted string bug owtaylor/toolbox-vscode#21
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)
Yes
The text was updated successfully, but these errors were encountered: