context: put quotes around flagvalue incase of whitespaced values #636
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves #541
While running the sync command it starts to generate cp commands in the generateCommand function and writes it to a pipe where it is read by the Run function of the Run command. In the Run function, there is a line
fields, err := shellquote.Split(line)
to split the generated cp command into its fields.
For a command
We would have expected the generateCommand function to write into the pipe a command
But instead, it writes the command
This causes the
shellquote.Split(line)
to split fields incorrectly. This causesflagset.Parse(fields)
to populate flagset incorrectly and as a result we end up with an error.The main problem occurs in the generateCommand function while appending flags without quotes. If we add quotes around the flagValue while generating a command. The
shellquote.Split(line)
acts as intended and successfully sync with the given cache-control metadata in S3