Is flock broken on solaris?

I might be totally off here, but are you using NFS by any chance? According
to some posts I’ve read on comp.unix.solaris, flock is just plain busted on
NFS.

Regards,

Dan

···

-----Original Message-----
From: Joel VanderWerf [mailto:vjoel@PATH.Berkeley.EDU]
Joel VanderWerf wrote:

        File.read($path)

I should have pointed out that the File.read call (within the lock
context) is necessary to the problem. I wonder if that gives up the
lock? Because doing the following immediately after the read seems to
fix the problem:

         f.flock(File::LOCK_EX)

So this suggests that file locks are nestable on linux but not on
solaris. The man pages say that solaris flock is implemented
in terms of
fcntl, so maybe that’s where the semantic difference comes from…

I wonder if there is a way ruby can insulate us from this difference?

Berger, Daniel wrote:

I might be totally off here, but are you using NFS by any chance? According
to some posts I’ve read on comp.unix.solaris, flock is just plain busted on
NFS.

I’ve heard about flock/NFS/Linux problems, but I thought on Solaris
flock was ok because it’s based on fcntl.

Anyway, I’m using /tmp, which is local. But thanks for mentioning it.

I’ve got my code working now–I just avoid doing File#read in the
context of another lock.