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

Flag parsing error in non-quoted-field #2574

Closed
EmilienM opened this issue Mar 7, 2019 · 7 comments
Closed

Flag parsing error in non-quoted-field #2574

EmilienM opened this issue Mar 7, 2019 · 7 comments
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

@EmilienM
Copy link
Contributor

EmilienM commented Mar 7, 2019

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description
Flag parsing error in non-quoted-field, regression found in 1.1.2.

Steps to reproduce the issue:

Command used to deploy:

Error running ['podman', 'run', '--name', 'rabbitmq_bootstrap', '--label', 'config_id=tripleo_step1', '--label', 'container_name=rabbitmq_bootstrap', '--label', 'managed_by=paunch', '--label', 'config_data={\"environment\": [\"KOLLA_CONFIG_STRATEGY=COPY_ALWAYS\", \"KOLLA_BOOTSTRAP=True\", \"RABBITMQ_CLUSTER_COOKIE=5v7Ts6vv0FhsGqEYPllP\", \"TRIPLEO_CONFIG_HASH=c641a28ce2c7aa149f10ffc3c12bb5d2\"], \"start_order\": 1, \"volumes\": [\"/etc/hosts:/etc/hosts:ro\", \"/etc/localtime:/etc/localtime:ro\", \"/etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:ro\", \"/etc/pki/ca-trust/source/anchors:/etc/pki/ca-trust/source/anchors:ro\", \"/etc/pki/tls/certs/ca-bundle.crt:/etc/pki/tls/certs/ca-bundle.crt:ro\", \"/etc/pki/tls/certs/ca-bundle.trust.crt:/etc/pki/tls/certs/ca-bundle.trust.crt:ro\", \"/etc/pki/tls/cert.pem:/etc/pki/tls/cert.pem:ro\", \"/dev/log:/dev/log\", \"/etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts:ro\", \"/etc/puppet:/etc/puppet:ro\", \"/var/lib/kolla/config_files/rabbitmq.json:/var/lib/kolla/config_files/config.json:ro\", \"/var/lib/config-data/puppet-generated/rabbitmq/:/var/lib/kolla/config_files/src:ro\", \"/var/lib/rabbitmq:/var/lib/rabbitmq:z\", \"/var/log/containers/rabbitmq:/var/log/rabbitmq:z\"], \"image\": \"docker.io/tripleomaster/centos-binary-rabbitmq:56eedaf13617f1880ce5b1b268db53a774f453c1_a77b7752\", \"detach\": false, \"net\": \"host\", \"privileged\": false}', '--env=KOLLA_CONFIG_STRATEGY=COPY_ALWAYS', '--env=KOLLA_BOOTSTRAP=True', '--env=RABBITMQ_CLUSTER_COOKIE=5v7Ts6vv0FhsGqEYPllP', '--env=TRIPLEO_CONFIG_HASH=c641a28ce2c7aa149f10ffc3c12bb5d2', '--net=host', '--privileged=false', '--volume=/etc/hosts:/etc/hosts:ro', '--volume=/etc/localtime:/etc/localtime:ro', '--volume=/etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:ro', '--volume=/etc/pki/ca-trust/source/anchors:/etc/pki/ca-trust/source/anchors:ro', '--volume=/etc/pki/tls/certs/ca-bundle.crt:/etc/pki/tls/certs/ca-bundle.crt:ro', '--volume=/etc/pki/tls/certs/ca-bundle.trust.crt:/etc/pki/tls/certs/ca-bundle.trust.crt:ro', '--volume=/etc/pki/tls/cert.pem:/etc/pki/tls/cert.pem:ro', '--volume=/dev/log:/dev/log', '--volume=/etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts:ro', '--volume=/etc/puppet:/etc/puppet:ro', '--volume=/var/lib/kolla/config_files/rabbitmq.json:/var/lib/kolla/config_files/config.json:ro', '--volume=/var/lib/config-data/puppet-generated/rabbitmq/:/var/lib/kolla/config_files/src:ro', '--volume=/var/lib/rabbitmq:/var/lib/rabbitmq:z', '--volume=/var/log/containers/rabbitmq:/var/log/rabbitmq:z', 'docker.io/tripleomaster/centos-binary-rabbitmq:56eedaf13617f1880ce5b1b268db53a774f453c1_a77b7752']. [125]",

