[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#526195: perl: flock locking should be implemented in terms of fcntl



On Sat, May 02, 2009 at 11:03:33PM +0300, Niko Tyni wrote:
> (Cc'ing Roger just in case he's not subscribed to the list.)

Thanks, I am indeed not subscribed.

> On Wed, Apr 29, 2009 at 04:05:23PM -0700, Russ Allbery wrote:
> > Roger Leigh <rleigh@debian.org> 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
> for us.

OK.  If there's not any alternative method for using flock locks,
then there isn't really any other choice here.

> 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:
> 
>  http://www.nntp.perl.org/group/perl.perl5.porters/2006/01/msg108539.html
> 
> so pursuing that further seems like a good first step.

That would be great.  It's not currently possible to portably use
fcntl directly (which would be preferable IMO to the -Ud_flock
workaround).


Thanks,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.


Reply to: