Tim Waugh <[EMAIL PROTECTED]> wrote:
> On Tue, Nov 29, 2005 at 05:24:32PM +0100, Jim Meyering wrote:
>
>> Note that the underlying rename would fail on Linux 2.6.x and *BSD
>> (but it'd succeed on Solaris 9 and 10):
>
> No, you're looking at a different case:
>
>>   $ touch a; rm -rf b; perl -e 'rename "a", "b/" or die "$!"'
>>   Not a directory at -e line 1.
>>   [Exit 20]
>
> Certainly if "a" is a regular file I wouldn't expect this to work, and
> in fact it does not work on Linux with coreutils-5.2.1 either.
>
> The particular case I wanted to raise awareness of is when "a" is a
> directory.

I see, now.  Thanks.

*That* is a bug.  Ouch.  And it needs to be fixed in coreutils-5.94.
If someone feels like preparing a patch along with ChangeLog entries,
NEWS, and test cases, I won't complain.

The problem is the strip_trailing_slashes (dest) call in mv.c.  It
may need to be removed altogether, and the new behavior documented.
Otherwise, rm -rf a; touch a; mv a b/ will mistakenly succeed on
Linux-based systems.  Testing how the underlying rename function
handles this case will be tricky, since you'll get different results
on e.g., Solaris 7 and earlier.

Note that the --strip-trailing-slashes option affects only source
file names.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to