mozy/ruby-protocol-buffers

Strange error "incorrect wire type for tag: 5"

midev opened this issue · 6 comments

Hello,

I receive the error "incorrect wire type for tag: 5" when compiling the following message with ruby-protoc. But I don't have this error with the original google compiler:

package MyPackage; 
message MyDate
{
    required uint32 abcde = 1;
}

What is strange is that if I change the field's name from 'abcde' to 'abcd' for example, the message compiles successfully. More generally it looks like the error appears when the field's name is 5 characters long... did I miss something ? thanks !

Marc-André

Can you paste here the exact command line you used to compile this .proto file, and also the output of running protoc --version ? I am able to compile this successfully with ruby-protocol-buffers so I'll need more info to track down what's different in your environment.

Also, what operating system and ruby version are you using?

Windows XP Pro SP3
ruby 1.9.1p430
libprotoc 2.3.0
ruby-protocol-buffers 0.8.4

command line is:
ruby-protoc test.proto
C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/decoder.rb:18:in decode': incorrect wire type for tag: 5 (ProtocolBuffers::DecodeError) from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/message.rb:290:inparse'
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/message.rb:296:in parse' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/field.rb:545:indeserialize'
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/decoder.rb:41:in decode' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/message.rb:290:inparse'
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/message.rb:296:in parse' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/field.rb:545:indeserialize'
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/decoder.rb:41:in decode' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/message.rb:290:inparse'
from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/lib/protocol_buffers/runtime/message.rb:296:in parse' from C:/Ruby191/lib/ruby/gems/1.9.1/gems/ruby-protocol-buffers-0.8.4/bin/ruby-protoc:37:in<top (required)>'
from C:/Ruby191/bin/ruby-protoc:19:in load' from C:/Ruby191/bin/ruby-protoc:19:in

'

sorry I closed the issue by accident..

As stated in the Readme, ruby-protocol-buffers is completely untested in Windows. I'd love to support Windows better in the library, I just don't have easy access to a Windows box for testing. I'll try to track one down and figure out why this is failing on Windows. Ruby 1.9.1 and 1.9.2 are supported, so I think it's got to be Windows related.

I've tracked down the issue, the ruby Tempfile class doesn't open files in "binary mode" by default, which screws things up on windows

write to temporary files in binmode for windows compatibility, closed by 0428bd2