"aws s3 cp" download to /dev/null gives back a warning, a success and an error
- Dominant language
- Python
- Stars
- 17.3k
- Forks
- 4.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 13
Description
I've opened an AWS support case (Case ID 7148947761) and the AWS support rep said the service team asked me to open a GitHub issue about this.
I am working with S3 kms-key-policy, and in order to test my changes, I went to download a file using awscli (aws s3 cp).
I didn't actually want the file, so I put "/dev/null" as the local path (like "curl -O /dev/null http://example.com/my-file.txt ").
This tickled some bug in aws-cli, because it started throwing errors:
```
$ aws s3 cp s3://[redacted] /dev/null
warning: Skipping file /dev/null. Successfully Downloaded /dev/null but was unable to update the last modified time. [Errno 13] Permission denied
download: s3://[redacted] to ../../../../../../../../dev/null
$
```
There is a warning, a success, and an error. It looks like it actually transferred the file however.
This is a bit confusing and raises some concern about the integrity of the innards of aws-cli.
There is no production impact.
This is with aws-cli/2.0.19
The support engineer wrote:
> When downloading with the aws s3 sync/cp commands the AWS CLI will try to update the file(s) modified time to match the S3 object key modified time. When not root the OS returns permission-denied/permission-problem when AWS CLI tries to do this for the /dev/null file which is why warning (OS error) is being returned. They could also share an AWS github code describing how it works here: https://github.com/aws/aws-cli/blob/73f321d1e72d25ee4200eac59954b4e2d5a9c573/awscli/customizations/s3/utils.py#L702
Contributor guide
Assessment
This issue has not been assessed yet.