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

implement lxc_string_split_quoted #1844

Merged
merged 1 commit into from Oct 5, 2017

Conversation

3 participants
@hallyn
Member

hallyn commented Oct 4, 2017

lxc_string_split_quoted() splits a string on spaces, but keeps
groups in single or double qoutes together. In other words,
generally what we'd want for argv behavior.

Switch lxc-execute to use this for lxc.execute.cmd.

Switch lxc-oci template to put the lxc.execute.cmd inside single
quotes, because parse_line() will eat those. If we don't do that,
then if we have lxc.execute.cmd = /bin/echo "hello, world", then the
last double quote will disappear.

@stgraber

This comment has been minimized.

Show comment
Hide comment
@stgraber

stgraber Oct 4, 2017

Member

missing sign-off?

Member

stgraber commented Oct 4, 2017

missing sign-off?

@brauner

This comment has been minimized.

Show comment
Hide comment
@brauner

brauner Oct 4, 2017

Member

I commented on IRC already, but I'm doing it here again for future reference. Starting with liblxc 3.0 we should maybe consider reworking the parse_line() part such that it doesn't strip "" by default or only where it makes sense. I'm not completely sure right now whether we can do this without regressing the whole world but it is at least worth thinking about it.

Member

brauner commented Oct 4, 2017

I commented on IRC already, but I'm doing it here again for future reference. Starting with liblxc 3.0 we should maybe consider reworking the parse_line() part such that it doesn't strip "" by default or only where it makes sense. I'm not completely sure right now whether we can do this without regressing the whole world but it is at least worth thinking about it.

implement lxc_string_split_quoted
lxc_string_split_quoted() splits a string on spaces, but keeps
groups in single or double qoutes together.  In other words,
generally what we'd want for argv behavior.

Switch lxc-execute to use this for lxc.execute.cmd.

Switch lxc-oci template to put the lxc.execute.cmd inside single
quotes, because parse_line() will eat those.  If we don't do that,
then if we have lxc.execute.cmd = /bin/echo "hello, world", then the
last double quote will disappear.

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
@hallyn

This comment has been minimized.

Show comment
Hide comment
@hallyn

hallyn Oct 4, 2017

Member

We'd have to define "where it makes sense" :)

Member

hallyn commented Oct 4, 2017

We'd have to define "where it makes sense" :)

@brauner brauner merged commit c38d860 into lxc:master Oct 5, 2017

4 checks passed

Branch target Branch target is correct
Details
Signed-off-by All commits signed-off
Details
Testsuite Testsuite passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment