<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Ruby ZLib buffer error on Windows</title>
	<atom:link href="http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/</link>
	<description>It would be a good idea.</description>
	<pubDate>Fri, 08 Aug 2008 00:33:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: science</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3856</link>
		<dc:creator>science</dc:creator>
		<pubDate>Fri, 11 Jul 2008 15:21:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3856</guid>
		<description>Thanks for the tips Rutger. Just fyi you can get native compiled gzip without the cygwin layer from the most excellent gnuwin32 libs: http://gnuwin32.sourceforge.net/packages/gzip.htm</description>
		<content:encoded><![CDATA[<p>Thanks for the tips Rutger. Just fyi you can get native compiled gzip without the cygwin layer from the most excellent gnuwin32 libs: <a href="http://gnuwin32.sourceforge.net/packages/gzip.htm" rel="nofollow">http://gnuwin32.sourceforge.net/packages/gzip.htm</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rutger Nijlunsing</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3853</link>
		<dc:creator>Rutger Nijlunsing</dc:creator>
		<pubDate>Fri, 11 Jul 2008 10:21:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3853</guid>
		<description>You're right, running it against a large number of .gz files I found that 8192 is still too high ;)

2048 seems to work for at least the 58000 cases I've got here, so I'm going to stick with that. The gzip solutions makes it too slow for me (58000 times starting a process on Windows is no fun), and makes the installer larger since I need to bundle gzip.exe and cygwin1.dll with it.</description>
		<content:encoded><![CDATA[<p>You&#8217;re right, running it against a large number of .gz files I found that 8192 is still too high ;)</p>
<p>2048 seems to work for at least the 58000 cases I&#8217;ve got here, so I&#8217;m going to stick with that. The gzip solutions makes it too slow for me (58000 times starting a process on Windows is no fun), and makes the installer larger since I need to bundle gzip.exe and cygwin1.dll with it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: science</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3847</link>
		<dc:creator>science</dc:creator>
		<pubDate>Fri, 11 Jul 2008 01:22:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3847</guid>
		<description>Rutger: My experience tells me that what you're actually experiencing is not a definite solution but just a work around that works in certain test cases. I've come up with a number of solutions that seems to reduce the incidence of errors only to be surprised that on certain architectures with other gzip files that the lib starts failing again.

So I greatly appreciate the code - I think I have also experimented with reading only pieces of the zip file into a buffer and found that the dang thing still crashes in some cases. Keep us posted on your mileage! For now I'm sticking with:
&lt;pre&gt;&lt;code&gt;`gzip -d #{filename}`&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Rutger: My experience tells me that what you&#8217;re actually experiencing is not a definite solution but just a work around that works in certain test cases. I&#8217;ve come up with a number of solutions that seems to reduce the incidence of errors only to be surprised that on certain architectures with other gzip files that the lib starts failing again.</p>
<p>So I greatly appreciate the code - I think I have also experimented with reading only pieces of the zip file into a buffer and found that the dang thing still crashes in some cases. Keep us posted on your mileage! For now I&#8217;m sticking with:</p>
<pre><code>`gzip -d #{filename}`</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rutger Nijlunsing</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3842</link>
		<dc:creator>Rutger Nijlunsing</dc:creator>
		<pubDate>Thu, 10 Jul 2008 16:42:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3842</guid>
		<description>Hm, a correction after having processed more files: 8192 bytes seems to be OK, while 16384 does not seem to be OK. So change the '65536' in the previous post to 8192.</description>
		<content:encoded><![CDATA[<p>Hm, a correction after having processed more files: 8192 bytes seems to be OK, while 16384 does not seem to be OK. So change the &#8216;65536&#8242; in the previous post to 8192.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rutger Nijlunsing</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3841</link>
		<dc:creator>Rutger Nijlunsing</dc:creator>
		<pubDate>Thu, 10 Jul 2008 16:31:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3841</guid>
		<description>Experimenting with this resulted in the following working code:
&lt;pre&gt;&lt;code&gt;module Zlib
    class GzipReader
        def self.read(filename)
            contents = ""
            Zlib::GzipReader.open(filename) { &#124;gzio&#124;
                # Max. # of bytes which can be read reliable seems to
                # be around 66500. Overflow somewhere in Zlib?
                while buf = gzio.read(65536)
                    contents &#60;&#60; buf
                    puts contents.size
                end
            }
            contents
        end
    end
end
&lt;/pre&gt;&lt;/code&gt;
It seems that gzio.read() does not always work when the whole result is requested at once. Sounds like an overflow somewhere...</description>
		<content:encoded><![CDATA[<p>Experimenting with this resulted in the following working code:</p>
<pre><code>module Zlib
    class GzipReader
        def self.read(filename)
            contents = ""
            Zlib::GzipReader.open(filename) { |gzio|
                # Max. # of bytes which can be read reliable seems to
                # be around 66500. Overflow somewhere in Zlib?
                while buf = gzio.read(65536)
                    contents &lt;&lt; buf
                    puts contents.size
                end
            }
            contents
        end
    end
end
</code></pre>
<p>It seems that gzio.read() does not always work when the whole result is requested at once. Sounds like an overflow somewhere&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: science</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3157</link>
		<dc:creator>science</dc:creator>
		<pubDate>Tue, 20 May 2008 16:41:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3157</guid>
		<description>Taowen: Ruby's win zlib blows is all I can say. Perhaps try to get on the newest revision of Ruby. Or try switching to JRuby or Rubinius - I hear JRuby is pretty far along though I'm not sure about Windows. Rubinius finally booted Rails recently but again I'm not sure about Windows. Hope that helps!</description>
		<content:encoded><![CDATA[<p>Taowen: Ruby&#8217;s win zlib blows is all I can say. Perhaps try to get on the newest revision of Ruby. Or try switching to JRuby or Rubinius - I hear JRuby is pretty far along though I&#8217;m not sure about Windows. Rubinius finally booted Rails recently but again I&#8217;m not sure about Windows. Hope that helps!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: taowen</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3139</link>
		<dc:creator>taowen</dc:creator>
		<pubDate>Mon, 19 May 2008 06:28:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-3139</guid>
		<description>I am stilling getting Zlib:BufError after doing "gem update --system".</description>
		<content:encoded><![CDATA[<p>I am stilling getting Zlib:BufError after doing &#8220;gem update &#8211;system&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: olivier de Méringo</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-458</link>
		<dc:creator>olivier de Méringo</dc:creator>
		<pubDate>Fri, 14 Dec 2007 10:08:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-458</guid>
		<description>Thank you, the 'gem update --system' solved my issues.</description>
		<content:encoded><![CDATA[<p>Thank you, the &#8216;gem update &#8211;system&#8217; solved my issues.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: science</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-451</link>
		<dc:creator>science</dc:creator>
		<pubDate>Thu, 13 Dec 2007 19:19:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-451</guid>
		<description>Try this - I've heard it fixes a lot of issues like what you're having:
&lt;pre&gt;&lt;code&gt;gem update --system
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Try this - I&#8217;ve heard it fixes a lot of issues like what you&#8217;re having:</p>
<pre><code>gem update --system
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: IanTyndall</title>
		<link>http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-449</link>
		<dc:creator>IanTyndall</dc:creator>
		<pubDate>Thu, 13 Dec 2007 18:54:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-on-windows/#comment-449</guid>
		<description>I'm running into this same error when trying to install rails with gems (Ruby 1.8.6-25).  How would I go about applying your fix in my situation?</description>
		<content:encoded><![CDATA[<p>I&#8217;m running into this same error when trying to install rails with gems (Ruby 1.8.6-25).  How would I go about applying your fix in my situation?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
