epoch/2 bug in filelock.rb?

  • Thread starter Josef 'Jupp' SCHUGT
  • Start date
J

Josef 'Jupp' SCHUGT

Hi!

With epoch/2 some program of mine without any change applied to the
source that makes use of locks suddenly started to no longer remove
the locks. Replacing

FileLock::LockedFile.open(mbox, "a") {|fp|
by
File.open(mbox, "a") {|fp|

makes everything (except the locks of course) work again. Presently
using that insecure mode :-|

Bug in filelock.rb (VERSION = 0.2) or problem with my stone-old Linux
kernel (2.0.30, yes, really :)?

I am presently using ruby 1.8.0 (2003-08-04) [i586-linux].

Josef 'Jupp' SCHUGT
 
J

Josef 'Jupp' SCHUGT

Hi!

Nobody provided an answer so I did look into the problem.

In _filelock.c

return rb_iv_set(self, "@locked", INT2FIX(st.st_mtime));

must be replaced by

return rb_iv_set(self, "@locked", INT2NUM(st.st_mtime));

For Ruby 1.8

require "final"

must be removed from lib/filelock.rb.

Josef 'Jupp' SCHUGT
 

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top