Re: UC Davis Cyrus Incident September 2007

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

 



> Actually, I don't see a deadlock situation at all... I am guessing that
> theorettically, it is possible... but the "ln -sf" option makes the
> overwriting of the symlink an atomic action (as much as it can), which

Not a "deadlock" situation, but a possible "file doesn't exist" error.
In the Unix/POSIX world, symlink will not overwrite an existing file
(man 3 symlink), but rename will do so (man 3 rename), and it will do it
atomically.

So, as an strace shows, this isn't atomic.

$ touch b
$ strace ln -fs a b
...
symlink("a", "b")                       = -1 EEXIST (File exists)
unlink("b")                             = 0
symlink("a", "b")                       = 0
...

But this is:

$ ln -fs a b.tmp
$ strace mv b.tmp b
...
rename("b.tmp", "b")                    = 0
...

Rob

----------
robm@xxxxxxxxxxx
Sign up at http://fastmail.fm for fast, ad free, IMAP accessible email

----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux