From: Anders Borch Date: 2003-06-24T00:17:23+09:00 Subject: Re: Marshal bug? Michael Campbell wrote: > --- Dave Thomas wrote: > >>Anders Borch wrote: >> >>>Hi! >>> >>>why is this happening to me: >>> >>>$ irb >>>irb(main):001:0> a=File.new('somefile','r') >> >> ^^ read-only file >> >>>=> # >>>irb(main):002:0> Marshal.dump(a.stat) >>>TypeError: can't dump File::Stat >>> from (irb):2:in `dump' >>> from (irb):2 >>>irb(main):003:0> > > > > Maybe I misread, but I think he was asking why a.stat instance > couldn't be marshalled, not why you couldn't marshal to the file > referenced by 'a', no? > > Changing 'r' to 'w' above anyway yields (for me): > > bash-2.05b$ cat tmp.rb > a=File.new('somefile','w') > Marshal.dump(a.stat) > > bash-2.05b$ ruby -v > ruby 1.8.0 (2003-05-26) [i386-mswin32] > > bash-2.05b$ ruby tmp.rb > tmp.rb:2:in `dump': class File::Stat needs to have instance method > `_dump_data' (TypeError) > from tmp.rb:2 > I have a hard time believing that you cannot dump stats for a readonly file. Anyway im dumping to stdout not a file, just to make sure that there are no misunderstandings there. btw. I have this behavior both with and without irb and both on ruby 1.6.7 (2002-03-01) [i686-linux] and ruby 1.6.8 (2002-12-24) [i686-cygwin] any ideas? (i'd rather not update to 1.8 - at least not before 1.8 comes out of it's "pre" state....) -- dc -e 4dd*od3*dddn1-89danrn10-dan3+ann6*dan*2*an13dn1+dn2-dn3+5*ddan2/9+an13nap