[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

pstore.rb not operating in binmode

Henning Koch

10/4/2004 9:12:00 PM

Hi,

while using the Rails web framework, I came across an
issue with ruby/lib/pstore.rb. Rails uses the PStore class
to store (binary) session data, but Ruby's PStore doesn't
set its streams to binmode.

On Windows this causes PStore to corrupt the binary
session data.

I also posted about the issue to
http://www.rubyonrails.org/show/MarshalDa...

The people in #rubyonrails asked me to post a note to
ruby-talk about this issue.

Bye, Henning

--
Henning Koch
http://w...


4 Answers

Yukihiro Matsumoto

10/4/2004 11:22:00 PM

0

Hi,

In message "Re: pstore.rb not operating in binmode"
on Tue, 5 Oct 2004 06:12:07 +0900, Henning Koch <henning.koch@gmx.net> writes:

|On Windows this causes PStore to corrupt the binary
|session data.
|
|I also posted about the issue to
|http://www.rubyonrails.org/show/MarshalDa...
|
|The people in #rubyonrails asked me to post a note to
|ruby-talk about this issue.

I have no machine that requires "binmode". Does this patch work for
you?

matz.

--- lib/pstore.rb 1 Jul 2004 09:31:37 -0000 1.21
+++ lib/pstore.rb 4 Oct 2004 23:20:53 -0000
@@ -101,2 +101,3 @@ class PStore
file = File.open(@filename, File::RDWR | File::CREAT)
+ file.binmode
file.flock(File::LOCK_EX)
@@ -106,2 +107,3 @@ class PStore
file = File.open(@filename, File::RDONLY)
+ file.binmode
file.flock(File::LOCK_SH)


Gavin Sinclair

10/5/2004 12:30:00 AM

0

On Tuesday, October 5, 2004, 7:12:07 AM, Henning wrote:

> Hi,

> while using the Rails web framework, I came across an
> issue with ruby/lib/pstore.rb. Rails uses the PStore class
> to store (binary) session data, but Ruby's PStore doesn't
> set its streams to binmode.

> On Windows this causes PStore to corrupt the binary
> session data.

> I also posted about the issue to
> http://www.rubyonrails.org/show/MarshalDa...

> The people in #rubyonrails asked me to post a note to
> ruby-talk about this issue.

That's probably the reason I had Instiki failing big-time when running
it under Cygwin. (Binary/non-binary data is often a problem there, as
the directory you're in could be set to use either by default.)

Gavin




gabriele renzi

10/5/2004 8:58:00 AM

0

Henning Koch ha scritto:

> The people in #rubyonrails asked me to post a note to
> ruby-talk about this issue.


that means me :)

I have this feeling that this thing may have been fixed long time ago..
and somewhat reverted.
NOw I wonder: why can't we handle this at the interpreter level?
I mean, adding instead of asking people to add a 'b' every time,
changing windows' file opening calls so that it is included by default.
there is some reason to open files not in binmode?

Henrik Horneber

10/5/2004 9:07:00 AM

0


> there is some reason to open files not in binmode?


Susbstitution of \r\n with \n afaik