spox / batali

Light weight cookbook resolver
https://spox.github.io/batali
Other
32 stars 6 forks source link

zlib error "invalid distance too far back" unzipping cookbook asset downloaded from Chef Supermarket #60

Closed kenny-evitt closed 8 years ago

kenny-evitt commented 8 years ago
$ chef exec batali install -V
[Batali]: Readying installation destination... complete!
[Batali]: Loading manifest file from: C:/@Kiln/recp-kitchen/batali.manifest
[Batali]: Installing cookbooks... Unzipping asset path: i:/.batali/cache/site/aHR0cHM6Ly9zdXBlcm1hcm
tldC5jaGVmLmlvOjQ0My9hcGkvdjEvY29va2Jvb2tzL2Nob2NvbGF0ZXkvdmVyc2lvbnMvMC42LjEvZG93bmxvYWQ=/asset
Unzipping asset path: i:/.batali/cache/site/aHR0cHM6Ly9zdXBlcm1hcmtldC5jaGVmLmlvOjQ0My9hcGkvdjEvY29v
a2Jvb2tzL2Nob2NvbGF0ZXkvdmVyc2lvbnMvMC42LjEvZG93bmxvYWQ=/asset
error!
[ERROR]: Reason - invalid distance too far back
ERROR: Zlib::DataError: invalid distance too far back

I added the following line:

            puts "Unzipping asset path: #{a_path}"

before [this line]; the output with that change:

$ chef exec batali install -V
[Batali]: Readying installation destination... complete!
[Batali]: Loading manifest file from: C:/@Kiln/recp-kitchen/batali.manifest
[Batali]: Installing cookbooks... Unzipping asset path: i:/.batali/cache/site/aHR0cHM6Ly9zdXBlcm1hcm
tldC5jaGVmLmlvOjQ0My9hcGkvdjEvY29va2Jvb2tzL2Nob2NvbGF0ZXkvdmVyc2lvbnMvMC42LjEvZG93bmxvYWQ=/asset
Unzipping asset path: i:/.batali/cache/site/aHR0cHM6Ly9zdXBlcm1hcmtldC5jaGVmLmlvOjQ0My9hcGkvdjEvY29v
a2Jvb2tzL2Nob2NvbGF0ZXkvdmVyc2lvbnMvMC42LjEvZG93bmxvYWQ=/asset
error!
[ERROR]: Reason - invalid distance too far back
ERROR: Zlib::DataError: invalid distance too far back

I added this line:

        puts "Asset url: #{url}"

at the beginning of the same asset method as the above change, i.e. after this line.

The output of that change was Asset url: https://supermarket.chef.io:443/api/v1/cookbooks/chocolatey/versions/0.6.1/download.

Running curl https://supermarket.chef.io:443/api/v1/cookbooks/chocolatey/versions/0.6.1/download:

<html><body>You are being <a href="https://s3.amazonaws.com/community-files.opscode.com/cookbook_ver
sions/tarballs/14098/original/chocolatey20151124-26452-1mt8gr5.tar.gz?1448401863">redirected</a>.</b
ody></html>

I commented out several lines in the asset method that cleanup the downloaded cookbook cache file(s) and directory. I re-ran the install command so I had a copy of the downloaded file.

I ran curl -L -o chocolatey-0.6.1-download https://supermarket.chef.io:443/api/v1/cookbooks/chocolatey/versions/0.6.1/download and compared the file it created with the cache file. The cache file has extra bytes – new line characters.

I believe I have a fix for this.