From: Jonas Hartmann Date: 2005-06-25T13:58:55+09:00 Subject: Re: FSDB, Apache, FastCGI - ERROR: FSDB::Database::DirIsImmutableError Joel VanderWerf wrote: > Jonas Hartmann wrote: > >> The test scripts, that are supplied by FSDB throw some errors as well; >> see: http://rafb.net/paste/results/9gxy2a55.html >> >> again: how do i start debugging, whats the way to go? >> >> Jonas > > > Aside from the file ownership issue, the EISDIR is a real problem. > You're running on OS X, I see? A few months ago, a Tristan O'Tierney was > trying to run FSDB on OSX and ran into the same thing: flock() on a dir > raises EISDIR. > > Here's a suggestion that seemed to solve the problem for him: > >> I've never had a chance to try fsdb on darwin, but I suspect that >> there are the usual minor variations in what the file system allows >> and what errors it reports. There's already some code in fsdb to >> account for the difference between WinME, Win2K, Linux, and Solaris. >> Locking is especially hard to do portably. >> >> One thing you might try first is to use fcntl locks instead of flock. >> It's easy to switch--just create your database like this: >> >> require 'fsdb/fcntl_lock' # this will be unnnecessary in future FSDB >> versions >> >> db = FSDB::Database.new dir, :lock_type => :fcntl_lock >> >> Whether that works or not, it's probably a good idea for me to patch >> the locking code to avoid trying to lock dirs, if that operation >> fails on darwin. Or it could just always use fcntl, if that works. >> >> The odd thing is that I don't see anything on the man pages >> (http://www.manpages.info/macosx/flock.2.html) saying that flock >> fails on dirs. > > > But I'm not sure that completely solved the problem, and I haven't been > able to get a darwin machine to test on. Would you mind trying the above > suggestion? > > One thing to watch out for: the fcntl-lock is a C extension (code thanks > to Ara!), which is why it's not the default. But I dunno if it builds on > darwin. So, if the suggestion above doesn't work, let me know what > output you get for the config/setup process. > > Thanks! Warning: I have no clue how to use C-Extensions in ruby. I did not plan to do so soon ;-(. I have modified the code in my "db_connect.rb" (within that folder there is a fsdb folder that holds the complete fsdb 0.4 directory as in previous examples) $LOAD_PATH.insert(-1, "./fsdb/lib") require 'fsdb.rb' require 'fsdb/ext/fsdb/fcntl_lock' # this will be unnnecessary in # future FSDB versions db = FSDB::Database.new('tmp/my-data', :lock_type => :fcntl_lock) # added ^^^^^^^^^^^^^^^^^^^^^^^^^^^ I don't know if I did that right... it throws no error on terminal. But it does throw one via www user: -- ERROR: Insecure operation - directory? -- BACKTRACE: /usr/local/lib/ruby/1.8/ftools.rb:204:in `directory? /usr/local/lib/ruby/1.8/ftools.rb:204:in `makedirs /usr/local/lib/ruby/1.8/ftools.rb:202:in `each /usr/local/lib/ruby/1.8/ftools.rb:202:in `makedirs /usr/local/lib/ruby/site_ruby/1.8/fsdb/database.rb:147:in `initialize /Library/WebServer/Documents/ruby/db_connect.rb:9:in `new /Library/WebServer/Documents/ruby/db_connect.rb:9/usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `load /usr/local/lib/ruby/1.8/apache/ruby-run.rb:53:in `handler