[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "mv a b/" when b does not exist
From: |
Tim Waugh |
Subject: |
Re: "mv a b/" when b does not exist |
Date: |
Tue, 29 Nov 2005 17:12:43 +0000 |
User-agent: |
Mutt/1.4.2.1i |
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. In this instance, the underlying rename call works without
any problem:
$ mkdir a; rm -rf b; perl -e 'rename "a", "b/" or die "$!"'
$ file a b
a: ERROR: cannot open `a' (No such file or directory)
b: directory
..but the equivalent mv command does not in 5.93, whereas it did in
5.2.1:
$ mkdir a; rm -rf b; mv a b/
$ mv --version
mv (coreutils) 5.2.1
$ mkdir a; rm -rf b; mv a b/
mv: target `b/' is not a directory: No such file or directory
$ mv --version
mv (GNU coreutils) 5.93
> If you can convince the kernel folks to change the way rename works,
> or POSIX to dissociate mv behavior from that of rename(2), then you
> might have a case for changing GNU mv.
The kernel rename syscall is working fine, and does not fail.
Tim.
*/
pgpqL01zy06jL.pgp
Description: PGP signature
- "mv a b/" when b does not exist, Tim Waugh, 2005/11/28
- Re: "mv a b/" when b does not exist, Paul Eggert, 2005/11/28
- Re: "mv a b/" when b does not exist, Paul Eggert, 2005/11/30
- Re: "mv a b/" when b does not exist, Eric Blake, 2005/11/30
- Re: "mv a b/" when b does not exist, Paul Eggert, 2005/11/30
- Re: "mv a b/" when b does not exist, Jim Meyering, 2005/11/30
- Re: "mv a b/" when b does not exist, Bob Proulx, 2005/11/30