mc
mc copied to clipboard
mc mv returns non-zero on empty source
mc mv returns non-zero on an empty source bucket.
This causes problems with scripts that check for bad exits, i.e. mc mv .... || report_bad_stuff
It would be nice to have one of the following:
- Do not return non-zero on empty source (since, technically it is not an error situation, it is a fact ... i.e. nothing to move)
- Add an
igore-empty-sourceflag or similar to achieve the same effect (i.e. not consider empty sources an error)
mc version RELEASE.2024-07-15T17-46-06Z (commit-id=11034f9de1e9f993c36fbad961f76f876a753328) Runtime: go1.22.5 linux/amd64
Reviewing
What is your minio version? Also, please post of a sample script where you provoke the error.
minio version was already provided.....
You should be able to replicate the error by doing what I said, mc mv .... || report_bad_stuff, so for example mc mv ... || { logger -p user.error -t "mytag" "mc failed"; exit 1; }
mc mvreturns non-zero on an empty source bucket.This causes problems with scripts that check for bad exits, i.e.
mc mv .... || report_bad_stuffIt would be nice to have one of the following:
- Do not return non-zero on empty source (since, technically it is not an error situation, it is a fact ... i.e. nothing to move)
- Add an
igore-empty-sourceflag or similar to achieve the same effect (i.e. not consider empty sources an error)mc version RELEASE.2024-07-15T17-46-06Z (commit-id=11034f9de1e9f993c36fbad961f76f876a753328) Runtime: go1.22.5 linux/amd64
Provide minio --version
And that is what I posted ........ surely the Copyright and License lines are irrelevant ? I gave you the mc version and runtime lines.
@udf2457 You have provided the mc version - not the minio (server) version. It may or may not be relevant, but it is good to have for a precise reproducer in case the error is related to specific server behavior.
Leaving this open a bit longer. @udf2457 Please provide the complete requested info.
How does unix mv handle non existent path? @allanrogerr
@udf2457 you can try mc ls <source_alias>/<source_prefix> --json | jq '.key' | xargs -I {} mc mv {} <target_alias>/<target_prefix>
As @harshavardhana was probably getting at, unix mv work similarly, so does aws s3. Neither are idempotent. The above gives an example of how you may obtain the idempotent behaviour you require.