You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/10/26 15:54:03 UTC
[GitHub] jthomas opened a new issue #14: Zip files without explicit
directories entries fails to extract.
jthomas opened a new issue #14: Zip files without explicit directories entries fails to extract.
URL: https://github.com/apache/incubator-openwhisk-runtime-ruby/issues/14
I've discovered a bug that deploying actions from a zip file fails to extract unless the zip files contain all the explicit directory entries for all sub-directories for files.
Here's the content of a zip file that files to extract.
```
$ unzip -l minimal.zip
Archive: minimal.zip
Length Date Time Name
--------- ---------- ----- ----
310 01-01-1980 00:00 bundle/bundler/setup.rb
28160 01-01-1980 00:00 bundle/ruby/2.5.0/cache/betterlorem-0.1.2.gem
15009 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/doc/BetterLorem.html
246 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/doc/created.rid
2340 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/doc/index.html
23653 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/doc/lorem_txt.html
9608 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/doc/rdoc.css
2032 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/doc/table_of_contents.html
3567 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/lib/betterlorem.rb
21288 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/lib/lorem.txt
657 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/spec/betterlorem_spec.rb
736 01-01-1980 00:00 bundle/ruby/2.5.0/gems/betterlorem-0.1.2/spec/spec_helper.rb
778 01-01-1980 00:00 bundle/ruby/2.5.0/specifications/betterlorem-0.1.2.gemspec
243 10-26-2018 14:47 main.rb
--------- -------
108627 14 files
```
This fails when on this [line](https://github.com/apache/incubator-openwhisk-runtime-ruby/blob/master/core/ruby2.5Action/rackapp/init.rb#L87) because the sub-directory ` bundle/bundler/` does not exist. Zip archives do not have to contain the subdirectory entries for files.
There's a relatively easy fix for this... Change the extraction code to make sure all sub-dirs exist.
```ruby
zip.each do |file|
f_path = "output/" + file.name
FileUtils.mkdir_p(File.dirname(f_path))
zip.extract(file, f_path)
end
```
I'll work on a PR next week....
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services