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

LocalJumpError when creating enumerator inside GzipReader.open block #4443

Closed
manu-crealytics opened this Issue Jan 16, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@manu-crealytics
Contributor

manu-crealytics commented Jan 16, 2017

Environment

  • JRuby version:
    • jruby -v: jruby 9.1.7.0 (2.3.1) 2017-01-11 68056ae Java HotSpot(TM) 64-Bit Server VM 25.73-b02 on 1.8.0_73-b02 +jit [linux-x86_64]
    • No flags or JRUBY_OPTS
  • Operating system and platform
    • uname -a: Linux manu-dm 4.4.0-45-generic #66~14.04.1-Ubuntu SMP Wed Oct 19 15:05:38 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Expected Behavior

Creating enumerators inside GZipReader blocks should not crash. The simple example below works fine (doesn't crash) on MRI 2.3.0:

# /tmp/local_jump_error.rb
require 'zlib'

# echo | gzip > /tmp/somefile.gz
Zlib::GzipReader.open('/tmp/somefile.gz') do |f|
    e = f.each_line
    # ...
end

Actual Behavior

Instead, a LocalJumpError exception is raised:

LocalJumpError: yield called out of block
                          each at org/jruby/ext/zlib/JZlibRubyGzipReader.java:617
                     each_line at org/jruby/ext/zlib/JZlibRubyGzipReader.java:628
  block in local_jump_error.rb at local_jump_error.rb:6
                          open at org/jruby/ext/zlib/JZlibRubyGzipReader.java:99
                        <main> at local_jump_error.rb:5

Note that using File.open instead of Zlib::GzipReader.open does not raise any error.

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jan 17, 2017

Member

Confirmed! This is simply GzipReader#each not returning an enum when you don't pass a block.

Member

headius commented Jan 17, 2017

Confirmed! This is simply GzipReader#each not returning an enum when you don't pass a block.

@headius headius added this to the JRuby 9.1.8.0 milestone Jan 17, 2017

@headius headius closed this in e1676dc Jan 17, 2017

@headius

This comment has been minimized.

Show comment
Hide comment
@headius

headius Jan 17, 2017

Member

This is fixed but we should have tests for the enumerator-producing methods in GzipReader. @manu-crealytics perhaps you could add some to https://github.com/ruby/spec?

Member

headius commented Jan 17, 2017

This is fixed but we should have tests for the enumerator-producing methods in GzipReader. @manu-crealytics perhaps you could add some to https://github.com/ruby/spec?

@manu-crealytics

This comment has been minimized.

Show comment
Hide comment
@manu-crealytics

manu-crealytics Jan 18, 2017

Contributor

@headius Sure, I'll look into that this week. Thanks for the quick fix :)

Contributor

manu-crealytics commented Jan 18, 2017

@headius Sure, I'll look into that this week. Thanks for the quick fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment