
On 25/07/15 21:09, Donn Cave wrote:
But there are other things that could turn up. For example, you could use flock(2) (Berkeley, not POSIX fcntl lock) to keep an advisory file lock until the exec exits. If the file is closed prematurely, you lose the lock, and ... whatever happens then.
This is a very valid point. Applications that rely on this will break by changing the default here. I'm wondering though whether this is an acceptable price to pay for better (in my opinion) defaults. Given enough announcement and time, it should not be too difficult to find Berkeley flock() invocations, and explicitly fnctl their FDs to CLOEXEC=False, or open() them with CLOEXEC=False. I would even be surprised if there is a single Haskell program out there that uses this; I know of one that uses file locking, bu that's using fnctl style locks.