oci-cli icon indicating copy to clipboard operation
oci-cli copied to clipboard

WINDOWS DATA LOSS! oci os object sync Deletes Files That Shouldn't Be Deleted

Open mricken opened this issue 3 years ago • 0 comments

We have noticed that the OCI CLI (including version 3.5.0) has a bug that deletes files that should not be deleted.

This affects any version of the OCI CLI at this time (including 3.5.0, which is the latest version). But we have only reproduced this on Windows at this time.

When the oci os object sync command is used together with --dest-dir and --delete, the OCI CLI will delete local directories (in the --dest-dir) and all files contained in them.

For example: Assume I have two files, C:\Test\foo.txt and C:\Test\directory\bar.txt.

Now I run

oci os object sync -bn my-test-bucket --src-dir C:\Test --delete

This will put the two files into the bucket. Now both the bucket and the local directory are the same.

If I now run

oci os object sync -bn my-test-bucket --dest-dir C:\Test --delete

then nothing should happen. However, the C:\Test\directory is deleted, along with the C:\Test\directory\bar.txt file.

We advise that Windows users of the OCI CLI avoid using the --delete option in conjunction with --dest-dir.

mricken avatar Feb 13 '22 09:02 mricken