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

Fix ENV parsing on podman import #3333

Merged

Conversation

jordemort
Copy link

@jordemort jordemort commented Jun 14, 2019

The code that parses --change options to podman import was not processing the ENV command in a useful way. pair is created by splitting the option value on =, but only pair[1] was being appended to env; this meant that there was no way to actually specify a value for an environment variable, since env is expected to be a list of strings of the form KEY=VALUE.

This PR fixes the issue by re-joining the elements of the pair array with = from index 1 onward, and appending that to env instead of just appending pair[1]. This allows a command like the one below to function as expected:

podman import -c ENV=LANG=en_US.UTF-8 -

The resulting container will have LANG set to en_US.UTF-8 in its environment.

No special consideration or treatment is made to the string other than re-joining the remainder on =. This allows environment variables with embedded = characters to be specified without any additional gymnastics:

podman import -c ENV=EQUATION=FOO=BAR -

The resulting container will have EQUATION set to FOO=BAR in its environment.

Signed-off-by: Jordan Webb <jordemort@github.com>
@rh-atomic-bot
Copy link
Collaborator

Can one of the admins verify this patch?
I understand the following commands:

  • bot, add author to whitelist
  • bot, test pull request
  • bot, test pull request once

@openshift-ci-robot openshift-ci-robot added size/XS needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 14, 2019
@openshift-ci-robot
Copy link
Collaborator

Hi @jordemort. Thanks for your PR.

I'm waiting for a containers or openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@mheon
Copy link
Member

mheon commented Jun 14, 2019

pair := strings.Split(ch, "=") on line 91 - Maybe change this to strings.SplitN(ch, "=", 2) to not split further than we need to?

@mheon
Copy link
Member

mheon commented Jun 14, 2019

Hmm. That might break label parsing...

@mheon
Copy link
Member

mheon commented Jun 14, 2019

/approve
/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 14, 2019
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jordemort, mheon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 14, 2019
@mheon
Copy link
Member

mheon commented Jun 14, 2019

Eh, this looks fine as-is. Changes LGTM.
@rhatdan @baude @TomSweeneyRedHat @giuseppe PTAL

@rhatdan
Copy link
Member

rhatdan commented Jun 14, 2019

/lgtm
/hold

@openshift-ci-robot openshift-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Jun 14, 2019
@mheon
Copy link
Member

mheon commented Jun 14, 2019

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 14, 2019
@openshift-merge-robot openshift-merge-robot merged commit 4c849a7 into containers:master Jun 14, 2019
@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 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. ok-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants