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

StringIO#seek should work even if String is frozen #119

Closed
headius opened this issue Feb 20, 2025 · 0 comments · Fixed by #121
Closed

StringIO#seek should work even if String is frozen #119

headius opened this issue Feb 20, 2025 · 0 comments · Fixed by #121

Comments

@headius
Copy link
Contributor

headius commented Feb 20, 2025

A regression from #116 only in the JRuby extension.

TestCSVInterfaceReadWrite::DifferentOFS#test_filter:
IOError: not modifiable string
    org/jruby/ext/stringio/StringIO.java:1350:in `seek'
    /Users/headius/work/jruby/lib/ruby/stdlib/csv/parser.rb:683:in `resolve_row_separator'
    /Users/headius/work/jruby/lib/ruby/stdlib/csv/parser.rb:576:in `prepare_separators'
    /Users/headius/work/jruby/lib/ruby/stdlib/csv/parser.rb:442:in `prepare'
    /Users/headius/work/jruby/lib/ruby/stdlib/csv/parser.rb:329:in `initialize'
    org/jruby/RubyClass.java:936:in `new'
    /Users/headius/work/jruby/lib/ruby/stdlib/csv.rb:2824:in `parser'
    /Users/headius/work/jruby/lib/ruby/stdlib/csv.rb:2833:in `parser_enumerator'
    /Users/headius/work/jruby/lib/ruby/stdlib/csv.rb:2554:in `each'
    /Users/headius/work/jruby/lib/ruby/stdlib/csv.rb:1239:in `filter'
    /Users/headius/work/jruby/test/mri/csv/interface/test_read_write.rb:14:in `test_filter'

This CVS test creates a StringIO using a frozen String and later calls StringIO#seek. Changes in #116 incorrectly checked if the String is frozen and raised an error.

The StringIO#seek definition in the JRuby extension shall be modified to allow frozen Strings.

headius added a commit to headius/stringio that referenced this issue Feb 20, 2025
seek only modifies the StringIO pos, and should work when the
underlying String is frozen.

Fixes ruby#119
headius added a commit to headius/stringio that referenced this issue Feb 20, 2025
headius added a commit to headius/stringio that referenced this issue Feb 20, 2025
This fixes the JRuby extension to allow read-only methods to work
against a frozen StringIO, as described in ruby#119.
headius added a commit to headius/stringio that referenced this issue Feb 20, 2025
@kou kou closed this as completed in #121 Feb 21, 2025
@kou kou closed this as completed in 3f90fe4 Feb 21, 2025
matzbot pushed a commit to ruby/ruby that referenced this issue Feb 21, 2025
headius added a commit to headius/jruby that referenced this issue Feb 21, 2025
This updates stringio to 3.1.5, which includes all the fixes from
ruby/stringio#116 and the regression ruby/stringio#119 fixed by
ruby/stringio#121. All CRuby tests and ruby/spec specs for stringio
are now green.

Tests are from v3.1.5 of the ruby/stringio repo.
mrzasa pushed a commit to mrzasa/ruby that referenced this issue Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant