#96 s3cmd exits with zero return code after certain S3 errors

Malfunction
open
nobody
s3cmd (118)
5
2015-02-09
2011-07-06
Michael Gardner
No

When s3cmd encounters an error, it generally exits with a nonzero return code, as expected. But for certain S3 errors (namely those in S3.codes), it returns zero, indicating success. I'm not sure if this is by design, but it's definitely unexpected and unwanted behavior for me.

Discussion

  • Jason Woodall
    Jason Woodall
    2013-04-02

    This occurs for s3cmd ls:
    10:17 /cygdrive/d/(s3_build)$ ./tools/s3cmd/s3cmd ls s3://downloads1
    ERROR: Bucket 'downloads1' does not exist
    10:28 /cygdrive/d/(s3_build)$ echo $?
    0

    Expected result would be 1 (or other error code)

     
  • Simon Boulet
    Simon Boulet
    2013-05-21

    Same for "backup: ERROR: Upload of 'XXX' failed too many times. Skipping that file." (that was from 1.0.0 perhaps it has changed in newer releases).

    This is a major issue to us and make it a little more difficult to automate uploading files to S3 from bash scripts (and making sure they were actually uploaded).

     
  • Buggz
    Buggz
    2014-03-06

    "ERROR: Upload of 'XXX' failed too many times. Skipping that file."
    return status is 0, which is wrong. found this problem in s3cmd version 1.0.1.

    I believe priority of this should be increased .

     
  • Matt Domsch
    Matt Domsch
    2015-02-09

    1.5.2 has a lot of fixed return codes. Probably not for every possible failure case, but many have been addressed. If you have a failure still, please advise on your specific case.

    I note that failures dealing with recursive calls (e.g. sync -r, put -r, get -r) may not get reflected in the exit code (what's the proper response to "one file of 10,000 failed") ?