[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Daniel Pittman daniel at rimspace.net
Tue May 10 08:05:38 UTC 2011


The following commit has been merged in the experimental branch:
commit b311651526c7c9448bdd9a77a111302fd0c0efa4
Author: Daniel Pittman <daniel at rimspace.net>
Date:   Tue Feb 22 14:18:57 2011 -0800

    (#6407) Fix spec test hang with Mocha >= 0.9.11 in zlib testing
    
    We had a combination of bad logic, and bad testing, and a nasty behaviour of
    Mocha <= 0.9.10 that would result in a false pass for one of our tests.
    
    This not only falsely passed, but hid an infinite loop retrying decompression
    on an invalid data stream; it could be triggered by anything that sent an HTTP
    request with an invalid compressed body, resulting in a livelock.
    
    Paired-with: Jesse Wolfe <jesse at puppetlabs.com>
    Signed-off-by: Daniel Pittman <daniel at puppetlabs.com>

diff --git a/lib/puppet/network/http/compression.rb b/lib/puppet/network/http/compression.rb
index d9b56f1..c8d0011 100644
--- a/lib/puppet/network/http/compression.rb
+++ b/lib/puppet/network/http/compression.rb
@@ -75,7 +75,10 @@ module Puppet::Network::HTTP::Compression
         # in this case, we try with a verbatim (no header)
         # deflater.
         @uncompressor = Zlib::Inflate.new
-        retry if @first
+        if @first then
+          @first = false
+          retry
+        end
         raise
       end
 
diff --git a/spec/unit/network/http/compression_spec.rb b/spec/unit/network/http/compression_spec.rb
old mode 100644
new mode 100755
index d44c5f1..85c62f3
--- a/spec/unit/network/http/compression_spec.rb
+++ b/spec/unit/network/http/compression_spec.rb
@@ -178,7 +178,7 @@ describe "http compression" do
       end
 
       it "should raise the error the second time" do
-        @inflater.expects(:inflate).raises(Zlib::DataError.new("not a zlib stream"))
+        @inflater.stubs(:inflate).raises(Zlib::DataError.new("not a zlib stream"))
         Zlib::Inflate.expects(:new).with.returns(@inflater)
         lambda { @adapter.uncompress("chunk") }.should raise_error
       end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list