Describe the results you received:

Error: invalid argument \"config_data={\\\"environment\\\": [\\\"KOLLA_CONFIG_STRATEGY=COPY_ALWAYS\\\", \\\"KOLLA_BOOTSTRAP=True\\\", \\\"RABBITMQ_CLUSTER_COOKIE=5v7Ts6vv0FhsGqEYPllP\\\", \\\"TRIPLEO_CONFIG_HASH=c641a28ce2c7aa149f10ffc3c12bb5d2\\\"], \\\"start_order\\\": 1, \\\"volumes\\\": [\\\"/etc/hosts:/etc/hosts:ro\\\", \\\"/etc/localtime:/etc/localtime:ro\\\", \\\"/etc/pki/ca-trust/extracted:/etc/pki/ca-trust/extracted:ro\\\", \\\"/etc/pki/ca-trust/source/anchors:/etc/pki/ca-trust/source/anchors:ro\\\", \\\"/etc/pki/tls/certs/ca-bundle.crt:/etc/pki/tls/certs/ca-bundle.crt:ro\\\", \\\"/etc/pki/tls/certs/ca-bundle.trust.crt:/etc/pki/tls/certs/ca-bundle.trust.crt:ro\\\", \\\"/etc/pki/tls/cert.pem:/etc/pki/tls/cert.pem:ro\\\", \\\"/dev/log:/dev/log\\\", \\\"/etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts:ro\\\", \\\"/etc/puppet:/etc/puppet:ro\\\", \\\"/var/lib/kolla/config_files/rabbitmq.json:/var/lib/kolla/config_files/config.json:ro\\\", \\\"/var/lib/config-data/puppet-generated/rabbitmq/:/var/lib/kolla/config_files/src:ro\\\", \\\"/var/lib/rabbitmq:/var/lib/rabbitmq:z\\\", \\\"/var/log/containers/rabbitmq:/var/log/rabbitmq:z\\\"], \\\"image\\\": \\\"docker.io/tripleomaster/centos-binary-rabbitmq:56eedaf13617f1880ce5b1b268db53a774f453c1_a77b7752\\\", \\\"detach\\\": false, \\\"net\\\": \\\"host\\\", \\\"privileged\\\": false}\" for \"-l, --label\" flag: parse error on line 1, column 13: bare \" in non-quoted-field"

Describe the results you expected:
Deployment worked in podman 1.0.0.

Output of podman version:

Version:            1.1.2
RemoteAPI Version:  1
Go Version:         go1.10.2
OS/Arch:            linux/amd64

Output of podman info --debug:

host:
  BuildahVersion: 1.7.1
  Conmon:
    package: podman-1.1.2-2.git0ad9b6b.el7.x86_64
    path: /usr/libexec/podman/conmon
    version: 'conmon version 1.14.0-dev, commit: 6e07c13bf86885ba6d71fdbdff90f436e18abe39-dirty'
  Distribution:
    distribution: '"centos"'
    version: "7"
  MemFree: 966000640
  MemTotal: 8369278976
  OCIRuntime:
    package: runc-1.0.0-60.dev.git2abd837.el7.x86_64
    path: /usr/bin/runc
    version: 'runc version spec: 1.0.0'
  SwapFree: 8564355072
  SwapTotal: 8589930496
  arch: amd64
  cpus: 8
  hostname: standalone.localdomain
  kernel: 3.10.0-957.5.1.el7.x86_64
  os: linux
  rootless: false
  uptime: 59m 14.39s
insecure registries:
  registries:
  - 192.168.24.1:8787
