Project

General

Profile

Backport #5311

PStore fails to save data when default encodings are set

Added by camerooni (Cameron Pope) about 8 years ago. Updated almost 8 years ago.

Status:
Closed
Priority:
Normal
[ruby-core:39503]

Description

When PStore opens its data files, it does so using the File::BINARY flag, which ensures that Windows will not do cr-lf conversions, but it does not ensure that file#external_encoding is ASCII_8BIT (Binary). That means that under certain circumstances (when Encoding.internal_encoding is defined) that PStore will sometimes raise errors when writing to disk because Marshal.dump will emit a byte sequence that is not valid with the file's external encoding.

To illustrate, I've submitted a patch that contains a test that fails in Ruby 1.9.x, but passes with the minor change to PStore: to specify external_encoding when opening its data files.


Files

pstore_ensure_binary.patch (1.28 KB) pstore_ensure_binary.patch patch to lib/pstore.rb and to test/pstore_test.rb camerooni (Cameron Pope), 09/13/2011 12:28 PM

Associated revisions

Revision f7081431
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 33264
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

Revision 33264
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

Revision 33264
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

Revision 33264
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

Revision 33264
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

Revision 33264
Added by nobu (Nobuyoshi Nakada) about 8 years ago

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

Revision 587016b4
Added by yugui (Yuki Sonoda) almost 8 years ago

merges r33264 from trunk into ruby_1_9_3.

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@33440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 33440
Added by yugui (Yuki Sonoda) almost 8 years ago

merges r33264 from trunk into ruby_1_9_3.

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

History

#1

Updated by nobu (Nobuyoshi Nakada) about 8 years ago

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

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


  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]
#2

Updated by nobu (Nobuyoshi Nakada) about 8 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport193
  • Status changed from Closed to Assigned
  • Assignee set to yugui (Yuki Sonoda)
  • Target version deleted (2.0.0)

Updated by kosaki (Motohiro KOSAKI) almost 8 years ago

this seems no regression.

#4

Updated by yugui (Yuki Sonoda) almost 8 years ago

  • Status changed from Assigned to Closed

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


merges r33264 from trunk into ruby_1_9_3.

  • lib/pstore.rb (PStore): always open in binary mode even if default encodings are set. [Bug #5311] [ruby-core:39503]

Also available in: Atom PDF