You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
```
s5cmd sync --cache-control ‘public, max-age=31536000, immutable’ /Users/ataberk/desktop/test s3://s5cmd-test2
```
We would have expected the generateCommand function to write into the
pipe a command
```
cp --cache-control='public, max-age=31536000, immutable' --raw='true' \"/Users/ataberk/desktop/test/hello.txt\" \"s3://s5cmd-test2/test/hello.txt\"
```
But instead, it writes the command
```
cp --cache-control=public, max-age=31536000, immutable --raw=true \"/Users/ataberk/desktop/test/hello.txt\" \"s3://s5cmd-test2/test/hello.txt\"
```

This causes the `shellquote.Split(line)` to split fields incorrectly.
This causes `flagset.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


Co-authored-by: Ataberk Gürel <[email protected]>
I guess this is a problem with parsing and passing
--cache-control
option.This example doesn't work:
s5cmd --dry-run sync --cache-control 'public, max-age=31536000, immutable' ./dist/selene-static/ s3://selene-static/selene-static-s5cmd/
But this one does:
s5cmd --dry-run sync --cache-control 'public,max-age=31536000,immutable' ./dist/selene-static/ s3://selene-static/selene-static-s5cmd/
And for
cp
command both variants workThe text was updated successfully, but these errors were encountered: