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

Should not be able to mv a remote file onto itself #831

Closed
jamesls opened this issue Jun 30, 2014 · 1 comment · Fixed by #832
Closed

Should not be able to mv a remote file onto itself #831

jamesls opened this issue Jun 30, 2014 · 1 comment · Fixed by #832
Labels
bug This issue is a bug. s3

Comments

@jamesls
Copy link
Member

jamesls commented Jun 30, 2014

The current s3 mv command is essentially a cp(src, dst) && rm(src). Normally, if you aren't changing the object's metadata, storage class, website config, or encryption attrs you can't copy and object onto itself. However, a multipart copy of an object onto itself will work, which happens if the object is over our multipart threshold size, which means that we will also delete the src file which is not what we want.

So we should be adding validation to ensure that we aren't trying to mv a file onto itself.

jamesls added a commit to jamesls/aws-cli that referenced this issue Jun 30, 2014
jamesls added a commit that referenced this issue Jul 7, 2014
This is not in the 1.3.21 release, it will be part
of the next release.
jamesls added a commit that referenced this issue Jul 10, 2014
* release-1.3.22:
  Bumping version to 1.3.22
  Update CHANGELOG with the latest features
  Update completer test with new services
  Update changelog with #825
  Add changelog entry for #834
  Fix changelog entry for merge of #831
  Added test_cancel_after_upload_id to test_tasks
  Update changelog with fix for #549
  Disable fix_s3_host when --endpoint-url is given
  Fixes issue #834
  Update changelog with bugfix
  Add validation to ensure we don't mv a file onto itself
  Let aws.cmd find python.exe on paths with spaces.
@rimutaka
Copy link

rimutaka commented Oct 9, 2020

@jamesls , are you sure you fixed it? I've just run into this problem and ended up loosing a few hundred files.

CLI command:

aws s3 mv s3://my_bucket/Company/some_firm/dddfiles/Vehicle/ s3://my_bucket/Company/some_firm/dddfiles/Vehicle --exclude "*" --include "*.DDD" --recursive

Output for one of the files:

move: s3://my_bucket/Company/some_firm/dddfiles/Vehicle/M_20200804_0516_181AB1202_YV2XZ22G4JB843351.DDD to s3://my_bucket/Company/some_firm/dddfiles/Vehicle/M_20200804_0516_181AB1202_YV2XZ22G4JB843351.DDD

CLI version: aws-cli/2.0.13 Python/3.7.7 Windows/10 botocore/2.0.0dev17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. s3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants