Project

General

Profile

Actions

Backport #5311

closed

PStore fails to save data when default encodings are set

Added by camerooni (Cameron Pope) over 12 years ago. Updated over 12 years ago.

Status:
Closed
[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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0