nmh-workers
[Top][All Lists]
Advanced

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

Re: [Nmh-workers] Truncated Email.


From: Lyndon Nerenberg
Subject: Re: [Nmh-workers] Truncated Email.
Date: Sun, 6 Mar 2016 14:39:31 -0800

> On Mar 6, 2016, at 10:31 AM, Ken Hornstein <address@hidden> wrote:
> 
>>> (although I see that it uses creat() to truncate a file, rather than
>>> ftruncate(); that seems weird to me?).
>> 
>> And it's a bug it closes creat's FD, freeing the lock.
> 
> Oh, yes, that happens!  Good catch!

Is this an instance of fcntl's completely braindead locking behaviour?  To 
quite FreeBSD fcntl(2):

>      This interface follows the completely stupid semantics of System V and
>      IEEE Std 1003.1-1988 (``POSIX.1'') that require that all locks associated
>      with a file for a given process are removed when any file descriptor for
>      that file is closed by that process.  This semantic means that applica-
>      tions must be aware of any files that a subroutine library may access

This is why I wanted to outlaw the use of fcntl() locking altogether.  
Unfortunately, sometimes even that isn't good enough.  Solaris' flock(3) calls 
fcntl(2) internally.  (I should see if Illumos has finally fixed this.)

You can't make this stuff up.

--lyndon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]