kaitai-io / kaitai_struct_visualizer

Kaitai Struct: visualizer and hex viewer tool
https://rubygems.org/gems/kaitai-struct-visualizer
GNU General Public License v3.0
280 stars 25 forks source link

Fails to start #16

Closed gyrodave closed 7 years ago

gyrodave commented 7 years ago

Can't get the visualizer to start. Tried several versions of ruby, no success... Here is the console output :

/home/dave/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': no implicit conversion of nil into String (TypeError)
    from /home/dave/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer_main.rb:31:in `block in compile_format'
    from /home/dave/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tmpdir.rb:89:in `mktmpdir'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer_main.rb:10:in `compile_format'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer.rb:18:in `initialize'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/bin/ksv:19:in `new'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/bin/ksv:19:in `<top (required)>'
    from /home/dave/.rvm/gems/ruby-2.4.0/bin/ksv:22:in `load'
    from /home/dave/.rvm/gems/ruby-2.4.0/bin/ksv:22:in `<main>'
    from /home/dave/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
    from /home/dave/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
GreyCat commented 7 years ago

You seem to be using a pretty old ksv - that's 0.5. Which versions of ksc and KS ruby runtime do you use - i.e. please check something like that:

$ ksc --version
kaitai-struct-compiler 0.7
$ ruby -rkaitai/struct/struct -e 'puts Kaitai::Struct::VERSION'
0.7
gyrodave commented 7 years ago

Thanks for the quite reply !

Looks like I'm all on 0.7

$ ksc --version
kaitai-struct-compiler 0.7
$ ruby -rkaitai/struct/struct -e 'puts Kaitai::Struct::VERSION'
0.7

Here is the full error :

ksv test.gif gif.ksy 
/types/header/seq/1/encoding: unknown key found, expected: consume, contents, doc, doc-ref, eos-error, id, if, include, parent, process, repeat, size, size-eos, terminator, type
Compilation OK
/home/dave/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': no implicit conversion of nil into String (TypeError)
    from /home/dave/.rvm/rubies/ruby-2.4.0/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer_main.rb:31:in `block in compile_format'
    from /home/dave/.rvm/rubies/ruby-2.4.0/lib/ruby/2.4.0/tmpdir.rb:89:in `mktmpdir'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer_main.rb:10:in `compile_format'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/lib/kaitai/struct/visualizer/visualizer.rb:18:in `initialize'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/bin/ksv:19:in `new'
    from /home/dave/.rvm/gems/ruby-2.4.0/gems/kaitai-struct-visualizer-0.5/bin/ksv:19:in `<top (required)>'
    from /home/dave/.rvm/gems/ruby-2.4.0/bin/ksv:22:in `load'
    from /home/dave/.rvm/gems/ruby-2.4.0/bin/ksv:22:in `<main>'
    from /home/dave/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
    from /home/dave/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
GreyCat commented 7 years ago

There are 2 problems here:

  1. Compiler is complaining about something's being wrong with ksy file on path /types/header/seq/1/encoding:
/types/header/seq/1/encoding: unknown key found, expected: consume, contents, doc, doc-ref, eos-error, id, if, include, parent, process, repeat, size, size-eos, terminator, type

This was indeed a problem with gif.ksy (which went ok with older compiler, but modern ksc revealed a bogus combination of keys). I've updated it, please update your gif.ksy as well.

  1. Older ksv used with newer ksc. If you're using ksc and runtime of v0.7, please use newer ksv as well. Unfortunately, it's not (yet) published to ruby gems, so please do something like:
git clone https://github.com/kaitai-io/kaitai_struct_visualizer
cd kaitai_struct_visualizer
gem build kaitai-struct-visualizer.gemspec
gem install kaitai-struct-visualizer-0.7.gem
gyrodave commented 7 years ago

Gif.ksy that was faulty in the context of version 0.7.

It is working fine now !