Project

General

Profile

Actions

Bug #6209

closed

Marshal.load unable to load previously marshaled data: invalid encoding symbol (EncodingError)

Bug #6209: Marshal.load unable to load previously marshaled data: invalid encoding symbol (EncodingError)

Added by octplane (Pierre B) over 13 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.3.0]
Backport:
[ruby-core:43762]

Description

=begin

= Description

A ruby object (generated with the Classifier gem) is Marshalled on the disk.

When reloaded, the ruby interpreter crashes with the following error:

test-case.rb:8:in load': invalid encoding symbol (EncodingError) from test-case.rb:8:in block in '
from test-case.rb:7:in open' from test-case.rb:7:in '

The marshalled data has been generated using the classifier gem and the provided test-case and test-file

= Expected Behaviour

Ruby reloads the Marshalled data without error

= Step to reproduce

  • Install the classifier gem.
  • Ensure . does not contain classifier.data
  • run (({ruby test-case.rb}))
  • Check classifier.data exists
  • run (({ruby test-case.rb}))
  • the runtime crashed

=end


Files

test-case.rb (378 Bytes) test-case.rb The test case source octplane (Pierre B), 03/28/2012 01:04 AM
test-file.rb (5.13 KB) test-file.rb The parameter file read by the test case octplane (Pierre B), 03/28/2012 01:04 AM
classifier.data (2.83 KB) classifier.data The broken Marshaled data octplane (Pierre B), 03/28/2012 01:04 AM

Updated by nobu (Nobuyoshi Nakada) over 13 years ago Actions #1 [ruby-core:43792]

=begin
The minimal code would be:
Marshal.load(Marshal.dump("\xff".force_encoding("ascii-8bit").intern))
=end

Updated by nobu (Nobuyoshi Nakada) over 13 years ago Actions #2

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r35157.
Pierre, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • marshal.c (r_symreal): default to ASCII-8BIT for non-ascii symbols,
    otherwise it should be converted to US-ASCII in rb_intern_str() if
    possible. [ruby-core:43762][Bug #6209]

Updated by nobu (Nobuyoshi Nakada) over 13 years ago Actions #3 [ruby-core:43793]

Note that fast-stemmer doesn't seem to support 1.9 yet.

Updated by ninguno (ninguno ninguno) over 13 years ago Actions #4 [ruby-core:44976]

I'm having this issue in ruby 1.9.2 p320. Is the bug resolved in any of the available releases?

Thanks in advance!

Actions

Also available in: PDF Atom