registries:
  registries:
  - registry.access.redhat.com
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.centos.org
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 0
  GraphDriverName: overlay
  GraphOptions: null
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  ImageStore:
    number: 23
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes
@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 7, 2019
@rhatdan
Copy link
Member

rhatdan commented Mar 7, 2019

@baude PTAL

@edsantiago
Copy link
Collaborator

Less complicated reproducer, courtesy of @mheon on IRC:

$ podman run --rm --label 'true="false"' alpine true
Error: invalid argument "true=\"false\"" for "-l, --label" flag: parse error on line 1, column 5: bare " in non-quoted-field

@eparis
Copy link

eparis commented Mar 7, 2019

do you need to specify --label multiple times, or do you expect people to use it as a CSV. If 'as a CSV' that's what you have and 'true="false"' isn't a valid CSV. If you want people to have to use it multiple times I'm guessing you want a StringArray, instead of a StringSlice.

@EmilienM
Copy link
Contributor Author

EmilienM commented Mar 7, 2019

do you need to specify --label multiple times, or do you expect people to use it as a CSV. If 'as a CSV' that's what you have and 'true="false"' isn't a valid CSV. If you want people to have to use it multiple times I'm guessing you want a StringArray, instead of a StringSlice.

We use --label multiple times.

baude added a commit to baude/podman that referenced this issue Mar 7, 2019
switch from a stringslice to a stringarray for labels to handle quoted
input.

fixes issue containers#2574

Signed-off-by: baude <bbaude@redhat.com>
baude added a commit to baude/podman that referenced this issue Mar 8, 2019
switch from a stringslice to a stringarray for labels to handle quoted
input.

fixes issue containers#2574

Signed-off-by: baude <bbaude@redhat.com>
@rhatdan
Copy link
Member

rhatdan commented Mar 8, 2019

Fixed in master.

@rhatdan rhatdan closed this as completed Mar 8, 2019
edsantiago added a commit to edsantiago/libpod that referenced this issue Mar 18, 2019
New:
 - podman exec
 - podman load (requires containers#2674)
 - CLI parsing (regression test for containers#2574)

Improved:
 - help: test "podman NoSuchCommand", and subcommands
 - help: test "podman cmd" without required args
 - pod: start with --infra=false; this allows running rootless
 - log: also run 'logs' after container is run
 - log: test -f with two containers

Also, use helpful descriptions for skip_if_rootless

Tested on f29, root and rootless. As soon as podman-remote
supports rm, I'll start testing that too.

Signed-off-by: Ed Santiago <santiago@redhat.com>
@wwilson
Copy link

wwilson commented Mar 21, 2019

Does this fix also need to be applied to --env? Slight modification of your reproduction above:

$ podman run --rm --env var='true=\"false\"' alpine true
Error: invalid argument "var=true=\\\"false\\\"" for "-e, --env" flag: parse error on line 1, column 10: bare " in non-quoted-field

@mheon
Copy link
Member

mheon commented Mar 21, 2019

#2717 fixed --env as well

muayyad-alsadi pushed a commit to muayyad-alsadi/libpod that referenced this issue Apr 21, 2019
switch from a stringslice to a stringarray for labels to handle quoted
input.

fixes issue containers#2574

Signed-off-by: baude <bbaude@redhat.com>
muayyad-alsadi pushed a commit to muayyad-alsadi/libpod that referenced this issue Apr 21, 2019
New:
 - podman exec
 - podman load (requires containers#2674)
 - CLI parsing (regression test for containers#2574)

Improved:
 - help: test "podman NoSuchCommand", and subcommands
 - help: test "podman cmd" without required args
 - pod: start with --infra=false; this allows running rootless
 - log: also run 'logs' after container is run
 - log: test -f with two containers

Also, use helpful descriptions for skip_if_rootless

Tested on f29, root and rootless. As soon as podman-remote
supports rm, I'll start testing that too.

Signed-off-by: Ed Santiago <santiago@redhat.com>
@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 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 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

No branches or pull requests

8 participants