error/same_hash_different_size

error/same_hash_different_size

by Mitch Douglas -
Number of replies: 4

I've had this error come up when I've tried to restore a subject. It's worth noting that I brought the backup zip file from a 1.9 version of Moodle into a 2.2 version. Any idea what causes it?

Average of ratings: -
In reply to Mitch Douglas

Re: error/same_hash_different_size

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers

Oh, that means one of the following:

  1. you have won an inter-gallactic lottery of SHA1 hash collision contest
  2. somebody or something modified content file in your dataroot
  3. the backup archive contains corrupt file information or file content or it did not extract correctly
  4. there is a bug somewhere in our code - but I guess it would be already reported before

I personally bet on 2. and 3., but it would be interesting to look at the backup file archive and the file that is already in your site (files table contains necessary info). Once you get the two files use some tool to make sha1 hash of their contents and if they really match you are lucky winner (and you have to delete one of the files).

I guess we could add extra check for the backup files if the corruption comes from there.

Hmm, I think we could reliably detect 1., 2. and 3. and throw better error messages, I have create new issue for this MDL-33094.

In reply to Petr Skoda

Re: error/same_hash_different_size

by Mitch Douglas -

I'll add that when I first created the backup the file that was created wasn't moved from the temp file for some reason. I had to manually go to the temp file and get it. So maybe it's had an error at that point.

Also when I try to upload the backup as a brand new course rather than combining it with a pre-existing course, I get the following error;

error/tmp_backup_directory_not_found

In reply to Mitch Douglas

Re: error/same_hash_different_size

by Petr Skoda -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
Oh, if you modified the file contents or if the compression of backup archive file failed that would explain it. Please try to create a new backup instead.

In any case I will try to improve the internal file storage code to detect similar problems and throw more meaningful error message, I will have to wait a bit untill the current file api changes land in 2.3dev...
In reply to Petr Skoda

Re: error/same_hash_different_size

by Mitch Douglas -

I've attempted to make another backup but it doesn't seem to have done anything. It gets to "Zipping backup" but then stops. There's no visible error messages available. Is there a log anywhere I can look at?