简体   繁体   English

通过SCP传输可存储文件时出现错误“无法对可存储文件进行魔术数字检查”

[英]Error “Magic number checking on storable file failed” when Storable file transferred through SCP

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. 区别在于,文件通过SCP传输到另一台计算机并在那里进行检索。 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. 我也尝试过“ nstore”,但是由于同样的错误也失败了。

Is SCP the culprit in corrupting file or something? SCP是破坏文件之类的罪魁祸首吗? 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? 还有什么建议吗?

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. 即使当前uid具有该文件的读取权限,其他uid也会造成问题。 So copy file under the retrieval user or use chown. 因此,在检索用户下复制文件或使用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. 我对该目录有一个inotify。 That might be the culprit, as pretrieve() in Storable.pm failed. 这可能是罪魁祸首,因为Storable.pm中的pretrieve()失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM