Re: Bug#526195: perl: flock locking should be implemented in terms of fcntl
(Cc'ing Roger just in case he's not subscribed to the list.)
On Wed, Apr 29, 2009 at 04:05:23PM -0700, Russ Allbery wrote:
> Roger Leigh <email@example.com> writes:
> > Apparently, it's possible to configure perl with -Ud_flock (I think
> > that's the correct option) to make it emulate flock() with fcntl(2).
> > If there are no compatibility reasons to switching to fcntl for more
> > robust locking, it might be a nice improvement to use this option.
> > pp_sys.c shows the necessary configured options to select the desired
> > behaviour.
> > Perl itself offers only a high-level interface which is implementable
> > using either low-level system interface, so well-written Perl programs
> > should work using either mechanism. The only potential gotcha is that
> > some programs might be written to rely on the specific subtle
> > semantics of one implementation. However, having fcntl(2)-compatible
> > locks rather than old-style flock(2) locks is (IMHO) preferable on a
> > modern system.
> Currently, Perl allows one to use either flock or fcntl so that one can
> pick the locking mechanism that works with whatever application is also
> attempting to use the lock. I think that if this proposed change were
> made, we'd be left without a way to do flock, yes?
Yes, I think so too, and that would mean -Ud_flock is not a viable option
It seems the best we can do is to improve ways to do fcntl locks.
Brendan had a patch for Fcntl to provide a function to pack/unpack
flock structures, but it never made it in:
so pursuing that further seems like a good first step.
Niko Tyni firstname.lastname@example.org