epoch/2 bug in filelock.rb?

Discussion in 'Ruby' started by Josef 'Jupp' SCHUGT, Jan 11, 2004.

  1. 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
    --
    http://oss.erdfunkstelle.de/ruby/ - German comp.lang.ruby-FAQ
    http://rubyforge.org/users/jupp/ - Ruby projects at Rubyforge
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Germany 2004: To boldly spy where no GESTAPO / STASI has spied before
     
    Josef 'Jupp' SCHUGT, Jan 11, 2004
    #1
    1. Advertising

  2. BUGFIX for filelock.rb (Was: epoch/2 bug in filelock.rb?)

    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
    --
    http://oss.erdfunkstelle.de/ruby/ - German comp.lang.ruby-FAQ
    http://rubyforge.org/users/jupp/ - Ruby projects at Rubyforge
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Germany 2004: To boldly spy where no GESTAPO / STASI has spied before
     
    Josef 'Jupp' SCHUGT, Jan 14, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Zimmerman

    confused abt FileLock behavior

    David Zimmerman, Jul 28, 2003, in forum: Java
    Replies:
    3
    Views:
    454
  2. Replies:
    0
    Views:
    5,265
  3. Replies:
    4
    Views:
    8,514
    toddwh50
    Mar 11, 2010
  4. alejandrina

    Problem with FileLock

    alejandrina, Jul 13, 2007, in forum: Java
    Replies:
    12
    Views:
    641
    alejandrina
    Jul 30, 2007
  5. Harold Yarmouth

    Apparent bug in FileLock

    Harold Yarmouth, Nov 19, 2008, in forum: Java
    Replies:
    1
    Views:
    343
    Harold Yarmouth
    Nov 20, 2008
Loading...

Share This Page