From: fitmap@163.com Date: 2017-10-01T05:36:36+00:00 Subject: [ruby-core:83072] [Ruby trunk Bug#13959] IO.write(filename, Marshal.dump(obj), :encoding => 'binary') != File.open(filename, 'wb') { |fil| Marshal.dump(obj, fil) } Issue #13959 has been reported by fitmap (Justin Peal). ---------------------------------------- Bug #13959: IO.write(filename, Marshal.dump(obj), :encoding => 'binary') != File.open(filename, 'wb') { |fil| Marshal.dump(obj, fil) } https://bugs.ruby-lang.org/issues/13959 * Author: fitmap (Justin Peal) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x64-mingw32] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- For some complex objects, IO.write(filename, Marshal.dump(obj), :encoding => 'binary') and File.open(filename, 'wb') { |fil| Marshal.dump(obj, fil) } can create different file content, and these files can't load each other by Marshal.load(IO.read(filename, :encoding => 'binary')) and File.open(filename, 'rb') { |fil| return Marshal.load(fil) } Detail is in the attached. ---Files-------------------------------- test.rb (3.13 KB) test.txt (1.91 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: