minio / mc

Unix like utilities for object store
https://min.io/download
GNU Affero General Public License v3.0
2.86k stars 548 forks source link

mc mv returns non-zero on empty source #5007

Open udf2457 opened 2 months ago

udf2457 commented 2 months ago

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:

  1. 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)
  2. Add an igore-empty-source flag 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

allanrogerr commented 2 months ago

Reviewing

allanrogerr commented 2 months ago

What is your minio version? Also, please post of a sample script where you provoke the error.

udf2457 commented 2 months ago

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; }

allanrogerr commented 2 months ago

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:

  1. 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)
  2. Add an igore-empty-source flag 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

udf2457 commented 2 months ago

And that is what I posted ........ surely the Copyright and License lines are irrelevant ? I gave you the mc version and runtime lines.

klauspost commented 2 months ago

@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.