2

we are trying to script a fail-safe copy using gsutil.

The problem is that gsutil cp returns 0 even if it failed. Is this expected? Do i have to parse the log?

/usr/local/bin/gsutil -m cp -L gsutilM.log gs://my-bucket/mydir/myfile1.gz /home/myuser

From log file:

Result,Description
error, CommandException: crc32c signature computed for local file (FGa0jw==) doesn't match     cloud-supplied digest (N1S6Ew==).
Local file (/home/myuser/myFile1.gz) will be deleted.

Thanks

1
  • It is not a gsutil problem. My startup-script was using a wrong parameter and was not handling the return code properly. sorry, my mistake.
    – brdido
    Commented Jul 17, 2014 at 14:58

1 Answer 1

1

I tried modifying the code that makes the crc32c check, to force that condition to occur. I then downloaded a file, saw output like you saw, and verified that $status was set to 1.

What OS and shell are you using?

3
  • Also, which version of gsutil are you using? If you're not using the latest version, please try updating - I believe we've already fixed this problem, but it's possible this is a different manifestation.
    – Zach Wilt
    Commented Jul 17, 2014 at 0:57
  • Hello Mike, thanks for answering. So maybe this is my code issue: gsutil version 4.3 centos 2.6.32-431.1.2.0.1.el6.x86_64 About which shell: i'm using perl's system() function ` stackoverflow.com/questions/4225102/… `
    – brdido
    Commented Jul 17, 2014 at 14:42
  • Hi - I found this article that tells you how to check the command exit status after calling Perl's system() function: perlhowto.com/executing_external_commands Commented Jul 19, 2014 at 23:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.