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

command: escape the script string provided to lock #1845

Closed
wants to merge 1 commit into from

Conversation

mssola
Copy link
Contributor

@mssola mssola commented Mar 18, 2016

This commits deals with executions of the lock command that look like this:

$ consul lock / mkdir "a b" c

Before this commit, three directories would be created: a, b and c. With this
commit, only two will be created: "a b" and c; which is what the user expects.

I've added a specific test for it and I've also modified the rest of the tests
to simulate better what's actually being passed to the CLI.

Fixes #1621

Signed-off-by: Miquel Sabaté Solà [email protected]

This commits deals with executions of the lock command that look like this:

  $ consul lock / mkdir "a b" c

Before this commit, three directories would be created: a, b and c. With this
commit, only two will be created: "a b" and c; which is what the user expects.

I've added a specific test for it and I've also modified the rest of the tests
to simulate better what's actually being passed to the CLI.

Fixes hashicorp#1621

Signed-off-by: Miquel Sabaté Solà <[email protected]>
@ryanuber
Copy link
Member

ryanuber commented Jul 5, 2016

Hey @mssola, sorry for the delay here! I think this could also be avoided by simply enclosing the command to execute in quotes, like:

$ consul lock / 'mkdir "a b" c'

By automatically inserting double-quotes I think we are opening up the possibility for further unexpected behavior in cases where there may also be double-quotes in the command. Does that make sense?

@mssola
Copy link
Contributor Author

mssola commented Aug 9, 2016

Yeah. Thanks for the clarification. Closing this PR, and I guess that you'll do the same in the referenced issue 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants