Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set string encoding after reading a heap_mapped_string #201

Merged
merged 1 commit into from Jan 27, 2021

Conversation

casperisfine
Copy link

Fix #200

I think the bug was introduced in #196

@tagomoris

@tagomoris
Copy link
Member

Thank you! I'll release this quickly as 1.4.1.

@tagomoris
Copy link
Member

The test fails on my laptop (Ruby 3.0.0):

MBA:msgpack-ruby tagomoris$ bundle exec rake
cp ChangeLog tmp/x86_64-darwin19/stage/ChangeLog
cp README.md tmp/x86_64-darwin19/stage/README.md
cp Rakefile tmp/x86_64-darwin19/stage/Rakefile
cp ext/msgpack/buffer.h tmp/x86_64-darwin19/stage/ext/msgpack/buffer.h
cp lib/msgpack/version.rb tmp/x86_64-darwin19/stage/lib/msgpack/version.rb
cp msgpack.gemspec tmp/x86_64-darwin19/stage/msgpack.gemspec
cp spec/unpacker_spec.rb tmp/x86_64-darwin19/stage/spec/unpacker_spec.rb
install -c tmp/x86_64-darwin19/msgpack/3.0.0/msgpack.bundle lib/msgpack/msgpack.bundle
cp tmp/x86_64-darwin19/msgpack/3.0.0/msgpack.bundle tmp/x86_64-darwin19/stage/lib/msgpack/msgpack.bundle
/Users/tagomoris/.rbenv/versions/3.0.0/bin/ruby -I/Users/tagomoris/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rspec-core-3.10.1/lib:/Users/tagomoris/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rspec-support-3.10.1/lib /Users/tagomoris/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\{,cruby/\}\*_spec.rb -c -f progress -Ilib
buffer_io random seed: 0xfbc2fd48f5d2c0dd3b118bc789d6a317
buffer random seed: 0x2d386d09027536ed4c07edf40e43dfcc
....................................................................................................................................................................................................................................*....................................................................................................................................................F.........

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) MessagePack with other things rasies an error on #unpack with garbage
     # but nothing was raised. why?
     # ./spec/msgpack_spec.rb:118


Failures:

  1) MessagePack::Unpacker regressions preserve string encoding (issue #200)
     Failure/Error: MessagePack.unpack(MessagePack.pack(string)).encoding.should == string.encoding
     
       expected: #<Encoding:UTF-8>
            got: #<Encoding:ASCII-8BIT> (using ==)
       Diff:
       @@ -1 +1 @@
       -#<Encoding:UTF-8>
       +#<Encoding:ASCII-8BIT>
       
     # ./spec/unpacker_spec.rb:643:in `block (3 levels) in <top (required)>'

Finished in 7.85 seconds (files took 0.29418 seconds to load)
387 examples, 1 failure, 1 pending

Failed examples:

rspec ./spec/unpacker_spec.rb:638 # MessagePack::Unpacker regressions preserve string encoding (issue #200)

/Users/tagomoris/.rbenv/versions/3.0.0/bin/ruby -I/Users/tagomoris/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rspec-core-3.10.1/lib:/Users/tagomoris/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rspec-support-3.10.1/lib /Users/tagomoris/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rspec-core-3.10.1/exe/rspec --pattern spec/\{,cruby/\}\*_spec.rb -c -f progress -Ilib failed

@casperisfine
Copy link
Author

👀

@tagomoris
Copy link
Member

Sorry, I tested with 1.4.0 without recompiling the code of this branch. It passes after rake clean.

@tagomoris tagomoris merged commit aff97b6 into msgpack:master Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in 1.4.0: encoding is not preserved for strings longer than 255 bytes
3 participants