tdtds/kindlegen

Fails to install on Windows

Closed this issue · 0 comments

Way to reproduce:

  1. master branch
  2. Windows
  3. Run rake test

Expected: tests pass

Actual: cp kindlegen.exe ../bin step fails with Errno::ENOENT: No such file or directory @ rb_sysopen - kindlegen.exe

Analysis:

  1. Copying fails because there's no file to copy.
  2. Although file is present in zip file
  3. There are WARNING: skipped <file> as unsafe during unzipping
  4. These warnings come from rubyzip.
  5. rubyzip logic has changed to fix CVE-2018-1000544.

Additional info: this bug also affects kindlegen-3.0.3 and kindlegen-3.0.4 releases. I didn't try other versions.

Verbose output of rake test --trace:

rake test --trace
** Invoke test (first_time)
** Invoke build (first_time)
** Execute build
kindlegen 3.0.4 built to pkg/kindlegen-3.0.4.gem.
** Execute test
Loaded suite C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/rake_test_loader
Started
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
constructing an Installer object with a string is deprecated. Please use Gem::Installer.at (called from: C:/Users/Marat/Documents/kindlegen/test/tes
t_kindlegen.rb:12:in `new')
Building native extensions. This could take a while...
E
====================================================================================================================================================

      9:     kindlegen_lib_dir = nil
     10:     gem_version = File.read(File.join(KINDLEGEN_PROJECT_DIR, 'lib/kindlegen/version.rb')).match(/VERSION = ["'](.*?)["']/)[1]
     11:     gem_file = File.join(KINDLEGEN_PROJECT_DIR, 'pkg', %(kindlegen-#{gem_version}.gem))
  => 12:         result = Gem::Installer.at(gem_file).install rescue Gem::Installer.new(gem_file).install
     13:     begin
     14:       require 'kindlegen'
     15:     rescue ::LoadError
C:/Users/Marat/Documents/kindlegen/test/test_kindlegen.rb:12:in `test_gem_install'
C:/Users/Marat/Documents/kindlegen/test/test_kindlegen.rb:12:in `rescue in test_gem_install'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/installer.rb:320:in `install'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/installer.rb:830:in `build_extensions'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/ext/builder.rb:226:in `build_extensions'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/ext/builder.rb:226:in `each'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/ext/builder.rb:229:in `block in build_extensions'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/ext/builder.rb:181:in `build_extension'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/ext/builder.rb:181:in `synchronize'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/ext/builder.rb:185:in `block in build_extension'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/ext/rake_builder.rb:30:in `build'
C:/tools/ruby26/lib/ruby/2.6.0/rubygems/ext/builder.rb:99:in `run'
Error: test_gem_install(KindlegenTest):
  Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

      current directory: C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/kindlegen-3.0.4/ext
  C:/tools/ruby26/bin/ruby.exe -rrubygems C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/exe/rake RUBYARCHDIR\=C:/tools/ruby26/lib/ruby/gems/2
.6.0/extensions/x64-mingw32/2.6.0/kindlegen-3.0.4 RUBYLIBDIR\=C:/tools/ruby26/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/kindlegen-3.0.4
  mkdir ../bin
  cp kindlegen.exe ../bin
  rake aborted!
  Errno::ENOENT: No such file or directory @ rb_sysopen - kindlegen.exe

  Tasks: TOP => default => install
  (See full trace by running task with --trace)
  open(http://kindlegen.s3.amazonaws.com/kindlegen_win32_v2_9.zip)
  save to kindlegen_win32_v2_9.zip
  win-unzip kindlegen_win32_v2_9.zip
  WARNING: skipped EULA.txt as unsafe
  WARNING: skipped EULA_Chinese.txt as unsafe
  WARNING: skipped EULA_Dutch.txt as unsafe
  WARNING: skipped EULA_French.txt as unsafe
  WARNING: skipped EULA_German.txt as unsafe
  WARNING: skipped EULA_Italian.txt as unsafe
  WARNING: skipped EULA_Japanese.txt as unsafe
  WARNING: skipped EULA_Spanish.txt as unsafe
  WARNING: skipped kindlegen.exe as unsafe
  WARNING: skipped KindleGen Legal Notices 2013-02-19 Windows.txt as unsafe
  WARNING: skipped manual.html as unsafe
  WARNING: skipped docs/german/bekannte probleme.txt as unsafe
  WARNING: skipped docs/german/Versionshinweis.html as unsafe
  WARNING: skipped docs/german/Bittelesen.txt as unsafe
  WARNING: skipped docs/spanish/problemas conocidos.txt as unsafe
  WARNING: skipped docs/spanish/Notas de la version.html as unsafe
  WARNING: skipped docs/spanish/Leerme.txt as unsafe
  WARNING: skipped docs/chinese/Readme.txt as unsafe
  WARNING: skipped docs/chinese/known issues.txt as unsafe
  WARNING: skipped docs/chinese/Release Notes.html as unsafe
  WARNING: skipped docs/italian/problemi noti.txt as unsafe
  WARNING: skipped docs/italian/Note di pubblicazione.html as unsafe
  WARNING: skipped docs/italian/Leggimi.txt as unsafe
  WARNING: skipped docs/dutch/Readme.txt as unsafe
  WARNING: skipped docs/dutch/known issues.txt as unsafe
  WARNING: skipped docs/dutch/Release Notes.html as unsafe
  WARNING: skipped docs/japanese/Readme.txt as unsafe
  WARNING: skipped docs/japanese/known issues.txt as unsafe
  WARNING: skipped docs/japanese/Release Notes.html as unsafe
  WARNING: skipped docs/english/Readme.txt as unsafe
  WARNING: skipped docs/english/known issues.txt as unsafe
  WARNING: skipped docs/english/Release Notes.html as unsafe
  WARNING: skipped docs/french/Lisez-moi.txt as unsafe
  WARNING: skipped docs/french/Notes de version.html as unsafe
  WARNING: skipped docs/french/problemes connus.txt as unsafe

  rake failed, exit code 1

  Gem files will remain installed in C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/kindlegen-3.0.4 for inspection.
  Results logged to C:/tools/ruby26/lib/ruby/gems/2.6.0/extensions/x64-mingw32/2.6.0/kindlegen-3.0.4/gem_make.out
====================================================================================================================================================


Finished in 8.4383249 seconds.
----------------------------------------------------------------------------------------------------------------------------------------------------

1 tests, 0 assertions, 0 failures, 1 errors, 0 pendings, 0 omissions, 0 notifications
0% passed
----------------------------------------------------------------------------------------------------------------------------------------------------

0.12 tests/s, 0.00 assertions/s
rake aborted!
Command failed with status (1): [ruby -w -I"lib;test" -I"C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib" "C:/tools/ruby26/lib/ruby/gems/2.
6.0/gems/rake-12.3.3/lib/rake/rake_test_loader.rb" "test/test_kindlegen.rb" ]
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/testtask.rb:130:in `block (3 levels) in define'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/file_utils.rb:57:in `sh'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/file_utils.rb:105:in `ruby'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/testtask.rb:117:in `block (2 levels) in define'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/file_utils_ext.rb:59:in `verbose'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/testtask.rb:111:in `block in define'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `block in execute'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in `execute'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:235:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:183:in `invoke'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:160:in `invoke_task'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block in top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:125:in `run_with_threads'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:110:in `top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:83:in `block in run'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
C:/tools/ruby26/bin/rake:23:in `load'
C:/tools/ruby26/bin/rake:23:in `<main>'
Tasks: TOP => test