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

Getting undefined conversion for '' from ASCII-8BIT to US-ASCII from Zlib::GzipWriter#close #1755

Closed
myronmarston opened this issue May 29, 2012 · 2 comments

Comments

@myronmarston
Copy link

# use_zlib.rb

require 'stringio'
require 'zlib'

io = StringIO.new

writer = Zlib::GzipWriter.new(io)
writer << 'th'
writer.close

On a freshly installed rubinius:

➜  ruby --version
rubinius 2.0.0dev (1.9.3 66191c9f yyyy-mm-dd JI) [x86_64-apple-darwin10.8.0]
➜  ruby use_zlib.rb 
An exception occurred running use_zlib.rb
    undefined conversion for '' from ASCII-8BIT to US-ASCII (Rubinius::EncodingClass::Encoding::CompatibilityError)

Backtrace:
       Rubinius::Type.compatible_encoding at kernel/common/type19.rb:28
                                String#<< at kernel/common/string19.rb:397
                           StringIO#write at /Users/myron/.rvm/rubies/rbx-head/lib/19/stringio.rb:124
               Zlib::GzipWriter#write_raw at /Users/myron/.rvm/rubies/rbx-head/lib/zlib.rb:1433
                 Zlib::GzipWriter#end_run at /Users/myron/.rvm/rubies/rbx-head/lib/zlib.rb:1320
     Zlib::GzipFile(Zlib::GzipWriter)#end at /Users/myron/.rvm/rubies/rbx-head/lib/zlib.rb:915
  Zlib::GzipFile(Zlib::GzipWriter)#finish at /Users/myron/.rvm/rubies/rbx-head/lib/zlib.rb:927
   Zlib::GzipFile(Zlib::GzipWriter)#close at /Users/myron/.rvm/rubies/rbx-head/lib/zlib.rb:885
                        Object#__script__ at use_zlib.rb:10
         Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:67
         Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:109
                  Rubinius::Loader#script at kernel/loader.rb:640
                    Rubinius::Loader#main at kernel/loader.rb:844
@myronmarston
Copy link
Author

One strange thing about this: the content being written seems to matter. If you change 'th' to 'abc', it works. No idea why.

@dbussink
Copy link
Contributor

dbussink commented Jul 8, 2012

This has been fixed by switching to MRI's zlib in 9aa6a37

@dbussink dbussink closed this as completed Jul 8, 2012
brixen added a commit that referenced this issue Jan 16, 2018
Updating rubygems-update
Successfully installed rubygems-update-2.7.4
Installing RubyGems 2.7.4

=== 2.6.14 / 2017-10-09

Security fixes:

* Whitelist classes and symbols that are in loaded YAML.
  See CVE-2017-0903 for full details.
  Fix by Aaron Patterson.

=== 2.6.13 / 2017-08-27

Security fixes:

* Fix a DNS request hijacking vulnerability. (CVE-2017-0902)
  Discovered by Jonathan Claudius, fix by Samuel Giddins.
* Fix an ANSI escape sequence vulnerability. (CVE-2017-0899)
  Discovered by Yusuke Endoh, fix by Evan Phoenix.
* Fix a DOS vulnerability in the `query` command. (CVE-2017-0900)
  Discovered by Yusuke Endoh, fix by Samuel Giddins.
* Fix a vulnerability in the gem installer that allowed a malicious gem
  to overwrite arbitrary files. (CVE-2017-0901)
  Discovered by Yusuke Endoh, fix by Samuel Giddins.

=== 2.6.12 / 2017-04-30

Bug fixes:

* Fix test_self_find_files_with_gemfile to sort expected files. Pull
  request #1880 by Kazuaki Matsuo.
* Fix issue for MinGW / MSYS2 builds and testing. Pull request #1879 by
  MSP-Greg.
* Fix gem open to open highest version number rather than lowest. Pull
  request #1877 by Tim Pope.
* Add a test for requiring a default spec as installed by the ruby
  installer. Pull request #1899 by Samuel Giddins.
* Fix broken --exact parameter to gem command. Pull request #1873 by Jason
  Frey.
* [Installer] Generate backwards-compatible binstubs. Pull request #1904
  by Samuel Giddins.
* Fix pre-existing source recognition on add action. Pull request #1883 by
  Jonathan Claudius.
* Prevent negative IDs in output of #inspect. Pull request #1908 by Vít
  Ondruch.
* Allow Gem.finish_resolve to respect already-activated specs. Pull
  request #1910 by Samuel Giddins.

=== 2.6.11 / 2017-03-16

Bug fixes:

* Fixed broken tests on ruby-head. Pull request #1841 by
  SHIBATA Hiroshi.
* Update vendored Molinillo to 0.5.7. Pull request #1859 by Samuel
  Giddins.
* Avoid activating Ruby 2.5 default gems when possible. Pull request #1843
  by Samuel Giddins.
* Use improved resolver sorting algorithm. Pull request #1856 by
  Samuel Giddins.

=== 2.6.10 / 2017-01-23

Bug fixes:

* Fix `require` calling the wrong `gem` method when it is overridden.
  Pull request #1822 by Samuel Giddins.

=== 2.6.9 / 2017-01-20

Bug fixes:

* Allow initializing versions with empty strings. Pull request #1767 by
  Luis Sagastume.
* Fix TypeError on 2.4. Pull request #1788 by Nobuyoshi Nakada.
* Don't output mkmf.log message if compilation didn't fail. Pull request
  #1808 by Jeremy Evans.
* Fixed broken links and overzealous URL encoding in gem server. Pull
  request #1809 by Nicole Orchard.
* Update vendored Molinillo to 0.5.5. Pull request #1812 by Samuel
  Giddins.
* RakeBuilder: avoid frozen string issue. Pull request #1819 by Olle
  Jonsson.

=== 2.6.8 / 2016-10-29

Bug fixes:

* Improve SSL verification failure message. Pull request #1751
  by Eric Hodel.
* Ensure `to_spec` falls back on prerelease specs. Pull request
  #1755 by André Arko.
* Update vendored Molinillo to 0.5.3. Pull request #1763 by
  Samuel Giddins.

=== 2.6.7 / 2016-09-26

Bug fixes:

* Install native extensions in the correct location when using the
  `--user-install` flag. Pull request #1683 by Noah Kantrowitz.
* When calling `Gem.sources`, load sources from `configuration`
  if present, else use the default sources. Pull request #1699
  by Luis Sagastume.
* Fail gracefully when attempting to redirect without a Location.
  Pull request #1711 by Samuel Giddins.
* Update vendored Molinillo to 0.5.1. Pull request #1714 by
  Samuel Giddins.

=== 2.6.6 / 2016-06-22

Bug fixes:

* Sort installed versions to make sure we install the latest version when
  running `gem update --system`. As a one-time fix, run
  `gem update --system=2.6.6`. Pull request #1601 by David Radcliffe.

------------------------------------------------------------------------------

RubyGems installed the following executables:
	/source/rubinius/rubinius/bin/gem

RubyGems system software updated
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

No branches or pull requests

2 participants