|Subject:||bug#25342: GNU coreutils: race condition in "ln -f source dest"|
|Date:||Mon, 2 Jan 2017 21:37:58 -0800|
|User-agent:||Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1|
Mirsad Goran Todorovac wrote:
It would suffice that: linkat (AT_CWDFD, source, AT_CWDFD, dest, 0) == 0 || unlink (dest) == 0 && linkat (AT_CWDFD, source, AT_CWDFD, dest, 0) == 0; be replaced with: linkat (AT_CWDFD, source, AT_CWDFD, dest_tmp, 0) == 0 && renameat (AT_CWDFD, dest_tmp, AT_CWDFD, dest) == 0;
It isn't that simple, since renameat is a no-op if the source and destination are already hard links. So the patch you sent in would not work.
Anyway, I'm not disagreeing with the basic idea, I'm merely saying I don't see why we should have an option to keep the old behavior. Anybody who really wants the old behavior can do 'rm -f new && ln old new' instead.
|[Prev in Thread]||Current Thread||[Next in Thread]|