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

brdido
  • 351
  • 1
  • 3
  • 12
  • 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 Jul 17 '14 at 14:58

1 Answers1

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?

Mike Schwartz
  • 11,511
  • 1
  • 33
  • 36
  • 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 Jul 17 '14 at 00: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 ` http://stackoverflow.com/questions/4225102/which-shell-does-a-perl-system-call-use ` – brdido Jul 17 '14 at 14:42
  • Hi - I found this article that tells you how to check the command exit status after calling Perl's system() function: http://www.perlhowto.com/executing_external_commands – Mike Schwartz Jul 19 '14 at 23:18