Subject: bug#27986: 26.0.50; 'rename-file' can rename files without

From: Eli Zaretskii <[email-masked]>
Date: Sun, 20 Aug 2017 05:37:33 +0300

> From: Richard Stallman <[email-masked]>
> Date: Sat, 19 Aug 2017 17:33:56 -0400
> 
>   > Btw, in case it isn't clear: the issue at hand is an incompatible
>   > change to rename-file (and probably also other functions, like
>   > copy-file).  Where previously (rename-file A B) with B a directory
>   > will move A into B/A, under the proposed change it will only do so if
>   > B actually ended in a slash; otherwise it will move A to B, deleting B
>   > if it exists.  The incompatibility will manifest itself if some old
>   > code expects to get B/A, but instead gets either an error (if B is a
>   > non-empty directory) or B silently removed (if it is empty).
> 
> Assuming this applies only when directory B is empty, so that this
> won't delete non-empty directories, then I don't have any objection.
> I would object to deleting non-empty directories here.
> 
> Another option that might be good is to make this operation always
> signal an error in the case where B is a directory and does not end
> with a slash.
> 
> I don't have an opinion about which of those two is better.

Thanks.  I do indeed think that making this an error even if B is an
empty directory would be better, as it will reveal the cases that need
to be fixed more prominently.