Error "Magic number checking on storable file failed" when Storable file transferred through SCP

6k views Asked by At

I had a basic code where it stores a hash in a file.

store \%hash 'file';
retrieve ('file');

The difference is, the file is transferred to a different machine through SCP and retrieved there. While retrieval, I get this error "Magic number checking on storable file failed". I tried "nstore" too, but that too failed with the same error.

Is SCP the culprit in corrupting file or something? I looked at the file it looks same to me though! Is there anything i need to take care specifically? Anything else as a suggestion?

1

There are 1 answers

4
Tirtha Pratim Bhattacharjee On

two things need to be checked:

  1. When the retrieve is done, the file should be owned by same user as the user who is running the retrieval code. Even if the current uid has read permissions for that file, different uid creates problem. So copy file under the retrieval user or use chown.
  2. check Storable versions in both machines. Though storable is backward compatible.

EDIT::

  1. The ownership was not causing the failure. Copying to different file worked for me though. So suspecting the locking issue in my code (not the ownership). I had a inotify for that directory. That might be the culprit, as pretrieve() in Storable.pm failed.