什么可以解释“无效的存储块长度"?错误? [英] What might explain an "invalid stored block lengths" error?

查看:16
本文介绍了什么可以解释“无效的存储块长度"?错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在 Vagrant 虚拟框中的基本 Ubuntu lucid32 映像上运行带有 Ruby 1.9.3p194 的 Rails (3.2.3) 应用程序.虚拟盒子在 Leopard 上运行,这是值得的.我正在尝试在应用程序中使用 ruby​​zip 来解压缩 zip 存档 - 2009_da_lmp.zip.直接使用 ruby​​zip 存储库中的示例代码,我可以确认我可以列出存档文件内容:

I am running a Rails (3.2.3) application with Ruby 1.9.3p194 on the basic Ubuntu lucid32 image in a Vagrant virtual box. The virtual box is running on Leopard, for what it's worth. I'm trying to use rubyzip in the application to decompress a zip archive - 2009_da_lmp.zip. Using code directly from examples in the rubyzip repository, I can confirm that I can list the archive file contents:

#f is the absolute path to 2009_da_lmp.zip (string)
Zip::ZipFile.open(f) { |zf| zf.entries[0] }  
 => 20090101_da_lmp.csv #that is indeed a file in the archive.

使用存储库中示例中的更多代码,我尝试获取存档中的实际文件:

Using some more code from the examples in the repository, I try to get at an actual file in the archive:

Zip::ZipInputStream.open(f) { |zis|
  entry = zis.get_next_entry
  print "first line of '#{entry.name}' (#{entry.size} bytes: ) "
  puts "'#{zis.gets.chomp}'" }

=> first line of '20090101_da_lmp.csv' (826610 bytes: ) Zlib::DataError: 
   invalid stored block lengths #and a long stack trace I can provide 
                                #if that might help

Mac OS 解压缩实用程序可以很好地解压缩存档.我想知道这是否是某种与编码相关的事情(我的语言环境设置为 en_US.UTF-8,因为为了使在开发中使用 PostgreSQL 不那么痛苦),但我不知道如何判断是否是这种情况.我找不到有关可能导致此错误的原因的任何信息.

The Mac OS decompression utility unzips the archive fine. I was wondering if it was some kind of encoding-related thing (my locale is set to en_US.UTF-8 because to make using PostgreSQL in dev less painful), but I don't know how to tell if that's the case. I can't find any information on what might cause this error.

推荐答案

这是向充气机提供随机数据时发现的典型错误.事实上,大约有 1/4 的时间你会从随机数据中得到这个错误(当第一个字节的低三位是 000 或 001 时).所以我猜想通货膨胀只是出于某种原因从错误的字节开始.

This is a typical error found when feeding random data to an inflater. In fact you will get this error about 1/4 of the time from random data (when the low three bits of the first byte are 000 or 001). So I would guess that the inflation is simply starting at the wrong byte for some reason.

这篇关于什么可以解释“无效的存储块长度"?错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