Skip to content
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

import -c 'CMD...' behavior does not match #4000

Closed
vbatts opened this issue Sep 12, 2019 · 4 comments · Fixed by #4001
Closed

import -c 'CMD...' behavior does not match #4000

vbatts opened this issue Sep 12, 2019 · 4 comments · Fixed by #4001
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@vbatts
Copy link
Collaborator

vbatts commented Sep 12, 2019

/kind bug

Description

comparing the behavior of docker-1.13.1 with podman 1.2.0, the podman import -c 'CMD..' ... behaviour does not match back.
podman is expecting 'CMD=/usr/bin/farts' (the '='), and fails with 'CMD /usr/bin/farts' (the ' '), and fails with brackets 'CMD ["/usr/bin/farts"]'.

[vbatts@knob] {master} ~$ podman import -c 'CMD ["/usr/bin/farts"]' ./farts.tar vbatts/farts
Error: invalid argument "CMD [\"/usr/bin/farts\"]" for "-c, --change" flag: parse error on line 1, column 5: bare " in non-quoted-field
[vbatts@knob] {master} ~$ podman import -c 'CMD /usr/bin/farts' ./farts.tar vbatts/farts
Error: error adding config changes to image "./farts.tar": no value given for instruction "CMD /usr/bin/farts"
[vbatts@knob] {master} ~$ podman import -c 'CMD=/usr/bin/farts' ./farts.tar vbatts/farts
Getting image source signatures
Copying blob 7a230c035746 done
Copying config 66c42e9891 done
Writing manifest to image destination
Storing signatures
66c42e989172c9294213dda7ec4917d285ce6f646f0972b3e4eb7605a65b9dc1

whereas docker-1.13.1 supports ' ' and brackets, but fails with '='.

[vbatts@beats] {master} ~$ docker import -c 'CMD=/usr/bin/farts' ./farts.tar vbatts/farts
Error response from daemon: cmd=/usr/bin/farts is not a valid change command
[vbatts@beats] {master} ~$ docker import -c 'CMD ["/usr/bin/farts"]' ./farts.tar vbatts/farts
sha256:19b84065571402b7844b8866d4cd9d7babf86d350da23338c64ea96446f36b56
[vbatts@beats] {master} ~$ docker import -c 'CMD /usr/bin/farts' ./farts.tar vbatts/farts
sha256:7d6d0a14238fa4ce51c5138537acb95d8c20a6a9f8b54753382a301e00ba59f6

Output of podman version:

Version:            1.2.0
RemoteAPI Version:  1
Go Version:         go1.11.5
Git Commit:         3bd528e583182b4249f3e6bbd8497a8831d89950
Built:              Tue Apr  2 09:59:40 2019
OS/Arch:            linux/amd64

Package info (e.g. output of rpm -q podman or apt list podman):

podman-1.5.1-3.fc29.x86_64
@kunalkushwaha
Copy link
Collaborator

currently, the changes are parsed with = only. https://github.com/containers/libpod/blob/a16f63e96e9993a1e2542b6f5c85903cc4659c6e/pkg/util/utils.go#L92

need to be fixed.

@kunalkushwaha kunalkushwaha self-assigned this Sep 12, 2019
@kunalkushwaha
Copy link
Collaborator

How about supporting all three syntax.

i.e.

--change CMD=/bin/bash

--change CMD /bin/bash

--change CMD ["/bin/bash"]

@vrothberg
Copy link
Member

How about supporting all three syntax.

Good idea. This way we remain backward compatible 👍 @kunalkushwaha, are you interested in working on this?

@kunalkushwaha
Copy link
Collaborator

almost there.. shall make a PR soon.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 23, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants