"MD5 signatures do not match" when downloading multipart uploads
This may be related to #252
S3URL="s3://bucketname/temp/datejunk.txt"
date > datejunk.1
cat datejunk.1 | s3cmd put - $S3URL
s3cmd get $S3URL datejunk.2
Raises warnings that the received md5 signature has '-1' on the end, which won't match any computed md5sum. I know this is a problem with S3 itself, and #252 mentions that s3cmd already tries a workaround. Maybe could we have 's3cmd get --no-check-md5' to use when we know that meaningless warning is going to arrive?
puts from stdin use multipart upload. They must - s3cmd doesn't know how long the stdin stream is going to be, and cannot buffer the stream into memory (and chooses not to buffer it to disk).
The problem here being warned about is that we also cannot store the md5sum in the s3cmd-attrs metadata, because we must send the metadata before we send the data, and as we're streaming in the file from stdin, we can't know the data to calculate the md5sum for it to send before we've seen it.
So, the only remaining source of the md5sum is from the ETag, which is not the md5sum of the file in this case.
I am not aware of a way to upload the file from stdin, close the connection, and then send a 2nd REST command to push new metadata which could include the md5sum.
Therefore, the best we can do is to recognize when the ETag ends in "-N", ignore it, and recognize that we didn't get a value from the metadata, so don't perform the comparison, and therefore warning, at all.
we can do an object_modify() - aka x-amz-metadata-directive REPLACE, but that actually makes a copy of the file within S3 while replacing the metadata with the new metadata specified. That's pretty nasty, as we often use multipart uploads exactly because the objects are large. Maybe if we special-cased puts from stdin and only did the REPLACE thereafter...
@moses-moore-spafax please try my branch referenced above. It takes care of the warning you note.
moses@equius:/tmp/s3cmd$ date | ./s3cmd put - s3://stable/equius/datejunk.txt
<stdin> -> s3://stable/equius/datejunk.txt [part 1, 29B]
29 of 29 100% in 0s 266.85 B/s done
moses@equius:/tmp/s3cmd$ ./s3cmd get s3://stable/equius/datejunk.txt -
s3://stable/equius/datejunk.txt -> <stdout> [1 of 1]
s3://stable/equius/datejunk.txt -> <stdout> [1 of 1]
Fri Aug 21 10:07:17 EDT 2015
29 of 29 100% in 0s 149.16 B/s done
Looking good, thanks for taking the time to clean it up.
I wonder if Amazon / AWS makes any promises about the Etag always being an MD5 checksum of the stored object. The Etag described in RFC2616 ("http") says it has to be a unique string for each unique version of objects with the same URI, but doesn't specify what that string must be -- could be modify time, could be a constantly-incrementing number, could be a checksum of the object's bytes.
(Note: for the Etag, so far they same nothing about how it is calculated even it is currently md5 or md5-sequencenumber for multipart ones)