Urs Thuermann <[EMAIL PROTECTED]> writes:
> $ strace mv foo bar
Hmm, your email's "Subject:" line says "mv -f" but this strace doesn't.
I'll assume for now that you meant to write about plain "mv", not "mv -f".
> lstat64("bar", 0xbffff904) = -1 ENOENT (No such file or directory)
> rename("foo", "bar") = 0
> This check, however, is not sufficient as a file named bar could be
> created between the calls to lstat(2) and rename(2).
In general, mv is not (and is not supposed to be) immune to race
conditions like that. If two processes are futzing around in the same
directory, bad things normally can happen with the standard utilities.
There are some exceptions, but this isn't one of them.
> If the source is not a directory, a better solution, suggested in
> comp.unix.internals, is to use link(2)
But POSIX requires "mv" to behave as if it called rename(), not link().
See <http://www.opengroup.org/onlinepubs/000095399/utilities/mv.html>.
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils