Unsupported option optimize_for LITE_RUNTIME crashes compiler
atexit opened this issue · 3 comments
Hi!
When I try running the compiler on a pre-existing proto-file that I am using in a private project the compiler crashes with the following output
ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/decoder.rb:61:in `rescue in decode': error parsing message (ProtocolBuffers::DecodeError)
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/decoder.rb:9:in `decode'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/message.rb:290:in `parse'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/message.rb:296:in `parse'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/field.rb:545:in `deserialize'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/decoder.rb:41:in `decode'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/message.rb:290:in `parse'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/message.rb:296:in `parse'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/field.rb:545:in `deserialize'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/decoder.rb:41:in `decode'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/message.rb:290:in `parse'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/lib/protocol_buffers/runtime/message.rb:296:in `parse'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/gems/ruby-protocol-buffers-1.0.0/bin/ruby-protoc:38:in `<top (required)>'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/bin/ruby-protoc:19:in `load'
from /home/mikael/.rvm/gems/ruby-1.9.2-p180/bin/ruby-protoc:19:in `<main>'
I've narrowed it down to option optimize_for = LITE_RUNTIME;
which even though not supported by this compiler should probably not crash the compiler. :)
Put the following in an otherwise empty .proto-file and it should reproduce the error.
option optimize_for = LITE_RUNTIME;
Oh thanks for the report. The LITE_RUNTIME option was added fairly recently, and our veresion of the protobuf spec (lib/protocol_buffers/compiler/descriptor.*) doesn't know about the option.
Since we don't yet support treating bad enum values as unknown fields, this errors. Other optimize_for values will be ignored as expected, rather than error. I'll look into fixing this soon.
treat unknown enum values as unknown fields, per the spec
closed by 9c45c3e
Wow, that was quick! Really appreciate it, works like a charm. Thanks!