Ah, you talk about symlinks, while the referenced mail talks about hardlinks. That's where my initial confusion came from.
I confirm that mv is not atomic in dapper, hardy and intrepid when using hardlinks:
$ echo foo >foo; echo bar > bar; ln foo foo.backup $ strace mv bar foo [...] access("foo", W_OK) = 0 unlink("foo") = 0 rename("bar", "foo") = 0 [...]
As for symlinks, I used this test case:
$ rm -f *; ln -s file1 link; ln -s file2 link.new; strace -e access,rename,unlink mv link.new link
In Hardy and Intrepid I get the correct behaviour:
rename("link.new", "link") = 0
while in Dapper I get:
unlink("link") = 0 rename("link.new", "link") = 0
I checked the intrepid sources, and this is covered by tests/mv/atomic (with pretty much the same approach).
Ah, you talk about symlinks, while the referenced mail talks about hardlinks. That's where my initial confusion came from.
I confirm that mv is not atomic in dapper, hardy and intrepid when using hardlinks:
$ echo foo >foo; echo bar > bar; ln foo foo.backup
$ strace mv bar foo
[...]
access("foo", W_OK) = 0
unlink("foo") = 0
rename("bar", "foo") = 0
[...]
As for symlinks, I used this test case:
$ rm -f *; ln -s file1 link; ln -s file2 link.new; strace -e access, rename, unlink mv link.new link
In Hardy and Intrepid I get the correct behaviour:
rename("link.new", "link") = 0
while in Dapper I get:
unlink("link") = 0
rename("link.new", "link") = 0
I checked the intrepid sources, and this is covered by tests/mv/atomic (with pretty much the same approach).