rename()

Nick Burrett nick at sqrt.co.uk
Mon Aug 16 01:55:25 PDT 2004


Stefan Bellon wrote:
> John Tytgat wrote:
>>I guess if pthread switching is disabled and you make sure no
>>callbacks can kick in (running in SVC mode ?), I think you have what
>>you want to have.  Any particular usecase where this is wanted ?
> 

> In GnuPG a race condition of two concurrent GnuPG processes was
> discovered. GnuPG expects rename(a,b) to move a to b even if b exists.

Though it is feasible in many ways within UnixLib to support this (one 
possibility would be to add a locking SWI to the UnixLib module), we 
cannot prevent the external modification of a file by another 
application, like the Filer or a SharedCLib application occuring at the 
same time.

> Not that this race condition would matter as I doubt many people use
> GnuPG on RISC OS, let alone two processes running at the same time, but
> nevertheless, I think rename() should be "fixed" in UnixLib to do what
> SUSv3 says.

You're right; it should be.  Since it is that and the POSIX standards 
that we are attempting to follow.


Nick.



More information about the gcc mailing list