Re: rename("a", "b") would not always remove "a" on success. ?!!
From: Denys Vlasenko
Date: Fri Oct 28 2011 - 21:02:44 EST
On Friday 28 October 2011 17:42, Eric Blake wrote:
> On 10/28/2011 09:32 AM, Pádraig Brady wrote:
> >> http://pubs.opengroup.org/onlinepubs/9699919799/functions/rename.html
> >>
> >> 'If the old argument and the new argument resolve to either .... or different
> >> directory entries for the same existing file, rename() shall return
> >> successfully and perform no other action.'
> >>
> >> It's incredible they had audacity to put such nonsense into standard.
> >>
> >> The page says in "RATIONALE" section:
> >>
> >> 'The specification that if old and new refer to the same file is
> >> intended to guarantee that:
> >>
> >> rename("x", "x");
> >>
> >> does not remove the file.'
> >>
> >> Why didn't they just explicitly say that they actually want THIS
> >> particular case to work correctly, not OTHER cases to be fucked up?!
>
> Because it is historical precedent, and changing it now would break
> software that has come to expect this behavior on hard links.
There is centain level of absurdity, after which fixing a goof in standards
makes sense even if it theoretically can break some existing program.
In my opinion, the key word here is "theoritically".
Is there even one real-world program which depends on this?
I bet there is not.
--
vda
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/