finding ....

D. Tweed tweed@compsci.bristol.ac.uk
Wed, 20 Mar 2002 02:52:09 +0000 (GMT)


[Moved to haskell-cafe]
On Tue, 19 Mar 2002, David Sankel wrote:
> > *everytime* about race conditions. (of course using
> > this existFile before
> > creating a temporary file is wrong, but existFile
> > has *many* other
> > applications)
> 
> Could someone post an example of the creation of a
> temporary file where race conditions are important?

IIRC one of the classic issues is

---------
myscript wants to create a temporary file called /tmp/storedStuff
being half-careful, checks file doesn't exist
(*) miniscule delay occurs
creates a new file called /tmp/storedStuff
---------

creating a new file generally deletes a file of the same without causing
any errors since this is often the desired semantics

All this is ok until a malicious person manages to get

ln -s /home/sankel/reallyImportantUnbackedupData /tmp/storedStuff

in the interval denoted by (*)

___cheers,_dave_________________________________________________________
www.cs.bris.ac.uk/~tweed/|`...heat generated by its microprocessors will
email:tweed@cs.bris.ac.uk|slope upward exponentially, reaching the power
work tel:(0117) 954-5250 |density of a nuclear reactor before 2010'-Intel