swarajban / npm-cache

Cache (npm | bower | composer | jspm) installs
MIT License
168 stars 57 forks source link

incorrect header check when archiving dependencies #82

Open bperel opened 8 years ago

bperel commented 8 years ago

Since npm-cache 0.6.5 I get the following during the archive installation step, both with NPM and Composer dependencies :

+ npm-cache install npm composer -o --no-dev
[npm-cache] [INFO] using /home/jenkins/.package_cache as cache directory
[npm-cache] [INFO] [npm] config file exists
[npm-cache] [INFO] [npm] cli exists
[npm-cache] [INFO] [npm] hash of /home/jenkins/workspace/package.json: aff3389be4d2ecd30d2de737b8b14c66
[npm-cache] [INFO] [npm] cache exists
[npm-cache] [INFO] [npm] clearing installed dependencies at /home/jenkins/workspace/node_modules
[npm-cache] [INFO] [npm] ...cleared
[npm-cache] [INFO] [npm] retrieving dependencies from /home/jenkins/.package_cache/npm/3.6.0/aff3389be4d2ecd30d2de737b8b14c66.tar.gz
[npm-cache] [INFO] [composer] config file exists
[npm-cache] [INFO] [composer] cli exists
[npm-cache] [INFO] [composer] hash of /home/jenkins/workspace/composer.json: e90464139973d63755d99dcb8d35f118
[npm-cache] [INFO] [composer] running [composer install -o --no-dev]...
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Updating dependencies
  - Installing symfony/event-dispatcher (v2.8.13)
    Loading from cache
[...]
Writing lock file
Generating optimized autoload files
[npm-cache] [INFO] [composer] installed composer dependencies, now archiving
[npm-cache] [INFO] [composer] archiving dependencies from /home/jenkins/workspace/vendor
events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: incorrect header check
    at Zlib._handle.onerror (zlib.js:363:17)
+ composer dump-autoload
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Generating autoload files
+ npm-cache install bower
[npm-cache] [INFO] using /home/jenkins/.package_cache as cache directory
[npm-cache] [INFO] [bower] bower_components located at vendor per bowerrc
[npm-cache] [INFO] [bower] config file exists
[npm-cache] [INFO] [bower] cli exists
[npm-cache] [INFO] [bower] hash of /home/jenkins/web_workspace_for_deployment/remote/development/bower.json: 6bca9b55de37340346d471ae12ec0f32
[npm-cache] [INFO] [bower] cache exists
[npm-cache] [INFO] [bower] clearing installed dependencies at /home/jenkins/web_workspace_for_deployment/remote/development/vendor
[npm-cache] [INFO] [bower] ...cleared
[npm-cache] [INFO] [bower] retrieving dependencies from /home/jenkins/.package_cache/bower/1.4.1/6bca9b55de37340346d471ae12ec0f32.tar.gz
events.js:154
      throw er; // Unhandled 'error' event
      ^

Error: incorrect header check
    at Zlib._handle.onerror (zlib.js:363:17)
bperel commented 8 years ago

If I rollback to 0.6.4 I have no error

vladimiry commented 8 years ago

I just found out that 0.6.5 does create archives with no node_modules/bower_components/etc structure inside an archive, ie plain structure is placed into the archive. Previous versions created modules structure inside the archives. So looks like a bug or absence of the backward compatibility (in this case it will probably become working after dropping existing cache).

Also currently new library is used for archives unpacking, so there is a chance that this new archiving library does not support existing archives created with previously used archiving library.

vladimiry commented 8 years ago

I just checked, 0.6.5 doesn't handle archives created by previous versions, got the same error as in first message. But it works well with archives created by itself, so looks like a backward compatibility issue.

vladimiry commented 8 years ago

3 issues which I'm going to handle:

All archives created by the 0.6.5 version will have to be invalidated and removed.

vladimiry commented 8 years ago

This is a PR with quick fix https://github.com/swarajban/npm-cache/pull/84

vladimiry commented 8 years ago

@bperel would be fine you confirm that fix works for you, thanks.

bperel commented 8 years ago

LGTM