Re: mv: Moving directories to themselves (not the bug with incorrect error message)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Michal Wencl on 11/18/2007 3:16 AM: mkdir -p a b/a touch a/1 a/2 b/a/2 move a b Current result: In my version of mv (5.97) the following error message is returned: Consider upgrading. The latest stable version of coreutils is 6.9, and it includes some bug fixes for mv. Expected result: Directory a is fully moved to directory b/a, thus b/a contains files 1 and 2 where b/a/2 was overwritten witch a/2. Wrong. POSIX doesn't allow this behavior. In order to move directory a to a subdirctory of b, when b/a already exists, b/a must be unlinkable; but since b/a is not empty, it can't be unlinked. Could you think about it, please? It would be great if at least a switch for it was added to mv (and other coreutils). What you appear to be wanting is a new option to mv, maybe spelled like 'mv --merge'. But such a feature is not part of coreutils yet, because no one has submitted a patch for it. - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHQDw684KuGfSFAYARAvTiAJ4iBg1Ao0I16Y4vcxSIrtJJ4aeUUwCdGOd1 fUxP2Kr0h+vbSm0mRrjD8mQ= =z0MJ -END PGP SIGNATURE- ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
mv: Moving directories to themselves (not the bug with incorrect error message)
Hi. I'm not sure if this is a bug, feature, todo, or a change request but I think the current behaviour is not expected for most people. At least not for those coming from Windows. My scenario: mkdir -p a b/a touch a/1 a/2 b/a/2 move a b Current result: In my version of mv (5.97) the following error message is returned: mv: cannot move `a' to a subdirectory of itself, `b/a' I know it was changed to a more meaningful message in later version but this is not the problem. Expected result: Directory a is fully moved to directory b/a, thus b/a contains files 1 and 2 where b/a/2 was overwritten witch a/2. Moreover, this is how mv works if b/a doesn't exist yet. It creates b/a and moves a/* inside. Could you think about it, please? It would be great if at least a switch for it was added to mv (and other coreutils). Thanks, Michal Wencl ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: mv: Moving directories to themselves (not the bug with incorrect error message)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Eric Blake on 11/18/2007 6:20 AM: Could you think about it, please? It would be great if at least a switch for it was added to mv (and other coreutils). What you appear to be wanting is a new option to mv, maybe spelled like 'mv --merge'. But such a feature is not part of coreutils yet, because no one has submitted a patch for it. As a followup, I'm pretty sure rsync already does what you are looking for, so why bloat mv to do something that can be done with another tool? - -- Don't work too hard, make some time for fun as well! Eric Blake [EMAIL PROTECTED] -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.5 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHQD1I84KuGfSFAYARAtehAKCKcuXr5P3lcuvPQmT+iprw4LWmIQCfdCyl L3aMb0bqHSlTSZ2VcJ0xgnM= =TTAH -END PGP SIGNATURE- ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: mv: Moving directories to themselves (not the bug with incorrect error message)
As a followup, I'm pretty sure rsync already does what you are looking for, so why bloat mv to do something that can be done with another tool? Thanks for a quick answer. I didn't study rsync deeply yet but I understand it as a copy utility that temporarily takes filesystem space and wears down a storage medium when moving files to another directory. That is not necessary (it's unwanted) in this case. The mv --merge you proposed might still be useful. ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils
Re: mv: Moving directories to themselves (not the bug with incorrect error message)
Michal Wencl wrote: As a followup, I'm pretty sure rsync already does what you are looking for, so why bloat mv to do something that can be done with another tool? I didn't study rsync deeply yet but I understand it as a copy utility that temporarily takes filesystem space Rsync is a swiss-army-chainsaw tool. It has a zillion options and operating modes. But it is also often simply the best tool for the job too. Check out the --inplace option. It is not a perfect fit but may be enough. and wears down a storage medium when moving files to another directory. I think you are thinking of the work needed to compare two files between the client and the server. For individual runs it is unlikely to be a problem. It becomes a problem when a server is serving a large number of files to a large number of clients. The large number of processes all grinding away can be a problem. But in the single threaded case it is not much different from other file copy methods. That is not necessary (it's unwanted) in this case. The mv --merge you proposed might still be useful. If someone were to write a patch with a copyright assignment to the FSF so that it could be used I am sure that it would be considered. Bob ___ Bug-coreutils mailing list Bug-coreutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-coreutils